I have a perl object with a few functions in it. Each functions is called once from the main program. I would like to run some of the functions in parallel to save time. I can't run all of them together since some functions depend on the results of previous functions.
I thought of something like this:
For each function keep a flag tha...
Before using R, I used quite a bit of Perl. In Perl, I would often use hashes, and lookups of hashes are generally regarded as fast in Perl.
For example, the following code will populate a hash with up to 10000 key/value pairs, where the keys are random letters and the values are random integers. Then, it does 10000 random lookups in th...
Hi all
So, I have been asked to remove a menu item on a website running Movable Type. "No problem", I thought.
So I log in, and try to figure out WHERE those damn templates can be edited. I finally find something that looks real, edit it, update the page and NOTHING HAPPENED.
I then log in to the FTP and discovers, that ALL pages exam...
Hi folks,
I have a number of modules that I would like to store in my local app dir (perhaps something like ./lib) and check into source control. Ideally, this would include all of the module dependencies.
The end goal is to be able to deploy to a number of boxes (which only have a basic perl install) and ensure that the script has th...
I've achieved several partial successes, but can't cross the last hurdle.
Symptom: When in test mode FastCGI performs perfectly. When running plain perl scripts in eval or do mode it performs perfectly. As soon as I attempt to access the FCGI::Request() object or the CGI::Fast->new object, it hangs indefinitely. Here's my config:
[Typ...
Let's say I have a perl module file and I want to include and use it dynamically at runtime. Said module includes a class that I need to instantiate without knowing its name until runtime.
For example,
#inside module.pm
package module;
sub new {
#setup object
}
#inside main.pl
#get module.pm as argument
my $module_var = #load refe...
Anyone see anything wrong with this code? When we execute it (on Linux), we get taken straight to the "Error: Unknown host" block.
Perl is version 5.8.6
$hostname = "host2";
if ($hostname eq "host1") {
$dbhost = 'dbi:Oracle:dbhost1';
}
elsif ($hostname eq "host2") {
$dbhost = 'dbi:Oracle:dbhost2';
}
elsif ($hostname eq "host3" |...
I want to post my user and password with Perl to a website. The source of the login page is:
<div class="top">Sign In</div>
<div class="row"><label for="username">Username:</label></div>
<div class="row"><div id="login:usernameContainer">
<input id="login:usernameContainer:username" type="text"
name="login:userna...
I run on Mac OS X 10.5 and I want to write a program in Perl. However, I need to install the module RDF::Trine and DBD::CSV and I got an error when I install both.
If I write :
install RDF::Trine
The error is :
Files=51, Tests=5, 2 wallclock secs ( 0.21 usr 0.18 sys + 1.30 cusr 0.51 csys = 2.20 CPU)
Result: FAIL
Failed 49/51 t...
I want to monitor memory usage when running a program in perl, so that if the memory used by the current program is more than a threshold, I apply approach A, otherwise, apply approach B.
Anyone has any idea?
...
I'm trying to set the file permissions of files contained in a tarball with the following:
print "Checking $tgz_file... ";
my $edited = 0;
my $tarball = Archive::Tar->new($tgz_file);
my @items = $tarball->get_files();
foreach (@items) {
if ($_->is_dir && $_->mode != 0755) {
$_->mode(0755);
$edited = 1;
} elsif ($...
Is it possible to convert a google doc to png or PDF from a script/command line?
...
I've been looking at ways to add a Perl-based SOAP server to our systems. Every time I look @ the SOAP tools in Perl I'm disappointed at how much more developer overhead seems to be required than folks in the VS.net world. (And I've been looking for a long time)
From reviewing other questions here, it looks like XML::Compile::SOAP see...
Hi, I'm using nginx with this script as FastCGI wrapper, that I start with:
spawn-fcgi -F 3 -u www-data -s /var/run/perl-fcgi.sock -P /var/run/perl-fcgi.pid -- ./perl-fcgi.pl
Now, suppose I have a simple script:
#!/usr/bin/perl
print "Content-type: text/plain\r\n\r\n";
print "hello\n";
The script runs fine, and I see the "hello" w...
I'm trying to get XPath to return an attribute value yet first search for the tag's contents, i.e. if I have
<select name="xxx">
<option=bla>123</option>
<option=blubb>456</option>
</select>
I want to say, "search for the option tag containing 456 within a certain select tag with name "xxx".
I do this:
my $xp = XML::XPathEngine-...
Is there a way to get the name of the enclosing subroutine of a piece of perl code?
For example:
sub foo { print where_am_i(); }
will output 'foo'.
...
Here http://stackoverflow.com/questions/3462058/how-do-i-automate-cpan-configuration I've found some answers which led to some questions.
I tried cpan -j config.pm, but as far as I can see it is meant for per installation usage, not for changing the config-file permanently.
With the $CPAN::Config-method the force CPAN::FirstTime to not ...
hi all
I need to edit file , the main issue is to append text between two known lines in the file
for example I need to append the following text
a b c d e f
1 2 3 4 5 6
bla bla
Between the first_line and the second_line
first_line=")"
second_line="NIC Hr_Nic ("
How to do this by perl ?
lidia
...
Hi
I would like rename a variable dynamically, Is there any way to do this in perl.
Thanks
Praveen
...
Am in the preparation for an interview. I guess that there will definitely be around one hour to spend in discussing about a problem which the interviewer will present to me...
So what i would like to do is, prepare for such a thing right now. If i get such
programming problems, i will start to discuss with my friends and get practiced...