perl

Would it be possible to integrate Python or Perl with Ruby?

Would it be possible to integrate Python (and/or Perl) and Ruby? I've looked at http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/ and http://code.google.com/p/ruby-perl/ , but they both seem rather outdated. Has someone generated a Ruby interface for Python's C API? Edit: Python can be integrated with many other languages ac...

What's wrong with this Perl boolean syntax?

I have hack I need to employ under these conditions: -It's the last page of data. -It's not the first page, either. -There's not a page-size-even number of data items. So I tried this code: my $use_hack = $last_page_number == $current_page_number and $page_number != 1 and $total_items % $items_per_page != 0; And I keep gett...

How can I access a method of the consumer class inside a method created at runtime in a method of the parameterized role using Moose with Perl?

I define a method inside a parametrized role that needs to create a new class at run time using Moose::Meta::Class->create and apply that exact parametrized role to it. I am also making a new method for that role using $new_class->meta->add_method( some_name => sub { my ($self) = @_; ... }) inside the sub {...} I want to access a...

How do I make a new Moose class and instantiate an object of that class at runtime?

After creating a metaclass using Moose::Meta::Class->create, how do I instantiate a real Moose class with that class as a metaclass? (I need to create the metaclass also because I also want to apply some roles to it.) ...

How can I store Perl's system function output to a variable?

I have a problem with the system function. I want to store the system functions output to a variable. For example, system("ls"); Here I want all the file names in the current directory to store in a variable. I know that I can do this by redirecting the output into a file and read from that and store that to a variable. But I want a ...

Why doesn't Perl's strictures complain about an undeclared $a?

Why is there no error issued by strict: use strict; $a = $a + 1; ...

awk or perl one-liner to print line if second field is longer than 7 chars.

I have a file of 1000 lines, each line has 2 words, seperated by a space. How can I print each line only if the last word length is greater than 7 chars? Can I use awk RLENGTH? is there an easy way in perl? ...

Why does my Perl program print the help message when an arguments has 0 as a value?

If i do this: GetOptions( 'u=s' => \$in_username, 'r=i' => \$in_readonly, 'b=i' => \$in_backup ); exit usage() unless $in_username && $in_readonly && $in_backup; and call the program like this: ./app.pl -u david -r 12 -b 0 it always results in calling usage(), so obviously the 0 is not seen as an integer value...

XML::Smart Parser in Perl

I'm continuing to work out of an outdated bioinformatics book and I'm attempting to use the XML::Smart Module. I suspect the module's methods have changed over the course of 6 years and I'm inexperienced with perl to troubleshoot from cpan source. The commented out code proves the ncbi.gov query functions, I'm having trouble with the '...

What's the purpose of perl's #line directives?

Line directives (#line) are used to reconfigure perl's idea of the current filename and line number. When is this required to get right filename and line number (in an error message)? ...

Extracting code from photograph of T-shirt via OCR

I recently saw someone with a T-shirt with some Perl code on the back. I took a photograph of it and cropped out the code: Next I tried to extract the code from the image via OCR, so I installed Tesseract OCR and the Python bindings for it, pytesser. Pytesser only works on TIFF images, so I converted the image in Gimp and entered the...

Preparing data for a CDF Plot using Statistics::Descriptive module?

Does anyone know how to prepare data to plot a CDF (I have a bunch of floating point numbers)? I was planning on using gnuplot and on first look, the Statistics::Descriptive module seemed the best fit but looks like I might need some help here. ...

Can Perl DBIx::Class override the way a column is retrieved from the database?

I have never used DBIx::Class until today, so I'm completely new at it. I'm not sure if this is possible or not, but basically I have a table in my SQLite database that has a timestamp column in it. The default value for the timestamp column is "CURRENT_TIMESTAMP". SQLite stores this in the GMT timezone, but my server is in the CDT ti...

SOAP::Lite in Perl

I am new with Perl. I'm following a bioinformatics webapi and I'm attempting to simply display the value stored in $result. My print "$result\n"; command doesn't appear to be functioning. What are some possibilities as to what is going on here? # #!/usr/local/bin/perl use strict; # 1. include SOAP Lite use SOAP::Lite; # 2. specifies...

bash: filter away consecutive lines from text file

I want to delete from many files each instance of a paragraph. I call paragraph a sequence of lines. For example: my first line my second line my third line the fourth 5th and last the problem is that I only want to delete them when they appear as a group. For example, if my first line appears alone I don't want to delete it. ...

Apache won't execute CGIs with Macports Perl5.8.9

I'm trying to get perl running under on my Apache 2 macports install. I'm hoping an experienced perl geek can help me out. I've... Got Apache running just dandy. Macports installed it with perl5 placeholder and perl5.8.9. Installed mod_perl2. Run the script to configure httpd.conf. Restarted apache. Written the following test script in...

Analyzing image complexity

Are there any algorithms available for analyzing the complexity of an image? Basically I'm writing a Perl script that will use the system() function to launch MPlayer in the background to generate 10 to 20 screenshots for the input video file and I'd like it to be able to discard any simple images such as a shot of the sky, or a black ba...

What's the proper way of obtaining an account on CPAN?

Can you please tell me the steps I need to follow in order to obtain an account on CPAN? I'd like to contribute some modules. A while back, I tried to create an account, and I remember I got back a mail containing some of this text: The following links are only valid for PAUSE maintainers: and there were 2 links : Registration form wi...

What is the best way to achieve `sscanf`-like functionality in perl?

What is the best way to achieve sscanf-like functionality in perl? I am looking now looking at the sscanf module, Which is better, Option-1: Going sscanf way? Option-2: Regex way? [I am a beginner when it comes to Regex] ...

How can I interpolate the result of a function in a Perl here doc?

I was wondering if it was possible to call a function inside a perl here doc sub Function { } print<<HERE; Function() HERE ...