perl

How does a Perl program know where to find the file containing Perl module it uses?

If my Perl program uses Perl modules, how will it determine where to find the file containing the module code? For example, if the program contains: use MyModule1; # Example 1 use This::Here::MyModule2; # Example 2 where will it look? ...

How is Perl's @INC constructed? (aka What are all the ways of affecting where Perl modules are searched for?)

What are all the ways of affecting where Perl modules are searched for? or, How is Perl's @INC constructed? As we know, Perl uses @INC array containing directory names to determine where to search for Perl module files. There does not seem to be a comprehensive "@INC" FAQ-type post on StackOverflow, so this question is intended as on...

Why is Perl used so extensively in Biology research?

I work as support staff in a Biology research institute as a student, and Perl seems to be used everywhere. Not for every single project, but it seems that more than half the people here have a few Perl books in/on their office/desk. Why is Perl used so much in Biology? ...

Does Perl's Net::Cassandra module support UTF-8?

I've run into a really strange UTF-8 problem with Net::Cassandra::Easy (which is built upon Net::Cassandra): UTF-8 strings written to Cassandra are garbled upon retrieval. The following code shows the problem: use strict; use utf8; use warnings; use Net::Cassandra::Easy; binmode(STDOUT, ":utf8"); my $key = "some_key"; my $column = "s...

Standardizing a Release/Tools group on a specific language

I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator). Most of the time, our team just writes little plugins for larger app...

How can I pass a hash to a Perl subroutine?

In one of my main( or primary) routines,I have two or more hashes. I want the subroutine foo() to recieve these possibly-multiple hashes as distinct hashes. Right now I have no preference if they go by value, or as references. I am struggling with this for the last many hours and would appreciate help, so that I dont have to leave perl ...

In a digital photo, how can I detect if a mountain is obscured by clouds?

The problem I have a collection of digital photos of a mountain in Japan. However the mountain is often obscured by clouds or fog. What techniques can I use to detect that the mountain is visible in the image? I am currently using Perl with the Imager module, but open to alternatives. All the images are taken from the exact same posit...

Perl & PHP project requirement

Hi all, I have learned Perl and PHP.So I want to do simple real time project in this by that I can improve my knowledge in Perl and PHP. Can anyone suggest me any requirements. Thanks in Advance ...

How can I read messages in a Gmail account from Perl?

I have used the module Mail::Webmail::Gmail to read the new messages in my Gmail account. I have written the following code for this purpose: use strict; use warnings; use Data::Dumper; use Mail::Webmail::Gmail; my $gmail = Mail::Webmail::Gmail->new( username => 'username', password => 'password', ); my $messages = $gmail->get_...

How do I set the taint mode in a perl script with a '#!/usr/bin/env perl'- shebang?

Hello, how do I set the taint mode in a perl script with a #!/usr/bin/env perl shebang? ...

Why does a positive lookahead lead to captures in my Perl regex?

Hi everyone, I can't get why this code work: $seq = 'GAGAGAGA'; my $regexp = '(?=((G[UCGA][GA]A)|(U[GA]CG)|(CUUG)))'; # zero width match while ($seq =~ /$regexp/g){ # globally my $pos = pos($seq) + 1; # position of a zero width matching print "$1 position $pos\n"; } I know this is a zero width match and it dosn't put the ma...

psapi.dll proccess status api

Could someone provide c++ tutorials/reference/books about PSAPI ? also Did someone know if there are a wrapper to this library on perl? ...

WWW::Mechanize Perl login only works after relaunch

Hello, I'm trying to login automatically in a website using Perl with WWW::Mechanize. What I do is: $bot = WWW::Mechanize->new(); $bot->cookie_jar( HTTP::Cookies->new( file => "cookies.txt", autosave => 1, ignore_discard => 1, ) ); $response = $bot->get( 'http://blah...

What is the preferred method of accessing WWW::Mechanize responses?

Hello! Are both of these versions OK or is one of them to prefer? #!/usr/bin/env perl use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $content; # 1 $mech->get( 'http://www.kernel.org' ); $content = $mech->content; print $content; # 2 my $res = $mech->get( 'http://www.kernel.org' ); $content = $res->...

Which Perl module would you recommend for sending and getting e-mail?

Hello! I am searching a Perl module to write (SMTP) and read (IMAP) e-mails. Which module out of the bunch would you suggest? ...

Are there any medium-sized web applications built with CGI::Application that are open-sourced?

I learn best by taking apart something that already does something and figuring out why decisions were made in which manner. Recently I've started working with Perl's CGI::Application framework, but found i don't really get along well with the documentation (too little information on how to best structure an application with it). There ...

Differences between Perl and PHP

I'm planning to lern Perl 5 and as I have only used PHP until now, I wanted to know a bit about how the languages differ from each other. As PHP started out as a set of "Perl hacks" it has obviously cloned some of Perls features. What are the main differences in the syntax? Is it true that with Perl you have more options and ways to e...

Why does Perl's shift complain 'Type of arg 1 to shift must be array (not grep iterator).'?

I've got a data structure that is a hash that contains an array of hashes. I'd like to reach in there and pull out the first hash that matches a value I'm looking for. I tried this: my $result = shift grep {$_->{name} eq 'foo'} @{$hash_ref->{list}}; But that gives me this error: Type of arg 1 to shift must be array (not grep itera...

What is WordPress doing for content encoding in its MySQL database?

For some convoluted reasons best left behind us, I require direct access the contents of a WordPress database. I'm using MySQL 5.0.70-r1 on Gentoo with WordPress 2.6, and Perl 5.8.8 ftr. So, sometimes we get high-order characters in the blog, we have quite a few authors contributing too, for the most part these characters end up in Wor...

Why do I have to send multiple messages to my Jabber bot before it will logout?

I am trying to make my own Jabber bot but i have run into a little trouble. I have gotten my bot to respond to messages, however, if I try to change the bot's presence then it seems as though all of the messages you send to the bot get delayed. What I mean is when I run the script I change the presence so I can see that it is online....