perl

Building Perl for OS X - Architecture-Specific Compile Options

Thanks to a suggestion from Chas. Owens, I have been having fun playing with Perlbrew to have various Perl builds in my home directory. My question is more generally on building a newer Perl under OS X however. I have OS X 10.6.4 Snow Leopard running on a very recent MacBook Pro. After a small diversion getting gcc properly setup under...

Dynamically redirect the stdout of a child on Windows

I've noticed a couple other questions about handling this, but all seem to suffer from: Not working on windows requiring the child to finish before retrieving output What I would like to do is call a program (eg. tshark.exe) and process its output while it runs. To date I have tried: Backticks Run3 Proc::Reliable all without any...

How to use threads to replace looping a subroutine in perl/pdl

I have a perfectly good perl subroutine written as part of a perl module. Without going into too many details, it takes a string and a short list as arguments (often taken from terminal) and spits out a value (right now, always a floating point, but this may not always be the case.) Right now, the list portion of my argument takes two v...

what are the disadvantages of using the perl debugger vs a real REPL like Devel::REPL?

Hello, I usually use perl -de 42 for obtaining an interactive perl shell. I have seen Devel::REPL and I have seen some blogs like http://www.xenoterracide.com/2010/07/making-repl-usable.html explaining how you can enhance Devel::REPL with the plugins, but I have not used yet. I am wondering: is it too bad to use the debugger as an in...

Modification to duplicate removal script

Hello, I have a script that we've been using for maintenance to clear up duplicate calendar items on our mail server. What we've found is that although it can remove the duplicate items we need to ALSO remove the originating item. The script is run by dups.pl . --killdups then it will report which are a dup of the original. What I'm ...

Goto Function definition in Eclipse

If my cursor is in a function call in a perl file , is there any shortcut in eclipse that would take me to the definition of the function( in the same file) like gd in vim? ...

Why does MySQL DATE_FORMAT print a blank result?

For the past couple of hours I've been trying to format a MySQL timestamp using DATE_FORMAT and it doesn't do anything! Perl Code: use CGI; use DBI; my $q = new CGI; # Database connection goes here my $sth_select = $dbh->prepare( "SELECT DATE_FORMAT(timestamp, '%m/%d/%y') FROM foo" ); $sth_select->execute() || die "Unable to ex...

How to verify normal termination of R scripts executed from Perl?

I have written a shebang R script and would like to execute it from a Perl script. I currently use system ($my_r_script_path, $r_script_arg1, $r_script_arg2, ...) and my question is how can I verify the R script terminates normally (no errors or warnings). guess I should make my R script return some true value at the end, only if everyt...

Perl Net::SSH::Perl not loading my environment variables vs connecting through SSH

Hey , My problem is connecting throguh Net::SSH::Perl vs Connecting through SSH. my shell variables ( command: export ) aren't the same. This fact prevents me from executing user's script that depends on the shell env vars. For example: if i execute through perl ( Net::SSH::Perl ) the command: "export" I get: MAIL=/var/mail/username...

How to find out where all a closed source application is writing to?

I have an application (the source for which I don't have), which can be invoked from command line like this $ ./notmyapp I want to know all the locations where the application is writing to. It outputs some files in the directory it is being called from, but I need to make sure that those are the only files that are created. So, I ne...

perl: Writing file at Nth position

Hi All, I am trying to write in to file at Nth POSITION. I have tried with below example but it writes at the end. Please help to achieve this. #!/usr/bin/perl open(FILE,"+>>try.txt") or die ("Cant open file try.txt"); $POS=5; seek(FILE,$POS,0); print FILE "CP1"; ...

How do I search for a particular file in a directory using Perl?

I have a file in a directory and i want to pick one particular file from the directory at a time. Code is given below: $xml_file_name = <STDIN>; chomp ($xml_file_name); @o = file_search($xml_file_name); print "file::@o\n"; sub file_search { opendir (DIR, "/home/sait11/Desktop/test/Test cases") or die "Failed to open directory\n";...

How can I install ActivePerl in Windows?

I am new to perl scripting. I have a Perl program I would like to run in Windows XP. I heard that ActivePerl tool is used to run Perl scrips in Windows. I tried to install ActivePerl but the installation failed. Please help me to install and to run some sample application. ...

Remove file extension and path from a string in perl

I want to obtain a file name without its path (if it is part of the string) and also the extension. For example: /path/to/file/fileName.txt # results in "fileName" fileName.txt # results in "fileName" /path/to/file/file.with.periods.txt # results in "file.with.periods" So basically, I want to remove anythin...

What is this regex doing?

/^([a-z]:)?\//i I don't quite understand what the ? in this regex if I had to explain it from what I understood: Match begin "Group1 is a to z and :" outside ? (which I don't get what its doing) \/ which makes it match / and option /i "case insensitive". I realize that this will return 0 or 1 not quiet sure why because of the ? Is t...

groups of groups using self joins in DBIx::Class

I'm trying to understand how to use DBIx::Class. If I want groups of records such that groups can themselves be members of groups, I might create a schema that includes something like this: CREATE TABLE groups ( id INTEGER PRIMARY KEY, name VARCHAR(100) ); CREATE TABLE group_groups ( parent_id I...

How can I include Perl modules with paths relative to the program?

I have a Perl script which uses installed packages. One is a Perl package another one is Perl XS package. Now I want to call this script but use not installed packages, but packages with the same name by path. I used perl -I /home/.../lib script.pl but it doesn't work How can I do it? ...

How to monitor which processes access a particular file in Unix?

I have a file and a lot of process (and process threads) are accessing it. I want to monitor the file to get a listing of what all processes tried to access the file. Being able to record the timestamps also would be excellent for logging purposes, though I can do without it. Is there any Unix utility that does something similar? In c...

QuickBooks SDK, using Perl, works in command console, not as CGI?

I'm using the QBXML method to communicate with QuickBooks on a local machine (not remotely, not using web connector). I have a very basic script which just connects to QuickBooks and checks to see if a Customer exists or not. The script works perfectly when run through the command console (Windows XP) but the same exact script, no chan...

How to get all feature in a range from a GFF3 file in Perl?

I would like to write a Perl function that gets a GFF3 filename and a range (i.e. 100000 .. 2000000). and returns a reference to an array containing all names/accessions of genes found in this range. I guess using bioperl will make sense, but I have very little experience with it. I can write a script that parses a GFF3 by my self, but ...