Part of my new Job at IBM involves writing test scripts in [Perl].
This of course means I have to learn [Perl], something which I have kept away from ever since I can remember.
I’m not actually being unreasonable about this given the [Perl] extracts I’ve seen on the net and stuff I’ve seen on mailing lists/news groups.
Here is a snippet that exemplifies the issue I have with [Perl]:
{{{($@, $!, $^E, $,, $/, $\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
printf $DB::OUT “%vd”, $^V;;
}}}
{{{($@, $!, $^E, $,, $/, $\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
;{eval { require PadWalker; PadWalker->VERSION(0.08) }or print $DB::OUT (“PadWalker module not found – please install\n”);do ‘dumpvar_epic.pm’ unless defined &dumpvar_epic::dumpvar_epic;defined &dumpvar_epic::dumpvar_epic or print $DB::OUT “dumpvar_epic.pl not available.\n”;my $h = eval { PadWalker::peek_my(2) };my @vars = split (‘ ‘,”);$@ and $@ =~ s/ at .*//, print $DB::OUT ($@);my $savout = select($DB::OUT);dumpvar_epic::dumplex($_,$h->{$_},defined $option{dumpDepth} ? $option{dumpDepth} : -1,@vars) for sort keys %$h;print “E”;select($savout);};;
}}}
{{{($@, $!, $^E, $,, $/, $\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
;{do ‘dumpvar_epic.pm’ unless defined &dumpvar_epic::dumpvar_epic;defined &dumpvar_epic::dumpvar_epic or print $DB::OUT “dumpvar_epic.pm not available.\n”;my $savout = select($DB::OUT);dumpvar_epic::dumpvar_epic();select($savout);};;
}}}
Nice huh? No it’s not. But if you have a good coding standard (which we do at IBM) then it’s not _actually_ that bad. So I’m over my first (and major) predudice.
But now that I know some Perl I have a new thing to hate!! [Perl] OO!!!
The trouble is that it works the same way as it does in PHP 4. Which basically means that the “this” reference (which is implicit in C++ and Java) is not implicit, and if you want to call a member function from within a member function you need to do:
$self->method
Which gets pretty tiresome.
Right that’s enough ranting for now. Back tomorrow to blog more about big blue
Technorati Tags: ibm, perl, php, objectoriented, oo, code, rants