Chris Knipe <mailto:[EMAIL PROTECTED]> wrote:
: Allrighty.... The module is called from FreeRadius itself, so if
: there really is nothing wrong with my code (which I suspect there
: isn't), then I guess this must be moved to the FR list. But let's
: rather make sure it's not the code first.
To set up a test case we can assume that the while loop has started
and we are in the 'else' block which affects $RAD_REPLY{'Recv-Limit'}
and $RAD_REPLY{'Xmit-Limit'}.
When I tested this, I found this part okay. Since %RAD_REPLY is
not accessed in this script, I don't know how you determined there
was failure.
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper 'Dumper';
use Number::Format;
# use CGI;
# use CGI::Carp qw(fatalsToBrowser);
my %RAD_REPLY;
my( $Username, $Password, $isActive, $BytesAvail, $BytesUsed ) =
( 'foo', 'foo', 'y', 20971521, 1 );
# Successfull Login.
my $za = new Number::Format(-thousands_sep => ',',
-decimal_point => '.',
-KILO_SUFFIX => 'KB',
-MEGA_SUFFIX => 'MB',
-GIGA_SUFFIX => 'GB',
-int_curr_symbol => 'ZAR');
$RAD_REPLY{'Acct-Interim-Interval'} = "300";
$RAD_REPLY{'Framed-Compression'} = "Van-Jacobson-TCP-IP";
$RAD_REPLY{'Framed-Protocol'} = "PPP";
$RAD_REPLY{'Framed-Routing'} = "Broadcast-Listen";
$RAD_REPLY{'Idle-Timeout'} = "600";
$RAD_REPLY{'MS-MPPE-Encryption-Policy'} = "1";
$RAD_REPLY{'MS-MPPE-Encryption-Types'} = "LS";
$RAD_REPLY{'Rate-Limit'} = "256k/512k";
$RAD_REPLY{'Recv-Limit'} = $BytesAvail - $BytesUsed;
$RAD_REPLY{'Xmit-Limit'} = $BytesAvail - $BytesUsed;
$RAD_REPLY{'Reply-Message'} =
"You have " .
$za->format_bytes($BytesAvail - $BytesUsed) .
" available.";
$RAD_REPLY{'Service-Type'} = "Framed-User";
$RAD_REPLY{'Session-Timeout'} = "86400";
### LOG IT!
# return RLM_MODULE_UPDATED;
print Dumper \%RAD_REPLY;
__END__
BTW, we don't normally quote numbers in perl The
following line, for example, could be written better.
if (!$SQL->numrows == "1") {
if ( $SQL->numrows != 1 ) {
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>