How to access config parameters for rlm_perl

2010-02-16 Thread David Donn
Hi,

I want to set up some config parameters for use in my perl module. I
think these are supposed to be in the RAD_CONFIG hash. But this hash
always seems to be empty.

Any ideas? Maybe I have I have my config parameters defined in the wrong
place?

Cheers,
David Donn

My site file:
accounting {

example

}

My rlm_perl config file (from /etc/raddb/modules):
perl example {

module = ${confdir}/example.pl

foo = bar

}

My perl code (example.pl):
use strict;

# use ...
# This is very important ! Without this script will not get the filled
hashesh from main.
use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK %RAD_CONFIG);

use constantRLM_MODULE_OK=2;#  /* the module is OK,
continue */

use constant LOG_ERROR = 4;

sub accounting {

# doesn't print anything, expected it to print module =
/etc/raddb/example.pl and foo = bar
foreach my $k (keys %RAD_CONFIG) {
radiusd::radlog(LOG_ERROR, Config $k = $RAD_CONFIG{$k});
}

return RLM_MODULE_OK;
}


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Re: How to access config parameters for rlm_perl

2010-02-16 Thread Alan DeKok
David Donn wrote:
 I want to set up some config parameters for use in my perl module. I
 think these are supposed to be in the RAD_CONFIG hash. But this hash
 always seems to be empty.

  That hash is per-request configuration.  i.e. authentication type, etc.

 My rlm_perl config file (from /etc/raddb/modules):
 perl example {
 
 module = ${confdir}/example.pl
 
 foo = bar
 
 }
 
 My perl code (example.pl):
 use strict;
...
 # doesn't print anything, expected it to print module =
 /etc/raddb/example.pl and foo = bar
 foreach my $k (keys %RAD_CONFIG) {

  You cannot access the configuration files from rlm_perl.

  Try describing a problem rather than a solution.  Maybe there's
another solution that works.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html