In my app, I put all the modules in one directory , let's just call it libx.
Since it's up to the user to choose where to deploy the app, I don't want to hardcode the lib path.
So at the beginning of myapp.pl, I wrote the following lines of code.
#! /usr/bin/perl -w
use strict;
my $curr_dir = $0;
my $curr_lib = $curr_dir;
$curr_lib =...
As some of you might know I am the lead developer of Padre, the Perl IDE. In the first year of its development Padre became an acceptable text editor with some extra features for Perl development.
I'd like to ask the Stack Overflow community for some help in driving the project further to turn it into an exceptional IDE for Perl develop...
I was wondering whether using POSIX.pm would make my Perl code less cross platform. From reading the documentation it's not very clear how well it's supported on Win32/64 Perl implementations.
Is it wise to rely use POSIX.pm if one cares about portable code?
...
I am trying to Convert hex representations of Unicode characters to the characters they represent. The following example works fine:
#!/usr/bin/perl
use Encode qw( encode decode );
binmode(STDOUT, ':encoding(utf-8)');
my $encoded = encode('utf8', "\x{e382}\x{af}");
eval { $encoded = decode('utf8', $encoded, Encode::FB_CROAK); 1 }
or p...
I need some code in my program which takes a number as input and converts it into corresponding text e.g. 745 to "seven hundred forty five".
Now, I can write code for this, but is there any library or existing code I can use?
...
I maintain a software stack consisting of Perl and Cyrus IMAP among other things.
Perl seems to be working fine and Cyrus cyradm (a perl script) works fine too. However, sieveshell will not execute and reason for asking for help here.
When I run sieveshell, I get the follow output:
Can't load '/usr/local/pozix/perl-5.10.0/lib/site...
Hi Guys,
Suppose the module AAA::BBB::CCC located in ~/modules/AAA/BBB/CCC.pm,
and "~/modules" is in @INC, so why the following code doesn't work and lead to compile error?
$class = "AAA::BBB" ;
$type = "CCC";
require $class . '::' . $type ;
I try to use require AAA::BBB::CCC instead, it works . If I do need dynamically require a mo...
Hi guys. I am creating a pdf from a list of image files and I was wondering if it was possible to create each page of my pdf to be the size of whatever image I am currently adding - so they all fit and none of the larger ones get cropped or whatever.
Currently I'm creating pages like this: my $page = $pdf->page();
I have an object of...
First off, does anyone have a comprehensive list of the Perl special variables?
Second, are there any tasks that are much easier using them? I always unset $/ to read in files all at once, and $| to automatically flush buffers, but I'm not sure of any others.
And third, should one use the Perl special variables, or be more explicit in ...
Hello! Each time I build a Catalyst application I come to a point where the application gets painfully slow to (re)start, the delay is about 10 seconds. Today I figured the delay is caused by the following lines:
use lib '/home/zoul/opt/lib/perl/5.8';
use lib '/home/zoul/opt/share/perl/5.8';
use lib '/home/zoul/opt/lib/perl/5.8.8';
use ...
I am working on a moderately complex Perl program. As a part of its development, it has to go through modifications and testing. Due to certain environment constraints, running this program frequently is not an option that is easy to exercise.
What I want is a static call-graph generator for Perl. It doesn't have to cover every edge ca...
I have this at the top of my personal configuration file (as well as holidays, which are being respected, so I know the file is being read...):
WorkDayBeg = 08:00
WorkDayEnd = 17:00
... and yet when I do a delta on 08:00 to 17:00 in business mode, it says 8 hours instead of 9. It is defaulting to a work day of 09:00 to 17:00.
Any id...
Is it possible to do:
@foo = getPileOfStrings();
if($text =~ /@foo(*.?)@foo/)
{
print "Sweet, you grabbed a $1! It lived between the foos!";
}
What's going on here is I need a $text =~ /($var1|$var2|$var3)(*.?)($var1.../; I don't know how many values there are, and I don't know the values until run-time.
Array interpolation into a ...
I have some code that grabs the "between" of some text;
specifically, between a foo $someword and the next foo $someword.
However, what happens is it gets stuck at the first "between" and somehow the internal string position doesn't get incremented.
The input data is a text file with newlines here and there: they are rather irrelevant,...
I have an issue where an application is randomly dying during a DBI call. We cannot reliably reproduce this in our test or acceptance environment, so I am required to monitor it on our production system to try to figure out what is happening.
I am logging all the DBI traffic via the DBI_TRACE environment variable.
DBI_TRACE=3=dbi.log s...
Does anyone know how to shuffle two arrays randomly in exactly the same way in Perl?
For example, say I have these two arrays:
Before shuffling:
array 1: 1, 2, 3, 4, 5
array 2: a, b, c, d, e
After shuffling:
array 1: 2, 4, 5, 3, 1
array 2: b, d, e, c, a
So every element in each array is bound to its equivalent element.
...
In Perl, if a variable holds the name for another variable, how do I use the first variable to visit the other one?
For example, let
$name = "bob";
@bob = ("jerk", "perlfan");
how should I use $name to get to know what kind of person bob is?
Although I'm not quite sure, my vague memory tells me it might related to typeglob.
...
I have code like below. If I open the file $File::Find::name (in this case it is ./tmp/tmp.h) in my search function (called by File::Find::find), it says "cannot open the file ./tmp/tmp.h reason = No such file or directory at temp.pl line 36, line 98."
If I open the file directly in another fuction function, I am able open the file.
C...
I have a number, and need to add a decimal to it for formatting.
The number is guaranteed to be between 999999 and 1000 (I have covered the other possibilities in other ways, this is the one I can't get my head around). I need to put a decimal before the last 3 digits, such as:
999.999 or 1.000 or 23.513
What kind of regex will accomp...