perl

How to redirect SVN stderrs to /dev/null using perl

I have a script to check if any data is available on svn repo path but not added into svn. It works fine for me but this gives stderr for adding and sending files like below; Adding 1/a Sending 1/a Transmitting file data ........... Committed revision 529. Code: use strict; use warnings; sub notAdded { my @svn...

Is 'shift' evil for processing Perl subroutine parameters?

I'm frequently using shift to unpack function parameters: sub my_sub { my $self = shift; my $params = shift; .... } However, many on my colleagues are preaching that shift is actually evil. Could you explain why I should prefer sub my_sub { my ($self, $params) = @_; .... } to shift? ...

Internet Explorer COM automation: Converting numeric error code to string

I am writing some code for driving Internet Explorer from a Perl 5 program through Win32::OLE, and I am looking for ways to convert numeric status/error codes that are delivered back to the Perl program via events (such as NavigateError) into a somewhat more human-readable form. Is there some kind of library function that converts i.e....

How do I use XML::LibXML to parse XML using SAX?

The only example code I have found so far is so old it won't work anymore (uses deprecated classes). All I need is something basic that demonstrates: Loading and parsing the XML from a file Defining the SAX event handler(s) Reading the attributes or text values of the element passed to the event handler ...

A couple of Perl subtleties

I've been programming in Perl for a while, but I never have understood a couple of subtleties about Perl: The use and the setting/unsetting of the $_ variable confuses me. For instance, why does # ... shift @queue; ($item1, @rest) = split /,/; work, but (at least for me) # ... shift @queue; /some_pattern.*/ or die(); does not see...

How can I check the status of the first program in pipeline in Perl's system()?

perl -e 'system ("crontab1 -l");print $?' returns -1 as expected (program crontab1 doesn't exist) perl -e 'system ("crontab1 -l|grep blah");print $?' returns 256. What is the way to check the status of the first (or both) programs? ...

XCode Post Build Copy File Actions

Hello, In XCode, how can I call a 'shell script' which is a PERL script that copies the .app and .dsym files to a different directory? I want to pass the name of the project and/or the project's root directory to the script. I want to have the script called every time I build in release and distribution modes but not in debug mode. Tha...

Which book has the best discussion of DBIx::Class?

I don't know if the DBIx::Class ORM is substantial enough to justify an entire book on the subject but I'd like to get a recommendation for a book that goes into the details of the DBIx::Class ORM. ...

Are there good references for moving from Perl to Powershell?

I hate to say it, but powershell is really annoying me. I just cannot seem to get my mind around it. I have an O'Reilly book on the topic, and I can see how to do some extremely powerful stuff -- it's the easy stuff I can't seem to get right. Case in point: Iterate across a list of filenames. In CMD: for /F %x in ('dir EXPRESSION') d...

Duplicates in a QIF File?

Does anyone have a good way of deleting duplicate transactions (same date, amount, biller, etc) in a QIF file? I looked at PERL's Finance:QIF, but it appear to have delete a record function. Alternatively, does someone have a good QIF --> CSV converter? Although I am looking at a PERL solution, I am open to other ideas. Thanks in...

Why do I see a delay when I call a Perl program with system()?

Scenario 1: I have one wrapper Perl script which uses another Perl module and invokes a function in that module. Scenario 2: Now I have the same wrapper script and the module is implemented as Perl script. Here, instead of using module I am simply calling system("perl anotherscript.pl"). Both do the same function, but I am seeing a l...

How can I handle nested looping without a chain a foreachs in Perl?

Hi, I am new to Perl. I am writting a Perl script to download the same type of data from different sites. I have written the below code: #! /usr/bin/perl use strict; use warnings; my @sites = ('a', 'b', 'c'); my @servers = ('A', 'B'); my @data_type = ("X", "Y", "Z"); foreach my $site (@sites) { foreach my $server_type (@serv...

How to change ctime to normal string representation?

Using File::stat we can get the ctime of a given file. My question is how to change the ctime, which means the inode change time in seconds since the epoch, to a normal time representation like "2009-08-26 17:28:28". Is there any build-in or module can solve this task? ...

How do I prevent my application from being terminated when XMLin croaks?

In my application, I use XML::Simple and use the exported XMLin() to parse XML files. Everything goes well until an invalid file path is used as the parameter for XMLin(). The application is terminated because XML::Simple used die() or some similar method when it was given an invalid file path. I want my app to continue running even th...

Name of applications running on port in Perl or Java

Xampp comes with a neat executable called xampp-portcheck.exe. This responds with if the ports required are free, and if not, which applications are running on those ports. I can check if something is running on a port, by accessing the netstat details, but how do I find out the application running on the port within Windows? ...

How can I access CGI parameters without using CGI.pm?

How can I access GET/POST arguments in a Perl script without using CGI.pm's param() method? I'd rather not parse $ENV{'QUERY_STRING'}, if possible. ...

GUI wrapper for Perl command line app on OSX

I wrote a Perl application which I run on the terminal using command lines. I created aliases for the various command options in the shell to reduce the typing. Even so, having a GUI to to select the various commands and other arguments would make it easier to run the app. What's a good approach to developing the GUI wrapper on OSX?...

How can I create a transaction in Perl's Finance::QIF?

I am trying to create a transaction in a QIF file in Perl. I thought that using Finance::QIF would let me create a simple transaction (example: spending $20 at Best Buy), but I'm not seeing a way to do this. Does someone have an example or is there a difference module that I should be using to create a transaction? Thanks! --Noah ...

What's the best way to turn CPAN modules into Debian packages?

Whenever I work on a system of any flavor that has a particular way of handling package management, I try to stick with that standard for managing my Perl modules. "When in Rome, etc." For example, on a Win32 system using ActivePerl, I use PPM for everything and use the great PPM::Make. On a RedHat system I prefer to use RPMs. Now I ...

How can I parse runmqsc command output using Perl?

I am trying devise Perl regex to parse command output from IBM's runmqsc utility. Each line of output of interest contains one or more attribute/value pairs with format: "ATTRIBUTE(VALUE)". The value for an attribute can be empty, or can contain parenthesis itself. Typically, a maximum of two attribute/value pairs appear on a given li...