NAME

Net::Radius::Server::Base - Base definitions and utility methods and factories

SYNOPSIS

package My::Radius::Thing;
use base 'Net::Radius::Server::Base';

# Alternatively...

use Net::Radius::Server::Base qw(:match);

...

DESCRIPTION

Net::Radius::Server::Base provides a number of utility methods and services useful for "match" and "set" sub-classes of Net::Radius::Server.

The following methods are provided or overriden:

->new(...)

This method is modified so that SUPER::new() is invoked and then, the value of the description property is initialized. Class::Accessor is used as a base class, so we'll inherit the new() method defined there.

->description()

This is an accessor to an object property of the same name, that stores te description of this object. It is automagically initialized to the class name of the object, the file name and line number where it was created.

This is used in errors and warnings to make it easier to spot problems.

->log($level, $msg, ...)

A simple logging facility. The current implementation causes messages to be sent to warn() when the $level is lower than or equal to the current ->log_level.

->log_level($level)

Specifies the current logging level. This is a number (defaults to 2) that controls how verbose are the logs generated by a given object. Only messages with a level lower or equal to the current log level are produced.

As a general rule, the following are guidelines about how to set the log level:

Level 1

Only exceptions and failures - Events that cause a process to fail.

Level 2

Includes less severe exceptions and rejects.

Level 3

Includes general internal conditions within the code. Generally useful to determine the execution thread within a class.

Level 4

Most detailed data, including normal behavior. This is used for debugging purposes.

EXPORT

Usually, constants are imported using one of the following keywords:

:match

Export the constants that are useful for match methods and classes, namely:

NRS_MATCH_FAIL

This should be returned when the match method did not match the given request. An example would be a match method looking for a certain domain in the Username field of the RADIUS request. If the required value is not present, the match method could return NRS_MATCH_FAIL to tell the server that the rule should not apply to this request.

NRS_MATCH_OK

When the match method does match the given request, NRS_MATCH_OK should be returned. This causes the next match method to be invoked. After all the match methods have returned NRS_MATCH_OK, the packet will be passed to the set methods for processing.

:set

Export the constants that are useful for set methods and classes, namely:

NRS_SET_CONTINUE

Causes the next set method within this rule to be invoked. This is the default return code for set methods.

NRS_SET_SKIP

Causes the remaining set methods in the current rule to be skipped. The next rule will be evaluated, starting with the match methods.

NRS_SET_RESPOND

Causes the current response packet to be returned to the RADIUS client as the response to its request.

NRS_SET_DISCARD

Causes the current response packet to be abandonned. No further processing will occur and no response will be sent. This is a silent packet discard.

:all

Includes all of the above. Included just for completion, as it is seldom necessary.

HISTORY

$Log$
Revision 1.4  2006/12/14 15:52:25  lem
Fix CVS tags

SEE ALSO

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

AUTHOR

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

COPYRIGHT AND LICENSE

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 247:

Non-ASCII character seen before =encoding in 'Muñoz,'. Assuming UTF-8