Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jul 1999 17:07:38 +0200
From:      Anton Berezin <tobez@plab.ku.dk>
To:        Dan Langille <junkmale@xtra.co.nz>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: running frequent cron perl scripts
Message-ID:  <19990705170738.D5735@lion.plab.ku.dk>
In-Reply-To: <19990705111124.ZBJY282564.mta1-rme@wocker>; from Dan Langille on Mon, Jul 05, 1999 at 11:08:02PM %2B1200
References:  <19990705111124.ZBJY282564.mta1-rme@wocker>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 05, 1999 at 11:08:02PM +1200, Dan Langille wrote:
> I'm running cron job to start up a perl script.  The script accesses
> the ADSL modem to see if the external IP address has changed.  If it
> has, it runs another job to update the DNS.  The ADSL modem has an
> http interface which has the details I need.

> The perl script takes about 35 seconds to run on this old 486.  But
> I'm guessing that most of that is overhead.  The first bit of the
> script is:

> #!/usr/bin/perl
> $| = 1;
> use CGI;
> use CGI::Carp (fatalsToBrowser);
> require LWP;

> Is there a way to speed this process up?  The above bits seem to take
> up most of the time.

You should definitely remove use CGI::Carp here.  And use CGI - almost
definitely.  Which capabilities of CGI.pm do you need, anyway?

I guess that $| = 1 is alright here, but...  Depending on the amount of
output to STDOUT this script does, this statement can considerably slow
things down.

Are you doing intelligent things with modem's http interface?  In most
cases, LWP::Simple is enough.

And finally, the fact you presented us with just a few first lines of
your script suggests that you think that the startup overhead is the
major slowing factor.  Are you sure of it?  I mean, judging from your
use of CGI::Carp in non-cgi environment, you are not very good in Perl,
so the possibility that script does something in, uhmm, not the most
efficient fashion is far from remote.  :-)  Show us more...

Regards,
-- 
Anton Berezin <tobez@plab.ku.dk>
The Protein Laboratory, University of Copenhagen


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990705170738.D5735>