GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::Radius::Server::Set(3) User Contributed Perl Documentation Net::Radius::Server::Set(3)

Net::Radius::Server::Set - Base class for set methods

  package My::Radius::Set;
  use base 'Net::Radius::Server::Set';

  __PACKAGE__->mk_accessors(qw/foo bar baz/);

  sub set_foo { ... }
  sub set_bar { ... }
  sub set_baz { ... }

  # Meanwhile, in a configuration file nearby...
  my $set = My::Radius::Set->new({ foo => 'x', bar => 'y' });
  my $set_sub = $set->mk;
  ...

  # Alternatively, in a more compact notation...
  my $set_sub = My::Radius::Set->mk({ foo => 'x', bar => 'y' });

"Net::Radius::Server::Set" is a base class for developing "set" methods to be used in "Net::Radius::Server" rules.

"Net::Radius::Server::Set"'s "new()" will honor a property called "result", that will be used as the return value of the method. Otherwise, "NRS_SET_CONTINUE" will be returned. Note that you can define the "set_result" hook, causing the result of the request to be calculated at packet processing time.

"->new($hashref)"
Creates a new "Net::Radius::Server::Set" object. $hashref referenes a hash with the attributes that will apply to this object, so that multiple set methods (that will share the same underlying object) can be created and given to different rules.
"$self->mk()" or "__PACKAGE__->mk($hashref)"
This method returns a sub suitable for calling as a set method for a "Net::Radius::Server" rule. The resulting sub will return whatever is defined in its "result" property.

The sub contains a closure where the object attributes -- Actually, the object itself -- are kept.

When invoked as an object method (ie, "$self->mk()"), no arguments can be given. The object is preserved as is within the closure.

When invoked as a class method (ie, "__PACKAGE__->mk($hashref)"), a new object is created with the given arguments and then, this object is preserved within the closure. This form is useful for compact filter definitions that require little or no surrounding code or holding variables.

"->_set()"
This method is internally called by the sub returned by the call to "->mk()" and should not be called explicitly. This method iterates through the existing elements in the object -- It is assumed that it is a blessed hash ref, as left by "Class::Accessor".

This method tries to invoke "$self-"set_$element(@_)>, passing the same arguments it receives - Note that normally, those are the same that were passed to the sub returned by the factory.

See the source of "Net::Radius::Server::Set::Simple". This is much simpler than it sounds. Really.

Arguments with no corresponding "set_*" method are ignored. Arguments whose name start with "_" are also ignored.

After invoking all the required "set_*" methods, whatever is specified in the "result" property or the default value is returned.

As shown in the example in the SYNOPSIS, your derived class must provide a "match_*" method for each attribute you define.

The method must return any of the "NRS_MATCH_*" constants to indicate its result.

None by default.

  $Log$
  Revision 1.4  2006/12/14 16:33:17  lem
  Rules and methods will only report failures in log level 3 and
  above. Level 4 report success and failure, for deeper debugging

  Revision 1.3  2006/12/14 15:52:25  lem
  Fix CVS tags

Perl(1), Class::Accessor(3), Net::Radius::Server(3).

Luis E. Muñoz, <luismunoz@cpan.org>

Copyright (C) 2006 by Luis E. Muñoz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5.8.6 itself.

Hey! The above document had some coding errors, which are explained below:
Around line 180:
Non-ASCII character seen before =encoding in 'Muñoz,'. Assuming UTF-8
2009-09-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.