perl

How can I configure Apache to run Perl CGI scripts?

I want to configure Apache web server to run CGI scripts on Mac OS x 10.5. I have already started Apache Web Server on Mac. What are the steps to make the Apache run the Perl scripts? ...

Can Perl be "statically" parsed?

An article called "Perl cannot be parsed, a formal proof" is doing the rounds. So, does Perl decide the meaning of its parsed code at "run-time" or "compile-time"? In some discussions I've read, I get the impression the arguments stem from imprecise terminology, so please try to define your technical terms in your answer. I have deliber...

How can I render only a specific `BLOCK` in a Perl's Template Toolkit?

How can I render only a specific BLOCK in a template? Suppose I have this BLOCK in text.tt, a Template Toolkit file: [% BLOCK someblock %] some block test blah blah blah [% END %] I want to be able to use process() to handle just that portion: $tt->process("text.tt/someblock", {...}, {...}); Is this the right way to handle this? ...

How do I implement dispatch tables in Perl?

I need to write a storage related app in Perl. The app needs to upload files from the local machine to some other storage nodes. Currently, the uploading method is FTP, but in the future it may be bittorrent or some unknown super-file-transferring method. For every file that needs to be uploaded, there is a configuration file which de...

How can I prevent an error in my Perl script from terminating the script?

I have a simple Perl script which runs as a Linux daemon using an infinite loop. It connects to a database every 10 seconds to execute a process. while (1) { # THIS LINE WILL KILL THE SCRIPT IF IT FAILS my $DB=DBI->connect("dbi:Sybase:server=myserver","user","password"); . . . do something . . . sleep (10); } I have tw...

How can a Perl regex re-use part of the previous match for the next match?

I need some Perl regular expression help. The following snippet of code: use strict; use warnings; my $str = "In this example, A plus B equals C, D plus E plus F equals G and H plus I plus J plus K equals L"; my $word = "plus"; my @results = (); 1 while $str =~ s/(.{2}\b$word\b.{2})/push(@results,"$1\n")/e; print @results; Produc...

How can I tell Module::Build not to add the lib/perl5 subdirectories to the installation path?

I am trying to setup a directory that contains Perl modules that should be set aside to not interfere with a production system. This works OK, with modules that use Module::Install. I just specify a "lib" option and all is well. Now I tried and tried and I simply cannot make this happen with Module::Build. For instance, this command: ...

How can my application use CPAN modules without the user installing them himself?

I need to use some CPAN modules in my application. If the person who will use my application doesn't like to install the required CPAN modules by himself, or it is not allowed to install modules, how should I handle that? ...

Why doesn't my program write to the file while using Proc::Daemon?

Hi guys, I write some testing code before using Proc::Daemon, what my testing code is like: #! /usr/bin/perl use strict; use warnings; use Proc::Daemon; Proc::Daemon::Init(); my $continue = 1; $SIG{TERM} = sub { $continue = 0 ; } while ( $continue ) { sleep(5) ; &greeting ; } sub greeting { open ( FH, ">>/home/daogu/foo...

Trying to create a standalone app from a Perl script that uses tkx (Tcl/tk)

Here are my specs: OS X Tiger Perl 5.8 Using Tkx bundled with ActiveTcl v8.5 I've successfully created a standalone app with the above configuration using PAR/pp, but it's not a completely satisfactory solution: still requires Tcl/Tk to be installed opens up in a Tcl/Tk window with a default menu opens Terminal every time I run the ap...

How can I accept gzip-compressed content using LWP::UserAgent?

I am fetching some pages over the Web using Perl's LWP::UserAgent and would like to be as polite as possible. By default, LWP::UserAgent does not seamlessly handle compressed content via gzip. Is there an easy way to make it do so, to save everyone some bandwidth? ...

Calling outside modules in Template Toolkit without Plugins?

I am trying to call an outside Perl module in a Template Toolkit .tt file. The module I want to use is Util, and I want to call Util::prettify_date. I was able to include this module using Template Toolkit's plugin interface: I set up the load, new, and error function (as described here: http://template-toolkit.org/docs/modules/Template/...

Perl on Windows, file associations and I/O redirection

Can someone explain the difference between calling a perl script via file association versus calling the same script explicitly via perl.exe? Apparently I/O redirection doesn't work very well when the script is called via file association, and I would really like to know why. E.g. take a look at the Activestate FAQ for Perl on Window...

How do I set font colour with the PDF::API2 Perl module?

I need to add colour to some text in a PDF document using PDF::API2 - how do I do that? ...

Perl Multithreaded GTK+ applet

I'd like to write a Perl GTK+ application which will: 0.1) Press button A 0.2) Disable A 0.3) start threads 1 and 2 0.4) start thread 3 Thread 3 does the following: 3.1) join thread 1 3.2) join thread 2 3.3) Enable A On completion of thread 3, the button A should be enabled again. Now, this kind of approach is perf...

Best way to run external app only if it exists

I've got a Perl script that as one of its final steps creates a compressed version of a file it has created. Due to some unfortunate setups, we cannot guarantee that a given customer will have a specific compression function. I want to put something like this together: if ($has_jar) { system("jar -c $compressed_file $infile"); } e...

Is there a database access library for C and/or C++ with a similar interface to Perl's DBI?

I'm willing to write a subset of Perl's DBI interface for libodbc (or unixODBC) in C++. I believe doing so will allow me concentrate better on my goal. BTW, I prefer avoiding to reinvent the wheel, if of course something similar is already out there. ...

How should I install more than one version of Perl?

I want to install, from source, Perl versions 5.005, v5.6, v5.8, v5.10 Right now I have 'v5.10.0' installed. /opt/perl/bin /opt/perl/html /opt/perl/lib /opt/perl/man /opt/perl/lib/5.10.0 /opt/perl/lib/site_perl /opt/perl/lib/site_perl/5.10.0 Will I have any problems if I install them all in /opt/perl? Or should I split them up in...

Why doesn't Perl's Net::FTP upload my file?

I am trying to upload multiple files via Net::FTP and Perl. Has anyone done this as even my basic script below fails? use Net::FTP; use File::Basename; my $ftp; my $host ='56.309.24.2'; my $user ='user'; my $pw ='pass'; my $file ='097360718843.jpeg'; my $path ='public_html/uploaded/product_images'; chomp($host,$user,$pw,$path, $fil...

How can I check the digital signature of an .exe or .dll in Perl?

I'm trying to find a way to script (preferably in Perl) - a check to see if an .exe or .dll is digitally signed - if anyone has an easy direction to point me, I'd appreciate it. ...