diff options
Diffstat (limited to 'perl')
| -rw-r--r-- | perl/Wallet/Kadmin.pm | 35 | ||||
| -rw-r--r-- | perl/Wallet/Kadmin/Heimdal.pm | 12 | ||||
| -rw-r--r-- | perl/Wallet/Kadmin/MIT.pm | 12 | 
3 files changed, 30 insertions, 29 deletions
| diff --git a/perl/Wallet/Kadmin.pm b/perl/Wallet/Kadmin.pm index 65adc83..78b72cd 100644 --- a/perl/Wallet/Kadmin.pm +++ b/perl/Wallet/Kadmin.pm @@ -26,11 +26,6 @@ $VERSION = '0.03';  # Public methods  ############################################################################## -# Set a callback to be called for forked kadmin processes.  This does nothing -# by default but may be overridden by subclasses that need special behavior -# (such as the current Wallet::Kadmin::MIT module). -sub fork_callback { } -  # Create a new kadmin object, by finding the type requested in the wallet  # config and passing off to the proper module.  Returns the object directly  # from the specific Wallet::Kadmin::* module. @@ -53,6 +48,23 @@ sub new {      return $kadmin;  } +# Set or return the error stashed in the object. +sub error { +    my ($self, @error) = @_; +    if (@error) { +        my $error = join ('', @error); +        chomp $error; +        1 while ($error =~ s/ at \S+ line \d+\.?\z//); +        $self->{error} = $error; +    } +    return $self->{error}; +} + +# Set a callback to be called for forked kadmin processes.  This does nothing +# by default but may be overridden by subclasses that need special behavior +# (such as the current Wallet::Kadmin::MIT module). +sub fork_callback { } +  1;  __END__ @@ -112,6 +124,19 @@ implementation is not recognized or set, die with an error message.  =over 4 +=item error([ERROR ...]) + +Returns the error of the last failing operation or undef if no operations +have failed.  Callers should call this function to get the error message +after an undef return from any other instance method. + +For the convenience of child classes, this method can also be called with +one or more error strings.  If so, those strings are concatenated +together, trailing newlines are removed, any text of the form S<C< at \S+ +line \d+\.?>> at the end of the message is stripped off, and the result is +stored as the error.  Only child classes should call this method with an +error string. +  =item fork_callback(CALLBACK)  If the module has to fork an external process for some reason, such as a diff --git a/perl/Wallet/Kadmin/Heimdal.pm b/perl/Wallet/Kadmin/Heimdal.pm index 30b1e52..3047b2f 100644 --- a/perl/Wallet/Kadmin/Heimdal.pm +++ b/perl/Wallet/Kadmin/Heimdal.pm @@ -30,18 +30,6 @@ $VERSION = '0.03';  # Utility functions  ############################################################################## -# Set or return the error stashed in the object. -sub error { -    my ($self, @error) = @_; -    if (@error) { -        my $error = join ('', @error); -        chomp $error; -        1 while ($error =~ s/ at \S+ line \d+\.?\z//); -        $self->{error} = $error; -    } -    return $self->{error}; -} -  # Add the realm to the end of the principal if no realm is currently present.  sub canonicalize_principal {      my ($self, $principal) = @_; diff --git a/perl/Wallet/Kadmin/MIT.pm b/perl/Wallet/Kadmin/MIT.pm index a7ccf99..9dc101e 100644 --- a/perl/Wallet/Kadmin/MIT.pm +++ b/perl/Wallet/Kadmin/MIT.pm @@ -31,18 +31,6 @@ $VERSION = '0.02';  # Utility functions  ############################################################################## -# Set or return the error stashed in the object. -sub error { -    my ($self, @error) = @_; -    if (@error) { -        my $error = join ('', @error); -        chomp $error; -        1 while ($error =~ s/ at \S+ line \d+\.?\z//); -        $self->{error} = $error; -    } -    return $self->{error}; -} -  # Set a callback to be called for forked kadmin processes.  sub fork_callback {      my ($self, $callback) = @_; | 
