Friday, July 06, 2007

Watch that punctuation

I'll tell you, there is nothing like coding all day and having a really good time doing so, and then, right around mid-afternoon you hit an error that just stops you. You can't figure it out for the life of you.

I am working on a script to automatedly download ALL of CPAN. ( I know.... WHY? Because I want to, that's why. Plus, my laptop isn't always able to get online and when I need a module, if I have it readily available, I can manually install it.)

Basically, the script fetches a copy of the CPAN modules list, and I am then parsing out of the HTML that was returned, the paths to the modules, including the module names. Here is the section of code that was bugging me:

if($line =~ m/\.gz/)
@elements = split(/"/, $line);
print PATHS ("$elements[1]\n");

I was really wanting this to work ( and the code above does), but when I IM'd Merlyn (Randal Schwartz), he noticed that I was missing a double quote in the print path. Man, after all day coding, I don't blame myself for missing that one. Thanks Merlyn for the second set of eyes on that one!

Once I have the code completed I will post it here.


Randal L. Schwartz said...

Why aren't you just using CPAN::Mini?

jlk said...

I could have, but I did this for the learning and experience of it. I figure it is better to learn how to do something and then to use the modules at a later point, so that I have a better understanding and knowledge of Perl.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.