[RADIATOR] Best way to use perl use statement in handler
Michael Harlow
Michael.Harlow at utas.edu.au
Thu Jun 25 08:12:39 CDT 2009
Hi,
I've just made an enhancement to a perl hook (based on the eap_anon_hook.pl) where I want to send a message to a remote web server each time an accounting "Start" is received, to activate an Internet Management System. It is working fine.
However my question (with my very thin Perl knowledge) is about the "use" statements, and their presence inside the "sub". Is this the best place to have them, and does that result in the perl interpreter constantly fetching and loading those perl modules for each packet, or does it have negligible impact on perl this way. If it is impacting performance, how should they be placed/defined to minimise the performance hit?
Thanks, Michael
sub
{
# IMS Requirements
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
use HTTP::Request::Common qw(POST);
#
# original eap_anon handler code start
use DBI;
my ($p, $rp, $handled, $reason) = @_;
.....
.....
}
More information about the radiator
mailing list