22 lines
415 B
Perl
22 lines
415 B
Perl
|
# $Id: ErrorHandler.pm,v 1.1 2005/04/15 17:37:32 bradfitz Exp $
|
||
|
|
||
|
package XML::Atom::ErrorHandler;
|
||
|
use strict;
|
||
|
|
||
|
use vars qw( $ERROR );
|
||
|
|
||
|
sub new { bless {}, shift }
|
||
|
sub error {
|
||
|
my $msg = $_[1] || '';
|
||
|
$msg .= "\n" unless $msg =~ /\n$/;
|
||
|
if (ref($_[0])) {
|
||
|
$_[0]->{_errstr} = $msg;
|
||
|
} else {
|
||
|
$ERROR = $msg;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
sub errstr { ref($_[0]) ? $_[0]->{_errstr} : $ERROR }
|
||
|
|
||
|
1;
|