I have several web pages on several different sites that I want to mirror completely. This means that I will need images, CSS, etc, and the links need to be converted. This functionality would be similar to using Firefox to "Save Page As" and selecting "Web Page, complete". I'd like to name the files and corresponding directories as s...
I have a Perl script running on UNIX that uses DBI to connect to and retrieve data from a SQL Server database. The script looks like the following:
$dbh = DBI->connect("dbi:Sybase:server=$connect;charset=UTF-8", $login, $password) or die("Couldn't connect to $connect as $login/$password:
$DBI::errstr");
$sql = "use mydb";
$sth = $dbh-...
Is it a good idea to quote keys when using a hash in Perl?
I am working on an extremely large legacy Perl code base and trying to adopt a lot of the best practices suggested by Damian Conway in Perl Best Practices. I know that best practices are always a touchy subject with programmers, but hopefully I can get some good answers on this...
Hi,
Advance New Year Wishes to All.
I have an error log file with the contents in a pattern parameter, result and stderr (stderr can be in multiple lines).
$cat error_log
<parameter>:test_tot_count
<result>:1
<stderr>:Expected "test_tot_count=2" and the actual value is 3
test_tot_count = 3
<parameter>:test_one_count
<result>:0
<stder...
I've been programming in C-derived languages for a couple of decades now. Somewhere along the line, I decided that I no longer wanted to write:
if (var) // in C
if ($var) # in Perl
when what I meant was:
if (var != 0)
if (defined $var and $var ne '')
I think part of it is that I have a strongly-typed brain and in my mind, "if...
According to the Perl source code page on CPAN, 5.8.9 is now 14 days old, and will be the last 5.8 release. 5.10.0 is over a year old and presumably ready for use in Production.
Leaving aside discussion of Perl 6 for now, can I ask what versions of Perl folks are testing, rolling out and using in production? We have currently standardiz...
I am trying to prefix a string (reference_) to the names of all the *.bmp files in all the directories as well sub-directories. The first time we run the silk script, it will create directories as well subdirectories, and under each subdirectory it will store each mobile application's sceenshot with .bmp extension.
When I run the automa...
What's the best way to read a fixed length record in Perl. I know to read a file like:
ABCDE 302
DEFGC 876
I can do
while (<FILE>) {
$key = substr($_, 0, 5);
$value = substr($_, 7, 3);
}
but isn't there a way to do this with read/unpack?
...
How do I find detailed documentation on the behavior of the sth_to_objects() method in the Class::DBI module?
...
I've built a number of work-specific helper functions that could be useful for other members of my teambut I've written them all in Emacs' Elisp. And getting them to convert from Notepad++ is NOT going to happen.
So, I'm thinking convert the functions to Perl. No problem.
Except I use ido-completion all the time to limit responses:
...
I'm using Apache 2. I know how to handle .pl files as "cgi-script", but mod_perl is supposedly way faster. I successfully built and installed mod_perl, but how do I change httpd.conf so that .pl files will be handled by mod_perl (and not as cgi-script)?
...
Hi,
I'm new to Python, reason I'm learning it right now is because of the Django framework. I have been a Perl programmer for a number of years and I'm so used to Perl's tools. One of the things that I really miss is Perl's CPAN and its tools. Is there anything equivalent in Python? I would like to be able to search, install and mai...
I've started learning Perl but most of my former programming experience has been in languages that emphasize object oriented programming such as C# and Java. All the Perl examples I have found tend to be long single function programs and I find my self writing code the same way. Are there any resources or tutorials for writing maintainab...
I've used the localtime function in Perl to get the current date and time but need to parse in existing dates. I have a GMT date in the following format: "20090103 12:00" I'd like to parse it into a date object I can work with and then convert the GMT time/date into my current time zone which is currently Eastern Standard Time. So I'd li...
I have a directory of files that I would like to scan on a regular basis and execute with the default application they are associated with. They are not executable so system("file.torrent"); does not work. How are you able to run files with there associated applications in Perl?
...
Let us ignore for a moment Damian Conway's best practice of no more than three positional parameters for any given subroutine.
Is there any difference between the two examples below in regards to performance or functionality?
Using shift:
sub do_something_fantastical {
my $foo = shift;
my $bar = shift;
my $baz = shif...
What's the best way to profile Perl regexes to determine how expensive they are?
...
This relates to a previous question: How can I read Perl data structures from Python?. It could be a bug in the version of the YAML parser that I'm working with (0.66), but when I run:
perl -MYAML -le 'do shift; print YAML::Dump( $CPAN::Config )' simple.pl
On the following simple.pl:
%config = (
'color' => 'red',
'numbers' =>...
Given Wikipedia's discussion of Double Factorials, can anyone suggest where I might find a bignum version of this for Perl, or else suggest how it might be written?
...
Is there any Perl script to get the pages from a PDF file and convert the same to another PDF file?
...