perl

Get the hard disk information using Perl

Hi all I want to use the perl to check the hard disk space on Windows, is there any way to do it? Best Regards, ...

Why are my shared variables getting cleared out between PerlChildInitHandler and PerlResponseHandler in mod_perl?

I am trying to load a configuration file into a hash during my PerlChildInitHandler and then access the values from PerlResponseHandler. However, even though the process number is the same, it seems that variables changed during the child_init() call revert back to their default values when handler() gets called. The basic scenario is: ...

How do I change the screen output from ffmpeg.exe in Perl?

I want to let the screen only show the output of the continually updating time information while system calling ffmpeg.exe. I've come up with the following script: use Capture::Tiny qw/capture/; use threads; use threads::shared; my $stderr :shared; my $thread1 = threads->create(\&ffmpeg); my $threads = threads->create(\&time_info,$th...

How to tokenize Perl source code?

I have some reasonable (not obfuscated) Perl source files, and I need a tokenizer, which will split it to tokens, and return the token type of each of them, e.g. for the script print "Hello, World!\n"; it would return something like this: keyword 5 bytes whitespace 1 byte double-quoted-string 17 bytes semicolon 1 byte whitespace 1 b...

Pattern matches an hyphen too

I have a piece of Perl code (pattern matching) like this, $var = "<AT>this is an at command</AT>"; if ($var =~ /<AT>([\s\w]*)<\/AT>/i) { print "Matched in AT command\n"; print "$var\n\n"; } It works fine, if the content inbetween tags are without an Hyphen. It is not working if a hyphen is inserted between the string present...

"name used only once" warning while using List::Util::reduce

Possible Duplicate: How do I prevent List::MoreUtils from warning about using $a and $b only once? I get a warning like this: Name "main::a" used only once: possible typo at analysis.pl line 15. on this line return join("_", @monsters) if @monsters && List::Util::reduce { $a && $b // 0 > 0 } 1,@monsters; I understand tha...

How can I find and increment a number in a larger Perl string?

I have strings similar to this INSERT INTO `log_action` VALUES (1,'a',1,4),(2,'a',1,1),(3,'a',4,4),(4,'a',1,1),(5,'a',6,4); where I would like to add a number each of the first values, so it becomes (when value is 10) INSERT INTO `log_action` VALUES (11,'a',1,4),(12,'a',1,1),(13,'a',4,4),(14,'a',1,1),(15,'a',6,4); I have tried this...

Prevent execution on a Perl-like template tag

I'm using a third-party ecommerce search provider, but we're hosting the template files so we can modify them as needed. Our website is running off of Perl, which is having trouble handling this template tag: [--NEW_ROW--] How would I go about escaping or commenting that line out, so the third-party tool could still process it, but P...

How to write data in specified format into a binary file with Perl?

Hi all, this might be quite a newbie question, but i need to process a certain text file and dump its content into a binary file and i do not know how - i decided to use perl, but my perl skills are quite low. I probably should have written this in C++, but this seem like a nice and easy task for perl, so why not learn something new? ;)...

Perl uri_escape_utf8 inconsistent behaviour (or programmer error!)

Hi Folks, I'm trying to implement some URI encoding of filenames in my urls, but am experiencing some strange problems with uri_escape and uri_escape_utf8, where it appears to be behaving inconsistently. Using the perl command line: richard@magic-box:$ perl use URI::Escape; print uri_escape_utf8("\"quotes\"_in_a_filename.pdf"); %22quo...

How to do chomp the array?

How to do chomp the array ? @array ( " adfasdas ", "asdas " , "23232 ", "ads as" ; chomp (@array); With out using foreach loop ...

Asterisk AGI (Perl script) - Sometimes all keys are ignored by the script

I am new to Asterisk (VoIP) and am rather new to UNIX/Perl. I'm taking this over from a co-worker that left the company, so I didn't set this up in the first place, I just need to make some changes. I'm having a problem where I use get_data() to get the user's keypad entry, but the keys are just ignored and the get_data() function just ...

Is there a javascript (jquery) library for updating html form controls from cgi parameters?

Our site has some very complicated form controls that are submitted and then show up again on the results page in case users want to resubmit the form from the results page. Currently, this requires a lot of if-then statements to preset the form controls to what was submitted. I'm wondering if there is a library (preferably jquery) t...

How can I make a module that imports many modules for the user?

I have a rather complex data structure I've implemented in Perl. This has been broken up into about 20 classes. Basically, any time you want to use one of these classes, you need to use all of them. Right now, if someone wants to use this data structure, they need to do something like: use Component::Root; use Component::Foo; use Com...

perl- help formatting a timestamp

I am reading in log data with the following time stamp format: Sat Aug 07 04:42:21 2010 I want to convert it to something like this: 20100807044221 What is the best way to do this in perl? Thanks. ...

How do I get the current user in Perl in a portable way?

How does one get the current user in a portable way? This seems like an FAQ but perlport doesn't speak about it, maybe because some odd systems don't have the concept of "user" to being with? However, let's stick to *nix and Windows. getpwuid($>) is not implemented on Windows. $ENV{USER} || $ENV{USERNAME} seems finicky. http://search....

Icon Image Proxy in Perl

I'm trying to figure out the right way to serve icon files for our site listings. Basically an icon for a listing can come from an image file from a handful of different services (Flickr, Picasa, Google Static Maps, our own internal image hosting service, etc). The URL of the icon is stored in our database so I'd like to enable each list...

can you use libraries in PL/Perl

I'm just curious if when writing PL/Perl functions if I can have a use My::Lib; statement, or enable pragma's and features (e.g. 'use strict; use feature 'switch';). ...

How to get the average CPU/Processor Usage of a computer?

Right now I'm working on a program with PHP and Perl to read the computer's system data and we have been using SNMP to collect data (or rather, forced to). After retrieving the data, we were supposed to store the data in a database and then use the data to plot out a line graph. At the moment, I'm using this perl script to retrieve the ...

What language cPanel/WHM panel server is done ?

I am planning to make an application like cPanel/WHM in perl since i never worked out my own server in perl, and i was thinking of a few points that i wanted some advices/help: cpanel and whm work on ports 2082/3 and 2086/7 to server their panel i was wondering in what language is their server done or if there is a nice module for perl...