| 1 | # WWW::Auth::Base | ||
| 2 | # | ||
| 3 | # Copyright (c) 2002 Jonathan A. Waxman <jowaxman@law.upenn.edu> | ||
| 4 | # All rights reserved. | ||
| 5 | # | ||
| 6 | # This program is free software; you can redistribute it and/or | ||
| 7 | # modify it under the same terms as Perl itself. | ||
| 8 | |||
| 9 | |||
| 10 | package WWW::Auth::Base; | ||
| 11 | |||
| 12 | |||
| 13 | use strict; | ||
| 14 | |||
| 15 | |||
| 16 | sub new { | ||
| 17 | my $proto = shift; | ||
| 18 | my %params = @_; | ||
| 19 | |||
| 20 | my $class = ref ($proto) || $proto; | ||
| 21 | my $self = {}; | ||
| 22 | bless ($self, $class); | ||
| 23 | |||
| 24 | return $self->_init (%params) ? $self : $proto->error ($self->error); | ||
| 25 | } | ||
| 26 | |||
| 27 | sub _init { | ||
| 28 | my $self = shift; | ||
| 29 | my %params = @_; | ||
| 30 | |||
| 31 | return 1; | ||
| 32 | } | ||
| 33 | |||
| 34 | sub error { | ||
| 35 | my $self = shift; | ||
| 36 | my $error = shift; | ||
| 37 | |||
| 38 | # If an error given, set it in the object or package. | ||
| 39 | # Otherwise, return the error from the object or package. | ||
| 40 | if (defined $error) { | ||
| 41 | ref ($self) ? $self->{_error} = $error : $self::_error = $error; | ||
| 42 | return undef; | ||
| 43 | } else { | ||
| 44 | return ref ($self) ? $self->{_error} : $self::_error; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | 1; |