If you get snowed in this week-end, here's a fun way to pass the time: enter the Google AI challenge!
Organized by the University of Waterloo (Canada) and sponsored by Google, this challenge lets you compete in a game of Tron against other people's algorithms from a wide selection of programming languages.
Sadly, Perl is not widely represented and the highest Perl score is at the 176th rank as of this Friday night.
The contest ends on the 26th of this month. Who will care to test their Perl skills?
Friday, February 12, 2010
Google AI Challenge: move Perl up the charts!
If you get snowed in this week-end, here's a fun way to pass the time: enter the Google AI challenge!
Organized by the University of Waterloo (Canada) and sponsored by Google, this challenge lets you compete in a game of Tron against other people's algorithms from a wide selection of programming languages.
Sadly, Perl is not widely represented and the highest Perl score is at the 176th rank as of this Friday night.
The contest ends on the 26th of this month. Who will care to test their Perl skills?
Organized by the University of Waterloo (Canada) and sponsored by Google, this challenge lets you compete in a game of Tron against other people's algorithms from a wide selection of programming languages.
Sadly, Perl is not widely represented and the highest Perl score is at the 176th rank as of this Friday night.
The contest ends on the 26th of this month. Who will care to test their Perl skills?
Tuesday, December 22, 2009
Reentrant perldoc help
Just want to elaborate on a tip that I gave back in March.
I have a somehow standard way of displaying help for my scripts:
I display the POD data using the $0 perl internal variable.
$0 (or $PROGRAM_NAME if you are using the use English; pragma) "contains the name of the file containing the Perl script being executed", to quote the Camel book.
The help section is printed on screen if a script requires a parameter but none has been provided. I used to write it this way for a command line accepting only one parameter:
However, I recently ran into a slight difficulty.
On Windows, $0 contains the disk letter followed by the complete path and finally the file name. For example:
C:\Users\Damien\Desktop\test coverage\Perl Scripts
Notice the white spaces in the directory names.
When trying to perldoc this particular file name, I would get an error stating that there is no documentation for "C:\Users\Damien\Desktop\test", "coverage\Perl" nor "Scripts".
My first reaction was simply to surround the $0 file name with "" as shown below:
[Added Dec. 29th]
However, an enlightened reader pointed me to the best solution:
Using the list argument form of the system function avoids relying on the shell to run your command.
I have a somehow standard way of displaying help for my scripts:
I display the POD data using the $0 perl internal variable.
$0 (or $PROGRAM_NAME if you are using the use English; pragma) "contains the name of the file containing the Perl script being executed", to quote the Camel book.
The help section is printed on screen if a script requires a parameter but none has been provided. I used to write it this way for a command line accepting only one parameter:
sub get_help {
system("perldoc $0");
exit;
}
my $arg = $ARGV[0] || &get_help;However, I recently ran into a slight difficulty.
On Windows, $0 contains the disk letter followed by the complete path and finally the file name. For example:
C:\Users\Damien\Desktop\test coverage\Perl Scripts
Notice the white spaces in the directory names.
When trying to perldoc this particular file name, I would get an error stating that there is no documentation for "C:\Users\Damien\Desktop\test", "coverage\Perl" nor "Scripts".
My first reaction was simply to surround the $0 file name with "" as shown below:
sub get_help {
system("perldoc \"$0\"");
exit;
}
my $arg = $ARGV[0] || &get_help;[Added Dec. 29th]
However, an enlightened reader pointed me to the best solution:
sub get_help {
system("perldoc", $0);
exit;
}
my $arg = $ARGV[0] || &get_help;Using the list argument form of the system function avoids relying on the shell to run your command.
Reentrant perldoc help
Just want to elaborate on a tip that I gave back in March.
I have a somehow standard way of displaying help for my scripts:
I display the POD data using the $0 perl internal variable.
$0 (or $PROGRAM_NAME if you are using the use English; pragma) "contains the name of the file containing the Perl script being executed", to quote the Camel book.
The help section is printed on screen if a script requires a parameter but none has been provided. I used to write it this way for a command line accepting only one parameter:
However, I recently ran into a slight difficulty.
On Windows, $0 contains the disk letter followed by the complete path and finally the file name. For example:
C:\Users\Damien\Desktop\test coverage\Perl Scripts
Notice the white spaces in the directory names.
When trying to perldoc this particular file name, I would get an error stating that there is no documentation for "C:\Users\Damien\Desktop\test", "coverage\Perl" nor "Scripts".
My first reaction was simply to surround the $0 file name with "" as shown below:
[Added Dec. 29th]
However, an enlightened reader pointed me to the best solution:
Using the list argument form of the system function avoids relying on the shell to run your command.
I have a somehow standard way of displaying help for my scripts:
I display the POD data using the $0 perl internal variable.
$0 (or $PROGRAM_NAME if you are using the use English; pragma) "contains the name of the file containing the Perl script being executed", to quote the Camel book.
The help section is printed on screen if a script requires a parameter but none has been provided. I used to write it this way for a command line accepting only one parameter:
sub get_help {
system("perldoc $0");
exit;
}
my $arg = $ARGV[0] || &get_help;However, I recently ran into a slight difficulty.
On Windows, $0 contains the disk letter followed by the complete path and finally the file name. For example:
C:\Users\Damien\Desktop\test coverage\Perl Scripts
Notice the white spaces in the directory names.
When trying to perldoc this particular file name, I would get an error stating that there is no documentation for "C:\Users\Damien\Desktop\test", "coverage\Perl" nor "Scripts".
My first reaction was simply to surround the $0 file name with "" as shown below:
sub get_help {
system("perldoc \"$0\"");
exit;
}
my $arg = $ARGV[0] || &get_help;[Added Dec. 29th]
However, an enlightened reader pointed me to the best solution:
sub get_help {
system("perldoc", $0);
exit;
}
my $arg = $ARGV[0] || &get_help;Using the list argument form of the system function avoids relying on the shell to run your command.
Monday, September 14, 2009
Installing Padre on Windows Vista
Last week, I (re-)installed Padre on my Windows Vista machine. Padre is a development environment geared towards Perl programmers, with a focus on Perl beginners.
I use the Strawberry Perl distribution (5.10.0.6) and read that it was a breeze to install Padre.
Well, it almost is.
I opened the cpan shell (typing cpan in a DOS shell is all it takes if C:\strawberry\perl\bin is in your PATH).
The regular install (install Padre) failed because of a dependency on Wx::Perl::ProcessStream not building. Just force install that module (force install Wx::Perl::ProcessStream) then install Padre (a ticket has already been written for the issue).
It works like a charm, no need to force install Padre anymore!
So if you are a Perl beginner and want to use an editor written in Perl + suited for Perl tasks, you have no excuse anymore.
If you already have Padre and want to update it to version 0.46 released today (September 14th 2009), type upgrade Padre in your cpan shell. Better yet, you can update directly from the Padre Plugins menu: Plugins>Module Tools>Install CPAN Module and type Padre.
I use the Strawberry Perl distribution (5.10.0.6) and read that it was a breeze to install Padre.
Well, it almost is.
I opened the cpan shell (typing cpan in a DOS shell is all it takes if C:\strawberry\perl\bin is in your PATH).
The regular install (install Padre) failed because of a dependency on Wx::Perl::ProcessStream not building. Just force install that module (force install Wx::Perl::ProcessStream) then install Padre (a ticket has already been written for the issue).
It works like a charm, no need to force install Padre anymore!
So if you are a Perl beginner and want to use an editor written in Perl + suited for Perl tasks, you have no excuse anymore.
If you already have Padre and want to update it to version 0.46 released today (September 14th 2009), type upgrade Padre in your cpan shell. Better yet, you can update directly from the Padre Plugins menu: Plugins>Module Tools>Install CPAN Module and type Padre.
Subscribe to:
Posts
(
Atom
)