Showing posts with label Modern Perl. Show all posts
Showing posts with label Modern Perl. Show all posts

Sunday, January 16, 2011

Modern Perl

Last November, chromatic announced the availability of his book on Modern Perl. His creation is geared towards beginner Perl programmers who want to learn how to use the language in the most effective way, based on experienced programmers' know-how.
The book is also recommended to anyone who wrote Perl scripts in the distant past and wants to take advantage of Perl 5's latest features and good coding practices.
You can download the pdf file from the companion site.

Modern Perl

Last November, chromatic announced the availability of his book on Modern Perl. His creation is geared towards beginner Perl programmers who want to learn how to use the language in the most effective way, based on experienced programmers' know-how.
The book is also recommended to anyone who wrote Perl scripts in the distant past and wants to take advantage of Perl 5's latest features and good coding practices.
You can download the pdf file from the companion site.

Wednesday, March 4, 2009

Using the Modern::Perl module

I recently had a warning in the GUI version of twit.pl (work in progress):
v-string in use/require non-portable at C:\Perl\usr\Blog\twit_1_0_0.pl line 73

The incriminated line 73 was:
use 5.10.0;

I googled the error string and Tom Wyant's ticket on Perl came up. It helped me understand the issue at hand and how to fix it.
However, for more in-depth information, I pushed my way to perldoc.perl.org

v-string refers to a version string: be warned, the version strings have ben deprecated since Perl 5.8.1 and this is why you will get a warning.
Version strings start with a "v" (example: v1.0). Strings that have 2 decimal points (eg. v1.0.0) are automatically considered as version strings.

In Perl, you can use underscores in numeric values between digits to make them easier to read.
For example, 1200.0053 can be represented as 1_200.00_53.

To remove the v-string warning, I replaced the line
use 5.10.0;
by
use 5.010_000;

(use 5.010 also works but not use 5.10: the Perl compiler will look for version 5.100)

Or you can also use the Modern::Perl module written by chromatic.
Among other things, Modern::Perl will include the following pragmas:

use 5.010_000;
use strict;
use warnings;

In order to install the module from Padre, all is required is that you go to:
Perl>Install Module...>Install CPAN Module
You will see the window below:

perl::critic module install from Padre
Enter Modern::Perl and let CPAN work its magic!

Larry Wall quote of the day:
"Perl itself is usually pretty good about telling you what you shouldn't do."

Possible next posts:
  • Perl template - Part II: Adding Help and Version procedures
  • Perl help resources
  • Improving on twit.pl: Graphical User interface
  • POD
  • Install Google Analytics on your Blogger blog and stats for DLP

Using the Modern::Perl module

I recently had a warning in the GUI version of twit.pl (work in progress):
v-string in use/require non-portable at C:\Perl\usr\Blog\twit_1_0_0.pl line 73

The incriminated line 73 was:
use 5.10.0;

I googled the error string and Tom Wyant's ticket on Perl came up. It helped me understand the issue at hand and how to fix it.
However, for more in-depth information, I pushed my way to perldoc.perl.org

v-string refers to a version string: be warned, the version strings have ben deprecated since Perl 5.8.1 and this is why you will get a warning.
Version strings start with a "v" (example: v1.0). Strings that have 2 decimal points (eg. v1.0.0) are automatically considered as version strings.

In Perl, you can use underscores in numeric values between digits to make them easier to read.
For example, 1200.0053 can be represented as 1_200.00_53.

To remove the v-string warning, I replaced the line
use 5.10.0;
by
use 5.010_000;

(use 5.010 also works but not use 5.10: the Perl compiler will look for version 5.100)

Or you can also use the Modern::Perl module written by chromatic.
Among other things, Modern::Perl will include the following pragmas:

use 5.010_000;
use strict;
use warnings;

In order to install the module from Padre, all is required is that you go to:
Perl>Install Module...>Install CPAN Module
You will see the window below:

perl::critic module install from Padre
Enter Modern::Perl and let CPAN work its magic!

Larry Wall quote of the day:
"Perl itself is usually pretty good about telling you what you shouldn't do."

Possible next posts:
  • Perl template - Part II: Adding Help and Version procedures
  • Perl help resources
  • Improving on twit.pl: Graphical User interface
  • POD
  • Install Google Analytics on your Blogger blog and stats for DLP

Monday, February 2, 2009

RankSearch script: the end of a bad idea

The good folks over at StackOverflow convinced me to take the right decision: although writing a script to automatically retrieve web rank results would probably have been ok for a private program, I feel uncomfortable publishing it.
Making public a forbidden tool would certainly have attracted all kind of bad attention.
So, before it's even written, the RankSearch project is cancelled!
It even started badly as the original name was SearchRank.pl and unnerved the people of SearchRank.com (see, I offer a free link in compensation ;).

So, it looks like I need a new project. Thanks for leaving your ideas in the comment section.

Modern::Perl
In the mean time, I can only recommend reading what chromatic has to say about writing maintainable Perl code over at Modern Perl Books. I promise I'll start writing more Perl soon, to give fodder to his cannon! Hey, if I can get an expert's code review out of it, I consider it a win-win situation.

The Perl Review
I recently subscribed to The Perl Review. The digital edition only set me back $10 (or less than 7 euros) and I have access to all the (17) back issues. Brian D Foy (the publisher) himself edited my StackOverflow question (alright Brian, you were correct, mine wasn't exactly a Perl question but see how I spell Perl correctly with a capital 'P' now!).

French expression of the day:
"de la chair à canon": cannon fodder. Notice how the French and English spell "can+on" differently.

Next posts:
  • Improving on the Perl template
  • How to install and use Google Analytics on your Blogger blog
  • Perl help resources
  • POD

RankSearch script: the end of a bad idea

The good folks over at StackOverflow convinced me to take the right decision: although writing a script to automatically retrieve web rank results would probably have been ok for a private program, I feel uncomfortable publishing it.
Making public a forbidden tool would certainly have attracted all kind of bad attention.
So, before it's even written, the RankSearch project is cancelled!
It even started badly as the original name was SearchRank.pl and unnerved the people of SearchRank.com (see, I offer a free link in compensation ;).

So, it looks like I need a new project. Thanks for leaving your ideas in the comment section.

Modern::Perl
In the mean time, I can only recommend reading what chromatic has to say about writing maintainable Perl code over at Modern Perl Books. I promise I'll start writing more Perl soon, to give fodder to his cannon! Hey, if I can get an expert's code review out of it, I consider it a win-win situation.

The Perl Review
I recently subscribed to The Perl Review. The digital edition only set me back $10 (or less than 7 euros) and I have access to all the (17) back issues. Brian D Foy (the publisher) himself edited my StackOverflow question (alright Brian, you were correct, mine wasn't exactly a Perl question but see how I spell Perl correctly with a capital 'P' now!).

French expression of the day:
"de la chair à canon": cannon fodder. Notice how the French and English spell "can+on" differently.

Next posts:
  • Improving on the Perl template
  • How to install and use Google Analytics on your Blogger blog
  • Perl help resources
  • POD