diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-05-23 09:12:12 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-23 09:12:12 +0200 |
commit | c2190255f0c25118c118583c8555a9f5cecd948d (patch) | |
tree | ae66681faaaa89410bef741f2266ecb50f137ad1 /lib/WWW/Efa | |
parent | b09b7e7cdc9507f7996a8e3af18f3375cc7ddbea (diff) |
Code cleanup, remove WWW::Efa::Error stuff for now (to be reimplemented)
Diffstat (limited to 'lib/WWW/Efa')
-rw-r--r-- | lib/WWW/Efa/Error/Ambiguous.pm | 69 | ||||
-rw-r--r-- | lib/WWW/Efa/Error/Backend.pm | 60 | ||||
-rw-r--r-- | lib/WWW/Efa/Error/NoData.pm | 50 | ||||
-rw-r--r-- | lib/WWW/Efa/Error/Setup.pm | 80 |
4 files changed, 0 insertions, 259 deletions
diff --git a/lib/WWW/Efa/Error/Ambiguous.pm b/lib/WWW/Efa/Error/Ambiguous.pm deleted file mode 100644 index e738a63..0000000 --- a/lib/WWW/Efa/Error/Ambiguous.pm +++ /dev/null @@ -1,69 +0,0 @@ -package WWW::Efa::Error::Ambiguous; - -=head1 NAME - -WWW::Efa::Error::Ambiguous - WWW::Efa error, ambiguous to/from/via input - -=head1 SYNOPSIS - - use WWW::Efa::Error::Ambiguous; - - my $error = WWW::Efa::Error::Ambiguous->new( - 'name_origin', 'Bredeney', 'Bredeney Friedhof' - ); - - die $error->as_string(); - # WWW::Efa error: ambiguous input for name_origin: - # Bredeney - # Bredeney Friedhof - -=head1 DESCRIPTION - -Class for all WWW::Efa-internal errors occuring during initialization. Usually -caused by missing or invalid setup arguments. - -=cut - -use strict; -use warnings; -use 5.010; - -use base 'Exporter'; - -our @EXPORT_OK = qw{}; -our @ISA = ('WWW::Efa::Error'); - -sub new { - my ($obj, $key, @possible) = @_; - my $ref = {}; - - $ref->{'key'} = $key; - $ref->{'possible'} = \@possible; - - return bless($ref, $obj); -} - -=head1 METHODS - -=head2 $error->as_string() - -Return the error as string, can directly be displayed to the user - -=cut - -sub as_string { - my ($self) = @_; - - my $ret = sprintf( - "WWW::Efa error: ambiguous input for %s:\n", - $self->{'key'}, - ); - - foreach my $value (@{$self->{'possible'}}) { - $ret .= "\t$value\n"; - } - - return $ret; -} - -1; diff --git a/lib/WWW/Efa/Error/Backend.pm b/lib/WWW/Efa/Error/Backend.pm deleted file mode 100644 index 930fed5..0000000 --- a/lib/WWW/Efa/Error/Backend.pm +++ /dev/null @@ -1,60 +0,0 @@ -package WWW::Efa::Error::Backend; - -=head1 NAME - -WWW::Efa::Error::Backend - WWW::Efa unknown error from efa.vrr.de - -=head1 SYNOPSIS - - use WWW::Efa::Error::Backend; - - my $error = WWW::Efa::Error::Backend->new( - 'Yadda Yadda' - ); - - die $error->as_string(); - # WWW::Efa error from efa.vrr.de: - # Yadda Yadda - -=head1 DESCRIPTION - -Received an unknown error from efa.vrr.de - -=cut - -use strict; -use warnings; -use 5.010; - -use base 'Exporter'; - -our @EXPORT_OK = qw{}; -our @ISA = ('WWW::Efa::Error'); - -sub new { - my ($obj, $msg) = @_; - my $ref = {}; - - $ref->{'message'} = $msg; - - return bless($ref, $obj); -} - -=head1 METHODS - -=head2 $error->as_string() - -Return the error as string, can directly be displayed to the user - -=cut - -sub as_string { - my ($self) = @_; - - return sprintf( - "WWW::Efa error from efa.vrr.de:\n%s\n", - $self->{'message'}, - ); -} - -1; diff --git a/lib/WWW/Efa/Error/NoData.pm b/lib/WWW/Efa/Error/NoData.pm deleted file mode 100644 index e74d220..0000000 --- a/lib/WWW/Efa/Error/NoData.pm +++ /dev/null @@ -1,50 +0,0 @@ -package WWW::Efa::Error::NoData; - -=head1 NAME - -WWW::Efa::Error::NoData - WWW::Efa error, efa.vrr.de returned no data - -=head1 SYNOPSIS - - use WWW::Efa::Error::Setup; - - my $error = WWW::Efa::Error::NoData->new(); - - die $error->as_string(); - # WWW::Efa error: No data returned by efa.vrr.de - -=head1 DESCRIPTION - -efa.vrr.de returned no parsable data - -=cut - -use strict; -use warnings; -use 5.010; - -use base 'Exporter'; - -our @EXPORT_OK = qw{}; -our @ISA = ('WWW::Efa::Error'); - -sub new { - my ($obj) = @_; - my $ref = {}; - - return bless($ref, $obj); -} - -=head1 METHODS - -=head2 $error->as_string() - -Return the error as string, can directly be displayed to the user - -=cut - -sub as_string { - return "WWW::Efa error: No data returned by efa.vrr.de\n"; -} - -1; diff --git a/lib/WWW/Efa/Error/Setup.pm b/lib/WWW/Efa/Error/Setup.pm deleted file mode 100644 index 9840687..0000000 --- a/lib/WWW/Efa/Error/Setup.pm +++ /dev/null @@ -1,80 +0,0 @@ -package WWW::Efa::Error::Setup; - -=head1 NAME - -WWW::Efa::Error::Setup - WWW::Efa error, happened in ->new() - -=head1 SYNOPSIS - - use WWW::Efa::Error::Setup; - - my $error = WWW::Efa::Error::Setup->new( - 'max_interchanges', '-1', 'Must be positive' - ); - - die $error->as_string(); - # WWW::Efa setup error: Wrong arg for option max_interchanges: -1 - # Must be positive - -=head1 DESCRIPTION - -Class for all WWW::Efa-internal errors occuring during initialization. Usually -caused by missing or invalid setup arguments. - -=cut - -use strict; -use warnings; -use 5.010; - -use base 'Exporter'; - -our @EXPORT_OK = qw{}; - -sub new { - my ($obj, $key, $value, $msg) = @_; - my $ref = {}; - - $ref->{'key'} = $key; - $ref->{'value'} = $value; - $ref->{'message'} = $msg; - - return bless($ref, $obj); -} - -=head1 METHODS - -=head2 $error->as_string() - -Return the error as string, can directly be displayed to the user - -=cut - -sub as_string { - my ($self) = @_; - - return sprintf( - "WWW::Efa setup error: Wrong arg for option %s: %s\n%s\n", - @{$self}{'key', 'value', 'message'}, - ); -} - -=head2 $error->option() - -Returns the option which caused the error. - -=head2 $error->value() - -Returns the value which caused the error. - -=head2 $error->message() - -Returns a message describing what went wrong and how to fix it. - -=cut - -sub option { return $_[0]->{'key'} } -sub value { return $_[0]->{'value'} } -sub message { return $_[0]->{'message'} } - -1; |