perl

w3c validator: local installation on windows

i am trying to install w3c validator locally on windows xp with apache server. I am following this document http://validator.w3.org/docs/install_win.html but when i validate some site i am getting this error SGML::Parser::OpenSP version 0.991 required--this is only version 0.99 at C:/www/validator/httpd/cgi-bin/check line 60. BEGIN fai...

How do I install modules in ActivePerl?

I want to install SGML::Parser::OpenSP in ActivePerl. Any idea what steps should I follow? ...

Why does my Perl script return a zero return code when I explicitly call exit with a non-zero parameter?

I have a Perl script which calls another script. The Perl script should be propagating the script's return code but seems to be returning zero to its caller (a Java application) desipte the explicit call to exit $scriptReturnCode. Code and output as follows (I realise that <=> could/should be != but that's what I have): print "INFO: Ca...

Why can't I simply copy installed Perl modules to other machines?

Being very new to Perl but not to dynamic languages, I'm a bit surprised at how not straight forward the manage of modules is. Sure, cpan X does theoretically work, but I'm working on the same project from three different machines and OSs (at work, at home, testing in an external environment). At work (Windows 7) I have problem using ...

How to keep same substrings in vim regex

Hi everyone. I'd ideally like a vim answer to this: I want to change [*, 1, *, *] to [*, 2, *, *] Here the stars refer to individual characters in the substring, which I would like to keep unchanged. For example [0, 1, 0, 1] to [0, 2, 0, 1] [1, 1, 1, 1] to [1, 2, 1, 1] If people know how to do this in perl or python or whatever, t...

How can I get user input without waiting for enter in Perl?

I am trying to make an interactive shell script in Perl. The only user input I can find is the following: $name = <STDIN>; print STDOUT "Hello $name\n"; But in this the user must always press enter for the changes to take effect. How can I get the program to proceed immediately after a button has been pressed? ...

Return a perl object from a different perl class to C# using PerlNET

I have two Perl modules which I want to expose as object types to C#. One of them constructs objects of the other type and returns it using a method as shown below. I'm including a reference to Type2.dll in Type1.dll, and referencing them both in C#. As the code shows I can construct a Type2 object directly from C#, but I can't return a ...

Perl: Deleting multiple re-occuring lines where a certain criteria is met

Dear all, I have data that looks like below, the actual file is thousands of lines long. Event_time Cease_time Object_of_reference ...

Why can't the w3c validator load Perl's SGML::Parser::OpenSP?

I have installed W3C validator locally on Windows, following their instructions. I am getting this error while validating a site: Can't locate loadable object for module SGML::Parser::OpenSP in @INC (@INC contains: C:/www/perl/site/lib C:/www/perl/lib .) at C:/www/validator/httpd/cgi-bin/check line 60 Compilation failed in require...

How can I create a qr// in Perl 5.12 from C?

This has been working for me in 5.8 and 5.10, but in 5.12 my code creates this weird non-qr object: # running "print Dumper($regex)" $VAR1 = bless( do{\(my $o = '')}, 'Regexp' ); Whereas printing a qr// not created by my code looks like this: # running "print Dumper(qr/foo/i)" $VAR1 = qr/(?i-xsm:foo)/; My code is basically: REGEXP...

How can I use Perl and RRD to plot ping times?

I'm trying to do my first rrd graph through Perl. I have tried RRD::Simple and rrds and just can't get either one to work. Here's what I have so far: use strict; use RRD::Simple (); # Create an interface object my $rrd = RRD::Simple->new( file => "server.rrd" ); # Put some arbitary data values in the RRD file for the same # 3 data so...

How do I represent a mixin/role/trait with UML properly?

Me and several other developers are currently cleaning up our legacy code base, mostly separating visual and data layers. To help developers not involved in this refactoring understand the model, I'd like to introduce a (rather informal) class diagram with comments about scope and desired usage for each class. Since I'm lazy, I'd like to...

Programming language for opengl screenshot software

I need to develop a multiplatform software that takes screenshots from opengl games without affecting the game in performance, it will run in the background and will add a watermark to my screenshots. What language should i use? I thought of Perl / Python. Anyone can point me out something to start? Thanks! ...

Why does my WWW::Mechanize program time-out when it tries to login?

The site I was screen scraping (Which I have creds for) recently changed their server and blocked port 80. I thought I could just use port 443 for https but I get an timeout error now. I'm just creating a new WWW::Mechanize object and using the get() to scrape the site. My question is, do I need to add the cookie now that they use https...

Python text file processing speed issues

Hi all, I'm having a problem with processing a largeish file in Python. All I'm doing is f = gzip.open(pathToLog, 'r') for line in f: counter = counter + 1 if (counter % 1000000 == 0): print counter f.close This takes around 10m25s just to open the file, read the lines and increment this counter. In...

Why does Net::Twitter complain "HTTP::Message content not bytes"?

We have been using Perl's Net:Twitter CPAN module (version 3.12) and basic authentication (not OAuth) for almost a year now to syndicate updates from our site to our Twitter account. We just migrated to a new server last week and since the move our updates to Twitter have stopped and the following error is being reported whenever we try ...

Is there a Bioperl equivalent of IO::ScalarArray for array of Seq objects?

In Perl, we have IO::ScalarArray for treating the elements of an array like the lines of a file. In BioPerl, we have Bio::SeqIO, which can produce a filehandle that reads and writes Bio::Seq objects instead of strings representing lines of text. I would like to do a combination of the two: I would like to obtain a handle that reads succe...

Using perl to parse a file and insert specific values into a database

Disclaimer: I'm a newbie at scripting in perl, this is partially a learning exercise (but still a project for work). Also, I have a much stronger grasp on shell scripting, so my examples will likely be formatted in that mindset (but I would like to create them in perl). Sorry in advance for my verbosity, I want to make sure I am at least...

not autolinking all-numeric twitter hashtags in perl?

I'm producing HTML from twitter search results. Happily using the Net::Twitter module :-) One of the rules in Twitter is that all-numeric hashtags are not links. This allows to unambiguously tweet things like "ur not my #1 anymore", as in here: http://twitter.com/natarias2007/status/11246320622 The solution I came up with looks like: ...

How can I print the cookie_jar values in Perl's WWW::Mechanize?

How can I print the values of the cookie/cookie_jar being set? Trying: ##my $cookie_jar=HTTP::Cookies->new(file => "cookie.jar",autosave=>1,ignore_discard=>1); my $cookie_jar=HTTP::Cookies->new(); ## Would like it to be in memory my $agent = WWW::Mechanize->new(cookie_jar => $cookie_jar); ##my $agent = WWW::Mechanize->new(); ##my $age...