diff options
| author | fukachan <fukachan> | 2005-05-27 01:47:04 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2005-05-27 01:47:04 +0000 |
| commit | 2192ce3ce53ec2aacd824531170199a5405ea70a (patch) | |
| tree | f51f62b0ab3c357570c012620baeb6cde45e349e /fml/lib | |
| parent | 9f7878424b1872ebcc9bc2a7908a26b85153bbe2 (diff) | |
| download | fml8-2192ce3ce53ec2aacd824531170199a5405ea70a.tar.gz fml8-2192ce3ce53ec2aacd824531170199a5405ea70a.tar.bz2 fml8-2192ce3ce53ec2aacd824531170199a5405ea70a.zip | |
use FML::Filter::ErrorStatus instead of ErrorStatus.
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Filter/ErrorStatus.pm | 147 | ||||
| -rw-r--r-- | fml/lib/FML/Filter/External.pm | 8 | ||||
| -rw-r--r-- | fml/lib/FML/Filter/Header.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/Filter/Size.pm | 10 | ||||
| -rw-r--r-- | fml/lib/FML/Filter/TextPlain.pm | 8 |
5 files changed, 165 insertions, 18 deletions
diff --git a/fml/lib/FML/Filter/ErrorStatus.pm b/fml/lib/FML/Filter/ErrorStatus.pm new file mode 100644 index 00000000..248cfd07 --- /dev/null +++ b/fml/lib/FML/Filter/ErrorStatus.pm @@ -0,0 +1,147 @@ +#-*- perl -*- +# +# Copyright (C) 2005 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML$ +# + +package FML::Filter::ErrorStatus; + +# +# XXX-TODO: we should not use FML::Filter::ErrorStatus module, is'nt it? +# XXX-TODO: FML/Config.pm +# XXX-TODO: FML/Credential.pm +# XXX-TODO: FML/Filter.pm +# XXX-TODO: FML/Filter/Header.pm +# XXX-TODO: FML/Filter/MimeComponent.pm +# XXX-TODO: FML/Filter/MimeComponent3.pm +# XXX-TODO: FML/Filter/TextPlain.pm +# XXX-TODO: File/Sequence.pm +# XXX-TODO: File/SimpleLock.pm +# + + +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK); +use Carp; + +require Exporter; +@ISA = qw(Exporter); +@EXPORT_OK = qw(errstr error error_set error_clear); + +=head1 NAME + +FML::Filter::ErrorStatus - error handling component. + +=head1 SYNOPSIS + +Use this module in your C<Something> class module like this: + + package Something; + use FML::Filter::ErrorStatus qw(errstr error error_set error_clear); + + sub xxx + { + if something errors ... + $self->error_set( why this error occurs ... ); + } + +You use C<Something> module like this. + + use Something; + $obj = new Something; + $obj->xxx(); + unless ($obj->error) { $obj->do_somting( ...); }; + +=head1 DESCRIPTION + +simple utility functions to manipulate error messages. + +=head1 METHODS + +=head2 error_set($message) + +save $message as an error message. + +=head2 error() + +return $message which is saved by C<error_set($msg)>. + +=cut + + +# Descriptions: set the error message within $self object. +# Arguments: OBJ($self) STR($mesg) +# Side Effects: update OBJ +# Return Value: STR +sub error_set +{ + my ($self, $mesg) = @_; + $self->{'_error_reason'} = $mesg if defined $mesg; +} + + +# Descriptions: get the error message. +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: STR +sub error +{ + my ($self) = @_; + return $self->{'_error_reason'} ? $self->{'_error_reason'} : undef; +} + + +# Descriptions: get the error message. +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: STR +sub errstr +{ + my ($self) = @_; + return $self->error(); +} + + +# Descriptions: clear the error message buffer. +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: STR (cleared message) +sub error_clear +{ + my ($self) = @_; + my $msg = $self->{'_error_reason'}; + undef $self->{'_error_reason'} if defined $self->{'_error_reason'}; + undef $self->{'_error_action'} if defined $self->{'_error_action'}; + return $msg; +} + + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2005 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Filter::ErrorStatus first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +FML::Filter::ErrorStatus is derived from ErrorStatus module in 2005. + +=cut + + +1; diff --git a/fml/lib/FML/Filter/External.pm b/fml/lib/FML/Filter/External.pm index e443060f..d8594724 100644 --- a/fml/lib/FML/Filter/External.pm +++ b/fml/lib/FML/Filter/External.pm @@ -1,17 +1,17 @@ #-*- perl -*- # -# Copyright (C) 2004 Ken'ichi Fukamachi +# Copyright (C) 2004,2005 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: External.pm,v 1.4 2004/07/23 15:59:05 fukachan Exp $ +# $FML: External.pm,v 1.5 2004/08/13 15:02:48 fukachan Exp $ # package FML::Filter::External; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; -use ErrorStatus qw(error_set error error_clear); +use FML::Filter::ErrorStatus qw(error_set error error_clear); =head1 NAME @@ -89,7 +89,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2004 Ken'ichi Fukamachi +Copyright (C) 2004,2005 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/fml/lib/FML/Filter/Header.pm b/fml/lib/FML/Filter/Header.pm index 557d7d9a..f9b3c201 100644 --- a/fml/lib/FML/Filter/Header.pm +++ b/fml/lib/FML/Filter/Header.pm @@ -1,17 +1,17 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Header.pm,v 1.9 2004/02/01 14:52:50 fukachan Exp $ +# $FML: Header.pm,v 1.10 2004/07/23 13:16:38 fukachan Exp $ # package FML::Filter::Header; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; -use ErrorStatus qw(error_set error error_clear); +use FML::Filter::ErrorStatus qw(error_set error error_clear); =head1 NAME @@ -22,7 +22,7 @@ FML::Filter::Header - filter based on mail header content. =head1 DESCRIPTION -C<FML::Filter::Header> is the collectoin of filter rules based on mail +C<FML::Filter::Header> is the collection of filter rules based on mail header content. =head1 METHODS @@ -175,7 +175,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/fml/lib/FML/Filter/Size.pm b/fml/lib/FML/Filter/Size.pm index 0b51435e..54d2cc3f 100644 --- a/fml/lib/FML/Filter/Size.pm +++ b/fml/lib/FML/Filter/Size.pm @@ -1,17 +1,17 @@ #-*- perl -*- # -# Copyright (C) 2003,2004 Ken'ichi Fukamachi +# Copyright (C) 2003,2004,2005 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Size.pm,v 1.9 2004/02/01 14:52:50 fukachan Exp $ +# $FML: Size.pm,v 1.10 2004/07/23 12:41:33 fukachan Exp $ # package FML::Filter::Size; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; -use ErrorStatus qw(error_set error error_clear); +use FML::Filter::ErrorStatus qw(error_set error error_clear); =head1 NAME @@ -22,7 +22,7 @@ FML::Filter::Size - filter based on mail size. =head1 DESCRIPTION -C<FML::Filter::Size> is the collectoin of filter rules based on mail +C<FML::Filter::Size> is the collection of filter rules based on mail size. =head1 METHODS @@ -285,7 +285,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2003,2004 Ken'ichi Fukamachi +Copyright (C) 2003,2004,2005 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/fml/lib/FML/Filter/TextPlain.pm b/fml/lib/FML/Filter/TextPlain.pm index 47e1945d..57ccfdeb 100644 --- a/fml/lib/FML/Filter/TextPlain.pm +++ b/fml/lib/FML/Filter/TextPlain.pm @@ -1,17 +1,17 @@ #-*- perl -*- # -# Copyright (C) 2001,2002,2003,2004 Ken'ichi Fukamachi +# Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: TextPlain.pm,v 1.10 2004/02/01 14:52:50 fukachan Exp $ +# $FML: TextPlain.pm,v 1.11 2004/07/23 12:41:56 fukachan Exp $ # package FML::Filter::TextPlain; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp; -use ErrorStatus qw(error_set error error_clear); +use FML::Filter::ErrorStatus qw(error_set error error_clear); =head1 NAME @@ -568,7 +568,7 @@ Ken'ichi Fukamachi =head1 COPYRIGHT -Copyright (C) 2001,2002,2003,2004 Ken'ichi Fukamachi +Copyright (C) 2001,2002,2003,2004,2005 Ken'ichi Fukamachi All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
