in reply to Re^4: Why am I getting "premature end of script header"?
in thread Why am I getting "premature end of script header"?

Yup, that would work great. Just add my $lwpavailable; before BEGIN.

Replies are listed 'Best First'.
Re^6: Why am I getting "premature end of script header"?
by lokiloki (Beadle) on Nov 27, 2006 at 23:10 UTC
    is there a significant amount of processing that is requires to load these modules? if the script is accessed, say, several 1000 times per day, attempting to load the modules in the beginning might bog things down more than, say, if they were loaded in the middle of the script only when they are needed (which is infrequent)?

      I ran

      perl -le "use Time::HiRes qw( time ); $t1=time; eval 'use LWP::UserAge +nt; use HTTP::Request::Common;'; $t2=time; print $t2-$t1"
      a couple of times, and got
      0.0728998184204102 0.0660429000854492 0.0670039653778076 0.0661859512329102

      That means you'd save at most 70ms every time the script is run. I've waited longer than the time you'd save per day for a single PerlMonks page to load :) If you're that desperate for speed, you should switch to mod_perl, FastCGI, or similar