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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Thu Dec 5 07:59:46 2002 UTC (21 years, 7 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +6 -3 lines
+ changed comment

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

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