perl

Why am I getting the same MD5 checksum for seemingly different inputs using Perl's Digest::MD5?

On my Linux platform with 64bits recompiled perl and SSHing Mac terminal (I guess UTF-8). I am giving all this information just in case it might be relevant. # perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@vi\n") ."\n");' 756e98065cb8cbf603a3dbef2afe9261 # perl -e 'use Digest::MD5 qw/md5_hex/; print(md5_hex("alex@visi\n") ....

What does this Perl code do?

Please explain the Perl code below: sub new { my $class = shift; my $self = {property => 'u', provider => 'ramesh'}; bless $self, $class; return $self; } ...

What PHP/Shell Framwork can be used to access HTTP-POST/-GET Forms (besides curl)?

Hello, (Hallo!) I'm searching an abstraction layer from pure HTTP-POST/-GET using curl. It should somehow make it easy to define the Targeted script and it's variables. I read something exists in the FreeX (german unix/programming magazine), but don't have the named magazine at hand. What can I do? Stick with curl? What alternatives...

Removing CRLF (0D 0A) from string in Perl

Hi All, I've got a Perl script which consumes an XML file on Linux and occasionally there are CRLF (Hex 0D0A, Dos new lines) in some of the node values which. The system which produces the XML file writes it all as a single line, and it looks as if it occasionally decides that this is too long and writes a CRLF into one of the data e...

In Moose subroutines, how does $meta get into @_ ?

chromatic's recent blog got me curious about the Moose subroutine has. I was looking at the Moose source code and noticed that inside the has subroutine, there is a $meta variable unpacked from @_. Where does $meta come from? I've started wading through the various Moose and Class::MOP modules. In many subroutines, it seems that $meta is...

Perl pipe and C process as child [Windows ]

I want to fork a child ( which is my C executable ) and share a pipe between perl and C process, Is it possible to have STDOUT and STDIN to use as pipe. Tried with following code but child process keep continue running. use IPC::Open2; use Symbol; my $CHILDPROCESS= "chile.exe"; $WRITER = gensym(); $READER = gensym(); my $pid = open2($...

A little help with perl HTML parsing

I am working on a small perl program that will open a site and search for the words Hail Reports and give me back the information. I am very new to perl so some of this might be simple to fix. First my code says I am using an unitialized value. Here is what I have #!/usr/bin/perl -w use LWP::Simple; my $html = get("http://www.spc.noaa....

What are your tricks for speeding up CPAN on limited resource devices?

I was recently trying to upgrade a few Perl modules on my cell phone (nokia n900), and installing the latest copy of Module::Build took the better part of an hour. Most of the time (70% ish) seemed to be spent parsing and indexing the repository information. It seems there are a few options, such as not rebuilding the index cache each...

Simple: How do doubles work in Perl?

I am very confused about how decimal numbers work in perl. I'm having trouble multiplying an int with a double. Here's what I have: sub timeEstimate(){ $number = shift; print "Number: $number\n"; $stuff = sprintf("%d", $number * $number * $number) * .2045; print "stuff: $stuff\n"; $totalDownloads = $stuff + ($number * $number) + $number...

Scheduling a perl script

I have a perl .exe file that I was to run every ten minutes. I have set up the windows scheduler to run it and it says that it is successful but there is no output in the file. When I click the .exe myself it writes information to an output file. When the scheduler supposedly has ran it there is nothing in the file. Is there a code I can...

Perl CGI script returns different results depending on run

Hi, I have a Perl CGI script that emits different HTML apparently randomly. None of the inputs change. E.g., I will run wget twice and get two different results. The CGI is backed by a development database that, too, doesn't change. I have a debug statement that informs me that the same number of elements are returned from the DB into...

UTF-8 encoding on filehandle in Perl

I'm applying UTF-8 encoding to STDIN and STDOUT. However how do I make sure that I apply UTF-8 encoding to the file that I pass to my code below (<> will read from a file instead of STDIN if a text file is passed on the command line) in as few lines as possible. use open qw(:std :utf8) while (<>) { print; } ...

Splitting YYYYMMDD date into 3 parts in Perl

How do I split a date that is of the form YYYYMMDD into its constituents? my ($yyyy, $mm, $dd) = $date =~ /(\4d+)(\2d+)(\2d+)/; ...

Converting checkbox to select (perl)

Before: <input type='checkbox' name='killerFeature' id='killerFeature' <%= param('killerFeature') ? ' checked' : ''%> /> Now: <select name="killerFeature" id="killerFeature" class="select"> <option value="1">Enable</option> <option value="0">Disable</option> </select> How do I insert the same checked (should be 'selec...

Difference between '%p' and 'my %p' ?

% %p = ('option1' => 'Option 1', % 'option2' => 'Option 2', % 'option3' => 'Option 3' % ); <select name="killer_feature" id="killer_feature" class="select"> % foreach (keys %p) { % my $selected = param('killer_feature') && param('killer_feature') eq $_ ? 'selected="selected"' : ''; % if (!param('killer_feature') && $_ eq 'option2')...

Closed source projects and scripting languages

Hello, I've considered making a closed source project, but if I made it then I'd want to make it in Ruby. Ruby is interpreted though. Other similar languages to Ruby include Python and Perl. How would you best distribute your code without giving away all the logic(at least easily readable)? And what about meta programming? Do obfuscaters...

Secondary Keys with Heap::Simple in Perl

I wanted to investigate if anyone has ever used a secondary key when inserting into the Heap::Simple in Perl? If so, was your performance ever impacted? ...

Output command to socket without buffering using Mojo::IOLoop

How to do continiously output of command (for me it's long ping) in real-time mode on Mojo server? I'm looking for some example on Mojo::IOLoop. For example, client connects to server and requests for ping X.X.X.X, server returns an non-buffered output (while ping on server return each line to output, client receive this line from socket...

Is there a Perl module that can split one master Pod file into several views?

I want to write one Pod file for perlop and perlopref. My gut instinct is to say something like =head1 PRECEDENCE blah =head1 OPERATORS =head2 "X" =for short The double quote circumflex operator surrounds an interpolating string. See L<perlop/"X">. =for long -head3 Description blah blah blah -head3 Example blah blah blah -he...

CSTA Link to Hipath 3000 (CSTA II or III) on perl

Hello! I need some infos about how i connect to a Hipath 3000 Series on the CSTA Interface. I need a quickstart for the connect ... maybe someone with experience on Perl and howto make CSTA Link ? Thanks a lot ...