(RADIATOR) Several Hooks but only one Hook directive

Hugh Irvine hugh at open.com.au
Wed Nov 2 15:28:28 CST 2005


Hello Frank, Hello Laurent -

Frank is correct - the best way to do this is to define a number of  
subroutines and have the hook code decide which subroutines to call.

However, to avoid namespace collisions, you should set up an  
additional Perl module with your subroutines defined in it, then call  
the routines using the normal Perl conventions. Have a look at  
"Radius/Util.pm" as an example.

Something like this:


# MySubs.pm
#

package Radius::MySubs;

use strict;

sub TaskA
{
	.....
}

sub TaskB
{
	.....
}

sub TaskC
{
	.....
}


Then your hook code would call the routines like this (assuming you  
have installed the module in the Radius subdirectory):

	&Radius::MySubs::TaskA(...);

	&Radius::MySubs::TaskB(...);


hope that helps

regards

Hugh



On 3 Nov 2005, at 04:09, Frank Danielson wrote:

> There's two ways I can think of to accomplish this effect-
>
> One is to create file taskA.pl, taskB.pl, and taskC.pl with each  
> having the
> task as a subroutine like sub taskA {}. Then you create individual  
> hooks
> called something like taskAB.pl that look something like this-
>
> include taskA.pl
> include taskB.pl
>
> &taskA();
> &taskB();
>
> Or just make one hook with all of the task as subroutines and use  
> if then
> statements to decide which ones to run. This gives you one file to  
> maintain
> and allows some continuity between tasks if needed.
>
> if (condition AB) {
> 	&taskA();
> 	&taskB();
> } elsif (condition BC) {
> 	&taskB();
> 	&taskC();
> }
>
> sub taskA {
> 	A tasks;
> }
>
> sub taskB {
> 	B tasks
> }
>
> sub taskC {
> 	C tasks
> }
> 	
>
> Frank Danielson
> Infrastructure Architect
>
> ClearSky Mobile Media
> 56 E. Pine St.
> Orlando, FL 32801
> USA
>
> fdanielson at csky.com
> -----Original Message-----
> From: PREVOSTO, Laurent [mailto:Laurent.PREVOSTO at neufcegetel.fr]
> Sent: Wednesday, November 02, 2005 11:02 AM
> To: radiator at open.com.au
> Subject: (RADIATOR) Several Hooks but only one Hook directive
>
>
> Hi,
>
> I suppose it's not possible but maybe there is some kind of trick  
> to do such
> a thing :
> Is there a way to sequentially run several hooks with the same  
> XxxxxHook
> directive.
> I mean something like :
> PostAuthHook file:"%D/foo.pl", file:"%D/bar.pl"
>
> That would allow me to only deal with a few files instead of having  
> (and
> maintaining) :
> the file that does the A task
> the file that does the B task
> the file that does the C task
> the file that does the A and the B tasks
> the file that does the B and C tasks
> the file that does the A and B and C tasks
> etc...
>
>
> Regards
>
> Laurent
>
> --
> Archive at http://www.open.com.au/archives/radiator/
> Announcements on radiator-announce at open.com.au
> To unsubscribe, email 'majordomo at open.com.au' with
> 'unsubscribe radiator' in the body of the message.


NB:

Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive (www.open.com.au/archives/ 
radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.


--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list