Perl is Perverted.
Jun. 28th, 2003 08:14 amI would say that the inner workings of Perl were grotty, were it not that I know of many nice grottos far less grotty than perlguts.
So, my discovery of today is that the following code works:
eval{ use Foo::Bar }
eval{ use Foo::Bar } if $@;
eval{ use Foo::Bar } if $@;
die $@ if $@;
But this doesn't:
sub tryit($) { for(1..3){ eval $_[0]; return 1 if !$@ } die $@; }
tryit("use Foo::Bar");
Or, that is, it claims to work, but the exports of Foo::Bar are nowhere to be found...
Anyway, I finally realized I only called tryit 6 times in my code so I simply pasted in 6 copies of the first solution. One day I'll figure out what I SHOULD have coded, when I'm not under such deadline pressure.
Oh, and the above is necessary since, under Win98, if I fork two perl tasks and they load the SAME libraries, then every now and again one of the loads fails for no reason. Retrying twice seems to limit the scope of the problem. FIXING the problem is left as an excercise for the reader.
So, my discovery of today is that the following code works:
eval{ use Foo::Bar }
eval{ use Foo::Bar } if $@;
eval{ use Foo::Bar } if $@;
die $@ if $@;
But this doesn't:
sub tryit($) { for(1..3){ eval $_[0]; return 1 if !$@ } die $@; }
tryit("use Foo::Bar");
Or, that is, it claims to work, but the exports of Foo::Bar are nowhere to be found...
Anyway, I finally realized I only called tryit 6 times in my code so I simply pasted in 6 copies of the first solution. One day I'll figure out what I SHOULD have coded, when I'm not under such deadline pressure.
Oh, and the above is necessary since, under Win98, if I fork two perl tasks and they load the SAME libraries, then every now and again one of the loads fails for no reason. Retrying twice seems to limit the scope of the problem. FIXING the problem is left as an excercise for the reader.