perl

How to get properties of a directory using perl script?

I want to get the details of a directory as like number of files and subdirectories in it and permissions for those. Yes! it's easy to do it on linux machines using back ticks to execute a command.But is there a way to make the script platform independent. thanks :) ...

REquest weblink to download/install Perl Expect module

Hi, Iam looking for a weblink, where I can download perl packages/modules like expect.pm, Stty.pm for HP itanium machine as well as for AIX flavor unix machine. I tried to google alot, but in vain. Can somebody help me, pointing to the locations, so that i can download/install the same. Thanks in advance, Roopesh Kumar M. ...

Help me understand these perl statements..!

substr($obj_strptime,index($strptime,"sub")+6,0) = <<'ESQ'; shift; # package .... .... ESQ What is this ESQ and what is it doing here. Please help me understand these statements; ...

Perl CGI & JavaScript | Select Option troubles

I'm having a tough time trying to figure out why the following code isn't working: test.cgi: #!/usr/bin/perl -w use CGI; $cgi = new CGI; $cgi->autoEscape(undef); %ptype = ("0","","1","Pennsylvania","2","New York","3","Ohio"); print $cgi->header('text/html'), $cgi->start_html(-title=>'Test',-script=>[{-type=>'javascr...

Why does an element appear twice after transformation?

I'm working with Perl and XSL. I try to change value of <Interval> to some number in an XML file. My XML looks like this: <?xml version="1.0"?> <Config> <Enabled>false</Enabled> <Interval>5</Interval> </Config> My XSL looks like this: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w...

Perl: Waiting for background process to finish.

My problem is that when I run the following it will say that the bash script has finishes successfully. But it doesnt wait for the script to finish, if it quits to early it will move a file that it needs. So what am I doing wrong that it wont wait for the background process to finish to move the files? my $pid = fork(); if($pid == -...

Perl web app and mod_perl architecture question

I've written a website in Perl. It has a root handler, that all HTTP requests are sent to. This root handler then processes the request, and things like cookies, POST and GET vars, etc, then chooses a sub-handler and forwards the request on to that. Because the root handler includes all the sub handlers, and all the sub handlers includ...

Best way to have a perl-base self contained HTTP Server that also manages TCP connections

I am writing a small glue tool for doing some testing and I would like to heavily leverage CPAN. My tool must act as an HTTP server to bridge posted data to other TCP connections and vice-versa. I have started the tool using IO::Event, which has been working very well for me. I would like to integrate it with something like HTTP::Ser...

Perl system call causes core dump but $? remains zero

I've got a Perl script (running on Xubuntu Lucid Lynx within VirtualBox) that wraps around several C/C++ binaries feeding the inputs of one into the others. One of the lines consists of generally: my $ret_code=`cat $input | c_binary`; my $ret_val= $?; For some input files the code causes a coredump, but both $ret_val and $ret_code are...

memory leak in HTML::TreeBuilder

I have some Perl code: use HTML::Parse; use HTML::FormatText; # ... my $txtFormatter = HTML::FormatText->new(); while ( ... ) { # some condition my $txt = # get from a file my $html_tree = HTML::TreeBuilder->new_from_content($txt); $txt = $txtFormatter->format($html_tree); $html_tree->delete(); # write $txt to a...

Cron job to put files on server

Let me start by saying that I know nothing about Cron, so sorry. How can I make a php or perl script get files from my computer and upload them to my web server everyday at midnight? The webserver is linux. The computer from which the files need to be retrieved is Windows. ...

translate Perl regex to .NET

I have some useful regexes in Perl. Is there a simple way to translate them to .NET's dialect of regex? If not, is there a concise reference of differences? ...

Perl DBI fetch portion of database?

I'm working on a database, where the number of rows is somewhere above 1,000,000. I have my select statement, but if I fetchall to begin with, I run out of memory quickly. Here are my 2 questions: Since I dont know the exact size of the database to start, is there any way to find out the size of the database without doing a fetchall?...

LAB Reservation System

Hi, Anyone has idea on LAB Reservation system. I need to setup LAB Reservation system for my LAB so that no two people can reserve the machine simultaneously , and people should see who is using which machine. If there is any open source available please let me know. ...

Perl + SOAP::Lite Question

This is the SOAP document I'm trying to model using SOAP::Lite. <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; <SOAP-ENV:Body> <GetOrderByPartner...

Perl prepare DB2 statement not returning what I need

Hey, Since I am using DB2, in order to select a portion of a database in the middle (like a limit/offset pairing), I need to do a different kind of prepare statement. The example I was given was this: SELECT * FROM (SELECT col1, col2, col3, ROW_NUMBER() OVER () AS RN FROM table) AS cols WHERE RN BETWEEN 1 AND 10000; Which I adapted ...

Perl modules: MySQL vs DBI

A lot of our automated processes use perl and need to access our MySQL DBs. I hate to admit it, but up until recently we haven't really done much benchmarking with the majority of our processes. One of our devs setup a test to compare the performance of "use MySQL" vs "use DBI" with the following pseudocode: for ($i = 1; $i <= 1000; $...

perl help finding proper date format

I need some help trying to figure out how to format dates in perl. I have a working perl script, with a regular expression, that works fine if I use hard coded date strings like this: my $mon = 'Aug'; my $day = '05'; my $year = '2010'; These vars are used in a regular expression like this: if ($line =~ m/(.* $mon $day) \d{2}:\d{2}:\d...

What are the advantages of Digest::SHA over Digest::SHA1?

Are there any advantages in using Digest::SHA over Digest::SHA1 or vice versa? both seem to be maintained but I don't see a reason for Digest::SHA1 to even exist with the existence of Digest::SHA. ...

convert digest to base10

Is it possible to take a digest created like my $digest = Digest::SHA->new('sha1')->add('hello')->digest; and then convert $digest to base10 (instead of hex or base64?) or could you split a hexdigest into 5 pieces and then convert those into integers? would that work? Trying to come up with a way to store the digest as integers (yes ...