/[cvs]/nfo/perl/libs/Data/Storage/Result/Abstract.pm
ViewVC logotype

Contents of /nfo/perl/libs/Data/Storage/Result/Abstract.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Fri Nov 29 04:55:45 2002 UTC (21 years, 7 months ago) by joko
Branch: MAIN
+ initial check-in

1 ############################################
2 #
3 # $Id: Result.pm,v 1.1 2002/10/10 03:43:53 cvsjoko Exp $
4 #
5 # $Log: Result.pm,v $
6 # Revision 1.1 2002/10/10 03:43:53 cvsjoko
7 # + new
8 #
9 #
10 ############################################
11
12 package Data::Storage::Result::Abstract;
13
14 use strict;
15 use warnings;
16
17 use Data::Dumper;
18
19 # get logger instance
20 my $logger = Log::Dispatch::Config->instance;
21
22 sub new {
23 my $invocant = shift;
24 my $class = ref($invocant) || $invocant;
25 my $self = { type => $invocant, @_ };
26 bless $self, $class;
27 return $self;
28 }
29
30 sub AUTOLOAD {
31 my $self = shift;
32 our $AUTOLOAD;
33 return if $AUTOLOAD =~ m/::DESTROY$/;
34
35 # find out methodname
36 my $methodname = $AUTOLOAD;
37 $methodname =~ s/^.*:://;
38
39 # test for RESULTHANDLE
40 if (!$self->{RESULTHANDLE}) {
41 $logger->error( __PACKAGE__ . ": " . "RESULTHANDLE is undefined while trying to execute method \"$methodname\"" );
42 return;
43 }
44
45 # dispatch method-call to COREHANDLE
46 if ($self->{RESULTHANDLE}->can($methodname) || $self->{RESULTHANDLE}->can("AUTOLOAD")) {
47 #$logger->debug( __PACKAGE__ . "->" . $methodname . "(@_)" );
48 $self->{RESULTHANDLE}->$methodname(@_);
49 }
50
51 }
52
53 sub _abstract_function {
54 my $self = shift;
55 my $fName = shift;
56 my $class = ref($self);
57 $logger->error( __PACKAGE__ . ": function \"$fName\" is an abstract method, please implement it in \"$class\"");
58 #exit;
59 }
60
61 # ====================================================
62 # CONCRETE METHOD DUMMIES (croaking via "$logger" by calling "_abstract_function")
63 # ====================================================
64
65 sub getNextEntry {
66 my $self = shift;
67 $self->_abstract_function('getNextEntry');
68 }
69
70 sub getStatus {
71 my $self = shift;
72 $self->_abstract_function('getStatus');
73 }
74
75 1;

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed