perl

Moose or Meta?

I've been trying to do this a number of ways, but none of them seem graceful enough. (I'm also wondering if CPAN or Moose already has this. The dozens of searches I've done over time have shown nothing that quite matches.) I want to create a type of class that is a Base + Facade + Factory for other classes which load themselves as d...

How can I login to an FTP site and remove files that are more than 7 days old?

I need a shell or Perl script which would connect to the FTP server and delete all the files which are more than 7 days old. cheers ...

How can I tar files larger than physical memory using Perl's Archive::Tar?

I'm using Perl's Archive::Tar module. Problem with it is it pulls everything on to the memory and the does archiving and then writes on to the file system so there is limitation on the maximum file size that can be archived. Most of the times it says out of memory. In case of GNU tar, it takes chunk of file, archives it and writes it on ...

PHP: PEAR: Encrypting with Crypt_CBC, Decrypting with Perl's CBC

Hi, One of the tasks I have to do needs me to encrypt something from PHP's side, and then decrypt it with Perl. The PEAR module I've found which appeared to be suitable for my needs was Crypt_CBC. However, there must be something I'm doing wrong or do not understand, as I've been unable to achieve getting the correct results so far. ...

How do I unalias from Perl's STDOUT?

When I run this: open FP, ">xyz"; my $file = *FP; printf $file "first\n"; $file = *STDOUT; printf $file "second\n"; open $file, ">abc"; print $file "third\n"; print STDOUT "fourth\n"; print FP "fifth\n"; The "fourth" print does not go to STDOUT, rather to "abc". STDOUT is different from FP which behaves as expected. What am ...

How do manage your Perl application development, build, and deployment?

I have yet to come up with a satisfactory way to manage the development, build, and deployment of my Perl applications. I'd like to hear how you have solved this problem and/or what you would like to have in an application build system that you don't have now. Please describe your application type (is it a web app, does it run on a se...

Is there a better way to determine elapsed time in Perl?

my $start_time = [Time::HiRes::gettimeofday()]; my $diff = Time::HiRes::tv_interval($start_time); print "\n\n$diff\n"; ...

How do I retrieve tag attributes with XML::Simple?

I am simply trying to retrieve an attribute from XML into my Perl program. However, I am having problems retrieving attributes. I am using XML::Simple. I can recover information fine when XML is like this: <IdList> <Id>17175540</Id> </IdList> by using this code $data->{'DocSum'}->{'Id'}; However, when the XML is like this: <I...

What's the best document search engine to integrate into Perl code?

What is the best document search engine (perhaps Plucene?) to integrate into Perl code that allows customizing and tuning the search algorithm? ...

Perl, LibXML and Schemas

I have an example Perl script which I am trying to load and validate a file against a schema, them interrogate various nodes. #!/usr/bin/env perl use strict; use warnings; use XML::LibXML; my $filename = 'source.xml'; my $xml_schema = XML::LibXML::Schema->new(location=>'library.xsd'); my $parser = XML::LibXML->new (); my $doc = $parse...

How can I integrate Perl and Abyss Web Server?

I don't know Perl. I don't even love it, but i'm obliged to use a script that is coded in Perl. I have Abyss websever on my PC (I use it both for .net and PHP), I want to know if I can simply download the needed files and link them to the current server; if no can some one link me to a simple Perl server that works. Thanks ...

Why do I get a blank line while substituting a string with '%>' in Perl?

This is the input text: <title>Company Selection</title> <link rel="stylesheet" type="text/css" href="../css/style_hbpSA_css.jsp" /> and I want to substitute the CSS reference with two lines: <%@ include file="../common/cmufx.jsp" %> <link rel="stylesheet" type="text/css" href="<%=basePath%>/<fmt:message key="application.version"/>/c...

How do I choose a package name for a custom Perl module that does not collide with builtin or CPAN packages names?

I have read the perldoc on modules, but I don't see a recommendation on naming a package so it won't collide with builtin or CPAN module/package names. In the past, to develop a local Session.pm module, I have created a local directory using my company's name, such as: package Company::Session; ... and Session.pm would be found in di...

Why does loading my Perl module in mod_perl causes Apache to hang?

I have have a mod_perl program that implements its own handler function (i.e. it's not using Apache::Registry). I have a parser module written using Parse::RecDescent. I have been successfully using the parser module in another similar mod_perl program for months with no issue. Simply "use"ing the parser module in the my new mod_per...

How can I download Yahoo Groups?

I want to download some Yahoo Groups (files, photos, messages, memberlist) and I've found these scripts: http://freshmeat.net/projects/grabyahoogroup/ http://sourceforge.net/project/showfiles.php?group_id=62034 I've downloaded ActivePerl and the needed modules from CPAN (nothing fancy; they're very easy to find). I've managed to ins...

How does elsif work in Perl?

I am new to Perl. Does anyone know why Perl has 'elsif' and not 'elseif'? I am doing something like this: $somevariable = 0; if ($idcount==5) { //do something if (somestatement is true) // 1 { $somevariable = 1; } } elsif ($idcount > 1 && somevariable = 0) { //do something else here } The code never comes to ...

How do you tokenise / tokenize / split a delimited string in Perl?

How do you split a string e.g. "a:b:c:d" into tokens for parsing in Perl? (e.g. using split?) Looking for clear, straightforward answer above all (but do add any interesting tidbits of info afterwards). ...

How can I use XML::Simple with XML tags that might have one or more sub-elements?

I asked a question yesterday http://stackoverflow.com/questions/657058/perl-xml-simple-retrieveing-attribute link I am using to get the XML: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&amp;id=19273512 (1) http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&amp;id=19291509 (2) I made very good...

Why doesn't my Perl one-liner work on Windows?

I don't have a lot of experience will Perl, but I believe what I am doing should be working. First, from the Windows command prompt I generate a text file of all the files in a directory: dir c:\logfiles /B > config.txt Output: 0001_832ec657.log 0002_a7c8eafc.log I need to feed the "config.txt" file to another executable, but befo...

How can I eval environment variables in Perl?

I would like to evaluate an environment variable and set the result to a variable: $x=eval($ENV{EDITOR}); print $x; outputs: /bin/vi works fine. If I set an environment variable QUOTE to \' and try the same thing: $x=eval($ENV{QUOTE}); print $x; outputs: (nothing) $@ set to: "Can't find a string terminator anywhere before ......