when I try to use a "third part module" in my perl script, I got some error message like
"unknown error, compilation failed in require at ... line xxx"
nothing else and the line mentioned in the error message is exact the same line I "use the module"...
my question is: are there any good practice to handle this situation? like a list to...
Related to my previous question (found here), I want to be able to implement the answers given with a 2 dimensional array, instead of one dimensional.
Reference Array
row[1][0]: 13, row[1][1]: Sony
row[0][0]: 19, row[0][1]: Canon
row[2][0]: 25, row[2][1]: HP
Search String: Sony's Cyber-shot DSC-S600
End Result: 13
...
I'm working from a question I posted earlier (here), and trying to convert the answer to a sub so I can use it multiple times. Not sure that it's done right though. Can anyone provide a better or cleaner sub?
I have a good deal of experience programming, but my primary language is PHP. It's frustrating to know how to execute in one lan...
We have a server farm that we are slowly migrating to a new version of Perl (5.12.1). We are currently running 5.8.5. The OS will be upgraded from RedHat 4 to RedHat 5 as well, but RedHat 5 is still back on Perl 5.8.8. Thus for a while in our source tree we'll be supporting two versions of Perl.
I have been told to install the new v...
I'm writing a multithreaded website uptime checker in perl, and here is the basic code so far (includes only threading part):
#!/usr/bin/perl
use LWP::UserAgent;
use Getopt::Std;
use threads;
use threads::shared;
my $maxthreads :shared = 50;
my $threads :shared = 0;
print "Website Uptime Checker\n";
my $infilename = $ARGV[0];
cho...
How can I change this code to insert lines if missing without deleting existing ones?
tie my @lines, 'Tie::File', $fn or die "could not tie file: $!";
for (my $i = 0; $i < @lines; $i++) {
if ($ln_title == 0) {
if ($i < $#lines and $lines[$i] =~ /(\s+TRACK \d\d .*)$/) {
...
I'm wondering if there is an equivalent to Qt's signal/slot mechanism for Perl. I have looked into POE, but since it's huge, I couldn't find anything useful.
Thank you in advance,
...
How do I call informix stored procedures from Perl? I use DBD::ODBC to connect to informix database, but I don't know how to call procedures. my code like this:
my $dbh = DBI->connect("dbi:".DBDRIVE.":".DBNAME,DBUSER,DBPASS,
{RaiseError=>0,PrintError=>0,AutoCommit=>1}) ||
die $DBI::errstr;
$dbh->do("e...
Could someone provide a good /nice solution in Perl for comparing 2 arrays (a and b) which check if every element on array a is found in array b (and found only once in array b)?
...
I need to move or copy a simple text file from one web site to another web site.
I have administrator rights to both web sites. The first web site has a large data file (again, just a text file), certain records are selected and written to a team file (for entry into a tournament). Next I go through paypal and pay for the entries. The se...
This might be a shot in the dark, but I am trying to implement an OpenID Provider in Perl using the Net::OpenID::Server module. The documentation for the entire process is confusing and sparse.
If anyone has successfully implemented a provider in Perl, could you please paste some code snippets?
...
I have a basic perl HTTP server using HTTP::Daemon. When I stop and start the script, it appears that the port is still being listened on and I get an error message saying that my HTTP::Daemon instance is undefined. If I try to start the script about a minute after it has stopped, it works fine and can bind to the port again.
Is there a...
Sometimes I need a useful utility function, like List::Util::max in the middle of a large program that does lots of stuff. So if I do
use List::Util 'max';
At the top of my program, I'm stuck with that symbol, polluting my whole namespace, even though I only need it in one subroutine.
So I've been thinking of trying a different patte...
I am trying to figure out children processes of a given parent from ps fwaux (there may very well be a better way to do this). Basically, I have daemons running that may or may not have a child process running at any given time. In another script I want to check if there are any child processes, and if so do something. If not, error out....
Hi,
is there any well written perl open source out there (not using any kinda of framework) that i could use as sample for learning and good pratice of the perl...
I've searched around and found many things for PHP, but nothing in perl that uses no framework.
Thanks in advance.
...
I have an application that is being expanded to the UK and I will need to add support for Latin-9 Unicode. I have done some Googling but found nothing solid as to what is involved in the process. Any tips?
Here is some code (Just the bits for Unicode stuff)
use Unicode::String qw(utf8 latin1 utf16);
# How to call
$encoded_txt = $self-...
I have a situation where something can appear in a format as follows:
---id-H--
Header: data
Another Header: more data
Message: sdasdasdasd
Message: asdasdasdasd
Message: asdasdasd
There may be many messages, or just a couple. I'd prefer not having to step outside of RegEx, because I am using the RegEx to parse some header information...
The question is pretty simple, is it possible to create a FIPS 140-2 compliant server in Perl? Especially, is it possible without modifying any of the C code for the modules? If it's not possible in straight Perl, what would be the easiest way to go about it from a C perspective?
I'm basically creating a mini-httpd that only serves up a...
Hey Guys,
How would I save JSON outputed by an URL to a file?
e.g from the Twitter search API (this http://search.twitter.com/search.json?q=hi)
Language isn't important.
Thanks!
edit // How would I then append further updates to EOF?
edit 2// Great answers guys really, but I accepted the one I thought was the most elegant. Thanks!...
Is it possible to access a Apache::DBI database handle from a perl script (that isn't running under mod_perl).
What I am looking for is database pooling for my perl scripts, I have a fair number of database sources (oracle/mysql) and a growing number of scripts.
Some ideas like SQLRelay, using Oracle10XE with database links and pooling...