global hash variable perl

Alexander Clouter alex at digriz.org.uk
Tue Mar 1 10:00:47 CET 2011


Hi,

* Vinh Nguyen <vhn2000 at gmail.com> [2011-03-01 00:37:17-0600]:
>
> something is very strange in my case.
> 
> I used the global variable like you pointed out. Then I tested the logic and
> it seems like the hash variable isn't cache properly. The data is not
> cached. I gave up and tried again in couple hours. And then it magically
> worked. now the hash variable is caching the data as expected. But I'm a bit
> confused as why it wasn't working in the first place.
> 
Looks like Alan has just updated the Perl example:

https://github.com/alandekok/freeradius-server/blob/master/src/modules/rlm_perl/example.pl

Looking at what is going on, I think there might be some indirect 
'BEGIN' abuse that causes this to work.  I spoke to my 'goto' Perl 
friend and he suggested that the following is the way to probably do 
this:
----
our %static_hash;
----

>From my mod_perl experiences, that does sound/feel familiar.

Anyway, in my example just does caching for an EAP session between the 
first call through authorize{} and the final post-auth{} call; which 
probably explains why it works for me.

Cheers

-- 
Alexander Clouter
.sigmonster says: BOFH excuse #10:
                  hardware stress fractures



More information about the Freeradius-Users mailing list