| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #! /usr/bin/perl | 
| 2 |  |  |  |  |  |  | # | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # $Id: Set.pm 75 2009-08-12 22:08:28Z lem $ | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | package Net::Radius::Server::Set; | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 20 | use 5.008; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 34 |  | 
| 9 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 10 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 31 |  | 
| 11 | 1 |  |  | 1 |  | 7 | use Carp qw/croak/; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 52 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 1 |  |  | 1 |  | 5 | use Net::Radius::Server::Base ':set'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 14 | 1 |  |  | 1 |  | 23 | use base 'Net::Radius::Server::Base'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 251 |  | 
| 15 |  |  |  |  |  |  | our $VERSION = do { sprintf "%0.3f", 1+(q$Revision: 75 $ =~ /\d+/g)[0]/1000 }; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub mk | 
| 18 |  |  |  |  |  |  | { | 
| 19 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 20 | 0 | 0 | 0 |  |  |  | croak "->mk() cannot have arguments when in object-method mode\n" | 
|  |  |  | 0 |  |  |  |  | 
| 21 |  |  |  |  |  |  | if ref($self) and $self->isa('UNIVERSAL') and @_; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 0 |  |  |  |  |  | my $n = $self; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 0 | 0 |  |  |  |  | if (@_) | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 0 |  |  |  |  |  | $n = $self->new(@_); | 
| 28 | 0 | 0 |  |  |  |  | die "Failed to create new object\n" unless $n; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 0 |  |  | 0 |  |  | return sub { $n->_set(@_) }; | 
|  | 0 |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub _set | 
| 35 |  |  |  |  |  |  | { | 
| 36 | 0 |  |  | 0 |  |  | my $self	= shift; | 
| 37 | 0 |  |  |  |  |  | my $r_args	= shift; | 
| 38 |  |  |  |  |  |  |  | 
| 39 | 0 |  |  |  |  |  | for my $arg (sort keys %$self) | 
| 40 |  |  |  |  |  |  | { | 
| 41 | 0 | 0 |  |  |  |  | next if $arg =~ /^_/; | 
| 42 | 0 | 0 |  |  |  |  | if ($self->can('set_' . $arg)) | 
| 43 |  |  |  |  |  |  | { | 
| 44 | 1 |  |  | 1 |  | 4 | no strict 'refs'; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 306 |  | 
| 45 | 0 |  |  |  |  |  | my $m = 'set_' . $arg; | 
| 46 | 0 |  |  |  |  |  | $self->log(4, "Invoking set method $m"); | 
| 47 | 0 |  |  |  |  |  | $self->$m($r_args, @_); | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  |  | 
| 51 | 0 | 0 | 0 |  |  |  | if ($self->can('result') and exists $self->{result}) | 
| 52 |  |  |  |  |  |  | { | 
| 53 | 0 |  |  |  |  |  | my $r = $self->result; | 
| 54 | 0 |  |  |  |  |  | $self->log(4, "Set returning $r"); | 
| 55 | 0 |  |  |  |  |  | return $r; | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 0 |  |  |  |  |  | $self->log(4, "Set returning CONTINUE by default"); | 
| 59 | 0 |  |  |  |  |  | return NRS_SET_CONTINUE; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | 42; | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | __END__ |