What are the impacts (If any) by developing code in Perl 5.6.1 but running the code in Perl 5.8.x or 5.10.x?
I'm using these modules:
(For Linux)
HTTP::Request
HTTP::Response
LWP::UserAgent
Unicode::String
XML::DOM
DateTime::Format::DateManip
(For Windows)
Unicode-String
XML-DOM
DateTime-Format-DateManip (Haven't installed this yet ...
How would I create a hash like the follow:
my %hash = (key1=>"Something", key2=>$hash{key1} . "Else");
Can this not be done while when I declare the hash? So far, the only thing I came up with was:
my %hash = (key1=>"Something");
$hash{key2} = $hash{key1} . "Else";
...
I have an asterisk-based PBX, and I have been able to successfully run an AGI script from the web control panel of the PBX.
Because I am calling AGI from Perl (neither of which I know, yet)...
asterisk commands look like this:
print "SET CALLERID $newcid \"\"\n";
So far, I don't expect to need to do any database lookups, etc. ...
Possible Duplicate:
How can I list all of the files in a directory with Perl?
I want to loop through a few hundred files that are all contained in the same directory. How would I do this in Perl?
...
I would like to get this timestamps formatting:
01/13/2010 20:42:03 - -
Where it's always 2 digits for the number except for the year, where it's 4 digits. And it's based on a 24-hour clock.
How can I do this in Perl? I prefer native functions.
...
I have a Perl DBM hash containing a list of URLs that I want to pick randomly from to load balance spidering sites. As a result I want to pick a key at random, or select the nth element (so I can randomise n).
I'm aware this goes against the concept of a hash, but is this possible?
NOTE: missed a valuable point that hash size will be ...
When I need a Perl module, I typically use CPAN. It works fine. But not this time.
I want to use MARC::Charset, but this one uses GDBM_File, and I can't seem to install GDBM_File from CPAN.
CPAN finds it all right, but trying to install it, it starts installing the full Perl 5.10.1 distribution.
MARC::Charset is a rather old module, s...
Hello stackers,
in https://rt.cpan.org/Ticket/Display.html?id=37194#txn-641389 I reopened a bug concerning a Perl crash in conjunction with the libreadline XS bindings. I attached the necessary debug information, but until now there has been no acknowledgement from the maintainer. I want this finally fixed; it's a major inconvenience to...
I have a Perl module for a project. I have maybe a dozen programs hanging off it and a lot of it is garbage. I hadn't spent much close personal time with DBI before, so that part is fixable, but the big thing is that it is big. Literally 2KLOCs.
It would be easy to break up this function (let's call it Dumb.pm) into separate modules ( ...
I have a legacy Perl CGI page running on Apache that processes a large Excel spreadsheet worth of data, adding to the database as necessary. It gets processed in groups of data, and each group of data gets sent to the database.
After each call to the database, my system's available memory decreases significantly to the point where there...
I have a string which may hold special characters like: $, (, @, #, etc.
I need to be able to perform regular expressions on that string.
Right now if my string has any of these characters the regex seems to break since these are reserved characters for regex.
Does anybody knows a good subroutine that would escape nicely any of these c...
How can I specify that Smart::Comments be loaded for my original script, as well as for any of the modules it directly loads. However, since it is a source-filter, it would probably wreck havoc if applied to every module loaded by every other loaded module.
For example, my script includes
use Neu::Image;
I would like to load Smart:...
I need to add a few lines in an XML file at a particular node, in Perl. So, I need to search for a particular node and then add those lines. Which parser would you recommend for this?
...
Okay so the way this works is the user authenticates via web form and generates a session ID as so:
sub session_open
{
my $sid;
my $user = shift;
if ( open(SEMA, "> ../sema/sess") )
{
flock SEMA, LOCK_EX;
do
{
$sid = generate_session_id();
}
while ( -d "$SDIR/$sid" )...
Situation:
I have a module Foo::Quux::Bar, living in ./Bar.pm. I need to be able to unit test Bar. However, it is not advantageous due to circumstances beyond my control to set up a Foo/Quux directory structure.
So what I'd like to do is have some sort of unit_test_use routine that lets me grab Bar.pm and move/copy its functions into ...
My (Perl-based) application needs to let users input regular expressions, to match various strings behind the scenes. My plan so far has been to take the string and wrap it in something like
$regex = eval { qr/$text/ };
if (my $error = $@) {
# mangle $error to extract user-facing message
($text having been stripped of newlines ahe...
In Perl before 5.10 there is no "state" declaration.
I've come across an example of creating static variables in these Perls: my $x if 0. The if 0 conditional makes the variable act like a static variable:
use strict; use warnings;
add() for 1..7;
sub add {
my @arr = () if 0;
push @arr, '+';
print @arr, "\n";
}
prints:
...
How can I search and replace a match with specific number of times using s///;. For example:
$string="abcabdaaa";
I want to replace a with i in $string n times. How can I do that? n is an integer provided by user.
...
Is there an easy to use "what-you-see-is-what-you-get" editor for Pod available?
I'm not that used to the Pod syntax yet so having the option of writing the Pod and immediatly see what the output would look like will help a lot. Ideally this editor would have some kind of "code-completion" to help with the correct syntax.
Is there an ...
I got a problem implementing a PHP programm in C++. It is about the PHP/Perl function unpack. I don't know how to do the follwing in C++ (no problem in reading a file... but how do i unpack("C*") the read contents).
<?php
$file = fopen("bitmaskt.dat", "rb");
//create the data stream
$matrix_x = unpack("C*", fread($file, 286));...