swestrup: (Default)
[personal profile] swestrup
I 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.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

January 2017

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 6th, 2026 07:41 am
Powered by Dreamwidth Studios