The function getPageDimensions (of CAM::PDF) returns same values for both portrait and landscape pages.
How can I identify the orientation of a PDF page?
I am using CAM::PDF Perl library and would like to know how to do this using this library.
But any other means to identify this is also welcome (preferably using a Perl lib).
Thanks.
...
Hi
I have a 14Mb file with a matrix, in raw binary format. I would like to slurp it and have something like an array of arrays, so I can read some values. I was hoping to find some magical perl module that would, given the size of the matrix, do all the work for me :) But I can't find it, and I suspect I'm just missing a more obvious ...
I have application that works using Perl's CGI::Fast.
Basically mainloop of the code is:
while (my $cgi = CGI::Fast->new() ) {
do_whatever( $cgi );
}
Now, I wanted to add ability to kill it, but without disrupting currently processed request. To do so, I added handling to SIGHUP. More or less along the lines:
my $sighupped = 0;
$S...
We have an existing Perl application that supports mod_perl. However, our new host (Dreamhost) does not suppport mod_perl, only FastCGI; thus necessitating the port.
The existing code does not use any Apache specific stuff and is just normal Perl code written in way that's acceptable to mod_perl.
Reading the documentation and online t...
I'm using Archive::Tar::Streamed to archive a 4GB directory containing very small small source code files and some jars. I'm using a system with 4GB RAM and using Archive::Tar::Streamed because I don't want my entire directory to be on the memory as it results in out of memory condition. I reading files one by one from the directory in D...
I want to check the results of an operation in the Net::FTP Perl module rather than die.
Typically you would do:
$ftp->put($my_file)
or die "Couldn't upload file";
But I want to do something else instead of just dying in this script so I tried:
$ftp->put($my_file)
or {
log("Couldn't upload $my_file");
return(-1);
}...
I'm trying to remove unused spans (i.e. those with no attribute) from HTML files, having already cleaned up all the attributes I didn't want with other regular expressions.
I'm having a problem with my regex not picking the correct pair of start and end tags to remove.
my $a = 'a <span>b <span style="color:red;">c</span> d</span>e';
$a...
A coworker is trying to use ack (a Perl program) on his Windows machine, having tried it under Linux and decided he definitely wants to use it. He managed to get Strawberry Perl installed on his machine, but can't seem to figure out what to do to make ack run with it from a command prompt. He tried editing the #! line, but I knew that ...
Hi, I'm just starting to use Moose.
I'm creating a simple notification object and would like to check inputs are of an 'Email' type. (Ignore for now the simple regex match).
From the documentation I believe it should look like the following code:
# --- contents of message.pl --- #
package Message;
use Moose;
subtype 'Email' => as 'S...
I often find it useful to be able to schedule code to be executed upon leaving the current scope. In my previous life in TCL, a friend created a function we called defer.
It enabled code like:
set fp [open "x"]
defer("close $fp");
which was invoked when the current scope exited. The main benefit is that it's always invoked no m...
Hi all:
I am going to be writing an application that does a bit of computation on data it gets from a RESTful web service and outputs to a text file and/or HTML page. The web service is XML over HTTP. I have done a simple proof of concept with LWP::Simple and XML::Simple, but it's all a bit ad-hoc.
Can anyone recommend some Perl modu...
I am learning Perl, so please bear with me for this noob question.
How do I repeat a character n times in a string?
I want to do something like below:
$numOfChar = 10;
s/^\s*(.*)/' ' x $numOfChar$1/;
...
Common Lisp guys have their CL-WHO, which makes HTML templating integrated with the "main" language thus making the task easier. For those who don't know CL-WHO, it looks like this (example from CL-WHO's webpage):
(with-html-output (*http-stream*)
(:table :border 0 :cellpadding 4
(loop for i below 25 by 5
do (htm
(:tr :a...
You are given either an IO::File object or a typeglob (\*STDOUT or Symbol::symbol_to_ref("main::FH")); how would you go about determining if it is a read or write handle? The interface cannot be extended to pass this information (I am overriding close to add calls to flush and sync before the actual close).
Currently I am attempting to...
Is there an API for google that I can use in my Perl program so that it returns number of results found for a search term?
Whenever a search is done on google, on the far right, it has a number of results it found and the time it took. I would just like to get this information.
...
I want to capture all the progress messages emitted by an rsync process from a Perl script. In certain circumstances this isn't working.
Here's a typical rsync command line I use:
rsync -aL --verbose --progress --bwlimit=100 \
--include-from=/tmp/78hJ2eDCs1 \
--include '*/' --exclude '*' \
/srcdir/* \
hostname:/target/ 2>&1
I...
I'm new to Perl and am working on a project for school and am stuck.
Input: A given text file containing email addresses delimited by a space, tab, ",", ";" or “:” [can be on separate lines].
I am trying to read in the email addresses and put them into an array. I am able to parse the data on one line however if there are line breaks ...
EDIT: Link should work now, sorry for the trouble
I have a text file that looks like this:
Name, Test 1, Test 2, Test 3, Test 4, Test 5
Bob, 86, 83, 86, 80, 23
Alice, 38, 90, 100, 53, 32
Jill, 49, 53, 63, 43, 23.
I am writing a program that given this text file, it will generate a Pearson's correlation coefficient table that looks li...
I have a bunch of files that contain a semi-standard header. That is, the look of it is very similar but the text changes somewhat.
I want to remove this header from all of the files.
From looking at the files, I know that what I want to remove is encapsulated between similar words.
So, for instance, I have:
Foo bar...some text here...
Using Cygwin Perl v5.8.8 and Win32::TieRegistry 0.26.
We can get a tied hash object thing for HKEY_CURRENT_USER:
$ perl -e '
my %RegHash;
use Win32::TieRegistry( TiedHash => \%RegHash );
use Data::Dumper;
my $Key = $RegHash{"HKEY_CURRENT_USER"};
print Dumper $Key;'
$VAR1 = bless( {}, 'Win32::TieRegistry' );
And this works for sub key...