summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/FML/Lock.pm10
-rw-r--r--fml/lib/FML/SequenceFile.pm19
-rw-r--r--fml/lib/IO/MapAdapter.pm30
-rw-r--r--fml/lib/Netlib/INET4.pm4
-rw-r--r--fml/lib/Netlib/SMTP.pm4
-rw-r--r--fml/lib/Netlib/Utils.pm6
6 files changed, 30 insertions, 43 deletions
diff --git a/fml/lib/FML/Lock.pm b/fml/lib/FML/Lock.pm
index f627c4c4..221c69b4 100644
--- a/fml/lib/FML/Lock.pm
+++ b/fml/lib/FML/Lock.pm
@@ -13,7 +13,7 @@ use strict;
use Carp;
require Exporter;
-@ISA = qw(Exporter);
+@ISA = qw(Exporter);
# constants
@@ -33,7 +33,7 @@ sub new
}
-sub _error_why
+sub _error_reason
{
my $msg = @_;
$Error = $msg;
@@ -80,7 +80,7 @@ sub _simple_flock
eval q{
$r = flock($fh, &LOCK_EX);
};
- _error_why($@) if $@;
+ _error_reason($@) if $@;
if ($r) {
$FileIsLocked{ $file } = 1;
@@ -88,7 +88,7 @@ sub _simple_flock
}
}
else {
- _error_why("cannot open $file");
+ _error_reason("cannot open $file");
}
return 0;
@@ -108,7 +108,7 @@ sub _simple_funlock
eval q{
$r = flock($fh, &LOCK_UN);
};
- _error_why($@) if $@;
+ _error_reason($@) if $@;
if ($r) {
delete $FileIsLocked{ $file };
diff --git a/fml/lib/FML/SequenceFile.pm b/fml/lib/FML/SequenceFile.pm
index dc90a48f..72329f7c 100644
--- a/fml/lib/FML/SequenceFile.pm
+++ b/fml/lib/FML/SequenceFile.pm
@@ -12,6 +12,7 @@ package FML::SequenceFile;
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK);
use Carp;
+use Base::Errors qw(error_reason error error_reset);
require Exporter;
@ISA = qw(Exporter);
@@ -34,7 +35,7 @@ sub increment_id
my $seq_file = $file || $self->{ _sequence_file };
unless ($seq_file) {
- $self->error_is_why("the sequence file is not specified");
+ $self->error_reason("the sequence file is not specified");
return 0;
};
@@ -55,7 +56,7 @@ sub increment_id
$rh->close;
}
else {
- $self->error_is_why("cannot open the sequence file");
+ $self->error_reason("cannot open the sequence file");
return 0;
}
@@ -70,20 +71,6 @@ sub increment_id
}
-sub error
-{
- my ($self) = @_;
- return $self->{ _error };
-}
-
-
-sub error_is_why
-{
- my ($self, $msg) = @_;
- $self->{ _error } = $msg;
-}
-
-
=head1 NAME
FML::SequenceFile.pm - what is this
diff --git a/fml/lib/IO/MapAdapter.pm b/fml/lib/IO/MapAdapter.pm
index 184b0e51..915b65fa 100644
--- a/fml/lib/IO/MapAdapter.pm
+++ b/fml/lib/IO/MapAdapter.pm
@@ -25,7 +25,7 @@ sub new
if ( ref($args) eq 'CODE' ) {
$me->{_type} = 'array_on_memory';
eval { &$args($me);};
- _log($me, $@) if $@;
+ _error_reason($me, $@) if $@;
}
else {
if ($args =~ /file:(\S+)/ || $args =~ m@^(/\S+)@) {
@@ -46,7 +46,7 @@ sub new
else {
my $s = "IO::MapAdapter::new: args='$args' is unknown.";
print STDERR $s, "\n";
- _log($me, $s);
+ _error_reason($me, $s);
}
}
@@ -54,17 +54,17 @@ sub new
}
-sub _log
+sub _error_reason
{
my ($self, $mesg) = @_;
- $self->{ _error } = $mesg;
+ $self->{ _error_reason } = $mesg;
}
sub error
{
my ($self) = @_;
- return $self->{ _error };
+ return $self->{ _error_reason };
}
@@ -94,7 +94,7 @@ sub open
return $fh;
}
else {
- $self->_log("Error: cannot open $file $flag");
+ $self->_error_reason("Error: cannot open $file $flag");
return undef;
}
}
@@ -121,7 +121,7 @@ sub open
return undef;
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
@@ -180,11 +180,11 @@ sub _get_address
$self->{'_type'} eq 'mysql' ||
$self->{'_type'} eq 'postgresql'
) {
- $self->_log("Error: not yet implemented");
+ $self->_error_reason("Error: not yet implemented");
return undef;
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
@@ -207,11 +207,11 @@ sub getline
$self->{'_type'} eq 'mysql' ||
$self->{'_type'} eq 'postgresql'
) {
- $self->_log("Error: not yet implemented");
+ $self->_error_reason("Error: not yet implemented");
return undef;
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
@@ -231,7 +231,7 @@ sub getpos
$self->{_counter};
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
@@ -251,7 +251,7 @@ sub setpos
$self->{_counter} = $pos;
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
@@ -271,7 +271,7 @@ sub eof
$self->{_counter} > $self->{_num_members} ? 1 : 0;
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
@@ -290,7 +290,7 @@ sub close
;
}
else {
- $self->_log("Error: type=$self->{_type} is unknown type.");
+ $self->_error_reason("Error: type=$self->{_type} is unknown type.");
}
}
diff --git a/fml/lib/Netlib/INET4.pm b/fml/lib/Netlib/INET4.pm
index ec6e8006..ce66b0f0 100644
--- a/fml/lib/Netlib/INET4.pm
+++ b/fml/lib/Netlib/INET4.pm
@@ -33,7 +33,7 @@ sub _connect4
};
if ($@) {
Log("Error: cannot make socket for $mta");
- $self->_error_why("Error: cannot make socket: $@");
+ $self->_error_reason("Error: cannot make socket: $@");
return undef;
}
@@ -45,7 +45,7 @@ sub _connect4
}
else {
Log("(debug) error. fail to connect $mta");
- $self->_error_why("Error: cannot open socket: $!");
+ $self->_error_reason("Error: cannot open socket: $!");
return undef;
}
}
diff --git a/fml/lib/Netlib/SMTP.pm b/fml/lib/Netlib/SMTP.pm
index a077ef9d..c378be96 100644
--- a/fml/lib/Netlib/SMTP.pm
+++ b/fml/lib/Netlib/SMTP.pm
@@ -193,7 +193,7 @@ sub _read_reply
if ($@ =~ /$id socket timeout/) {
my $x = $self->{'_last_command'};
Log("Error: smtp reply for \"$x\" is timeout");
- $self->_error_why("Error: smtp reply for \"$x\" is timeout");
+ $self->_error_reason("Error: smtp reply for \"$x\" is timeout");
}
}
@@ -573,7 +573,7 @@ sub _send_recipient_list_by_recipient_map
my $recipient_limit = $self->{_recipient_limit};
$obj->open || do {
- $self->_error_why( $obj->error );
+ $self->_error_reason( $obj->error );
return undef;
};
diff --git a/fml/lib/Netlib/Utils.pm b/fml/lib/Netlib/Utils.pm
index facda455..5bee5a3a 100644
--- a/fml/lib/Netlib/Utils.pm
+++ b/fml/lib/Netlib/Utils.pm
@@ -24,7 +24,7 @@ require Exporter;
$LogFunctionPointer
$SmtpLogFunctionPointer
- _error_why
+ _error_reason
error
error_reset
@@ -81,7 +81,7 @@ sub _smtplog
}
-sub _error_why
+sub _error_reason
{
my ($self, $mesg) = @_;
$self->{'_error_reason'} = $mesg;
@@ -91,7 +91,7 @@ sub _error_why
sub error_reason
{
my ($self, $mesg) = @_;
- $self->_error_why($mesg);
+ $self->_error_reason($mesg);
}