Allow falling back to any strigified Bio::AnnotationI for 'gene_name'
[bioperl-live.git] / Bio / Root / RootI.pm
blobecd6ccab5372621449c15314e7475952de6e2be4
2 # BioPerl module for Bio::Root::RootI
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Ewan Birney <birney@ebi.ac.uk>
8 # Copyright Ewan Birney
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 # This was refactored to have chained calls to new instead
15 # of chained calls to _initialize
17 # added debug and deprecated methods --Jason Stajich 2001-10-12
20 =head1 NAME
22 Bio::Root::RootI - Abstract interface to root object code
24 =head1 SYNOPSIS
26 # any bioperl or bioperl compliant object is a RootI
27 # compliant object
29 $obj->throw("This is an exception");
31 eval {
32 $obj->throw("This is catching an exception");
35 if( $@ ) {
36 print "Caught exception";
37 } else {
38 print "no exception";
41 # Using throw_not_implemented() within a RootI-based interface module:
43 package Foo;
44 use base qw(Bio::Root::RootI);
46 sub foo {
47 my $self = shift;
48 $self->throw_not_implemented;
52 =head1 DESCRIPTION
54 This is just a set of methods which do not assume B<anything> about the object
55 they are on. The methods provide the ability to throw exceptions with nice
56 stack traces.
58 This is what should be inherited by all Bioperl compliant interfaces, even
59 if they are exotic XS/CORBA/Other perl systems.
61 =head2 Using throw_not_implemented()
63 The method L<throw_not_implemented()|throw_not_implemented> should be
64 called by all methods within interface modules that extend RootI so
65 that if an implementation fails to override them, an exception will be
66 thrown.
68 For example, say there is an interface module called C<FooI> that
69 provides a method called C<foo()>. Since this method is considered
70 abstract within FooI and should be implemented by any module claiming to
71 implement C<FooI>, the C<FooI::foo()> method should consist of the
72 following:
74 sub foo {
75 my $self = shift;
76 $self->throw_not_implemented;
79 So, if an implementer of C<FooI> forgets to implement C<foo()>
80 and a user of the implementation calls C<foo()>, a
81 L<Bio::Exception::NotImplemented> exception will result.
83 Unfortunately, failure to implement a method can only be determined at
84 run time (i.e., you can't verify that an implementation is complete by
85 running C<perl -wc> on it). So it should be standard practice for a test
86 of an implementation to check each method and verify that it doesn't
87 throw a L<Bio::Exception::NotImplemented>.
89 =head1 CONTACT
91 Functions originally from Steve Chervitz. Refactored by Ewan
92 Birney. Re-refactored by Lincoln Stein. Added to by Sendu Bala.
94 =head1 APPENDIX
96 The rest of the documentation details each of the object
97 methods. Internal methods are usually preceded with a _
99 =cut
101 # Let the code begin...
103 package Bio::Root::RootI;
105 use vars qw($DEBUG $ID $VERBOSITY);
106 use strict;
107 use Carp 'confess','carp';
109 use Bio::Root::Version;
111 BEGIN {
112 $ID = 'Bio::Root::RootI';
113 $DEBUG = 0;
114 $VERBOSITY = 0;
117 sub new {
118 my $class = shift;
119 my @args = @_;
120 unless ( $ENV{'BIOPERLDEBUG'} ) {
121 carp("Use of new in Bio::Root::RootI is deprecated. Please use Bio::Root::Root instead");
123 eval "require Bio::Root::Root";
124 return Bio::Root::Root->new(@args);
127 # for backwards compatibility
128 sub _initialize {
129 my($self,@args) = @_;
130 return 1;
134 =head2 throw
136 Title : throw
137 Usage : $obj->throw("throwing exception message")
138 Function: Throws an exception, which, if not caught with an eval brace
139 will provide a nice stack trace to STDERR with the message
140 Returns : nothing
141 Args : A string giving a descriptive error message
144 =cut
146 sub throw{
147 my ($self,$string) = @_;
149 my $std = $self->stack_trace_dump();
151 my $out = "\n-------------------- EXCEPTION --------------------\n".
152 "MSG: ".$string."\n".$std."-------------------------------------------\n";
153 die $out;
157 =head2 warn
159 Title : warn
160 Usage : $object->warn("Warning message");
161 Function: Places a warning. What happens now is down to the
162 verbosity of the object (value of $obj->verbose)
163 verbosity 0 or not set => small warning
164 verbosity -1 => no warning
165 verbosity 1 => warning with stack trace
166 verbosity 2 => converts warnings into throw
167 Returns : n/a
168 Args : string (the warning message)
170 =cut
172 sub warn {
173 my ($self,$string) = @_;
175 my $verbose = $self->verbose;
177 my $header = "\n--------------------- WARNING ---------------------\nMSG: ";
178 my $footer = "---------------------------------------------------\n";
180 if ($verbose >= 2) {
181 $self->throw($string);
183 elsif ($verbose <= -1) {
184 return;
186 elsif ($verbose == 1) {
187 CORE::warn $header, $string, "\n", $self->stack_trace_dump, $footer;
188 return;
191 CORE::warn $header, $string, "\n", $footer;
194 =head2 deprecated
196 Title : deprecated
197 Usage : $obj->deprecated("Method X is deprecated");
198 $obj->deprecated("Method X is deprecated", 1.007);
199 $obj->deprecated(-message => "Method X is deprecated");
200 $obj->deprecated(-message => "Method X is deprecated",
201 -version => 1.007);
202 Function: Prints a message about deprecation unless verbose is < 0
203 (which means be quiet)
204 Returns : none
205 Args : Message string to print to STDERR
206 Version of BioPerl where use of the method results in an exception
207 Notes : The method can be called two ways, either by positional arguments:
209 $obj->deprecated('This module is deprecated', 1.006);
211 or by named arguments:
213 $obj->deprecated(
214 -message => 'use of the method foo() is deprecated, use bar() instead',
215 -version => 1.006 # throw if $VERSION is >= this version
218 or timed to go off at a certain point:
220 $obj->deprecated(
221 -message => 'use of the method foo() is deprecated, use bar() instead',
222 -warn_version => 1.006 # warn if $VERSION is >= this version
223 -throw_version => 1.007 # throw if $VERSION is >= this version
226 Using the last two named argument versions is suggested and will
227 likely be the only supported way of calling this method in the future
228 Yes, we see the irony of deprecating that particular usage of
229 deprecated().
231 The main difference between usage of the two named argument versions
232 is that by designating a 'warn_version' one indicates the
233 functionality is officially deprecated beginning in a future version
234 of BioPerl (so warnings are issued only after that point), whereas
235 setting either 'version' or 'throw_version' (synonyms) converts the
236 deprecation warning to an exception.
238 For proper comparisons one must use a version in lines with the
239 current versioning scheme for Perl and BioPerl, (i.e. where 1.006000
240 indicates v1.6.0, 5.010000 for v5.10.0, etc.).
242 =cut
244 sub deprecated{
245 my ($self) = shift;
246 my ($msg, $version, $warn_version, $throw_version) =
247 $self->_rearrange([qw(MESSAGE VERSION WARN_VERSION THROW_VERSION)], @_);
248 $version ||= $throw_version;
249 for my $v ($warn_version, $version) {
250 next unless defined $v;
251 $self->throw('Version must be numerical, such as 1.006000 for v1.6.0, not '.
252 $v) unless $v =~ /^\d+\.\d+$/;
254 return if ($warn_version && $Bio::Root::Version::VERSION < $warn_version);
255 # below default insinuates we're deprecating a method and not a full module
256 # but it's the most common use case
257 $msg ||= "Use of ".(caller(1))[3]."() is deprecated";
258 # delegate to either warn or throw based on whether a version is given
259 if ($version) {
260 $msg .= "\nTo be removed in $version";
261 if ($Bio::Root::Version::VERSION >= $version) {
262 $self->throw($msg)
265 # passing this on to warn() should deal properly with verbosity issues
266 $self->warn($msg);
269 =head2 stack_trace_dump
271 Title : stack_trace_dump
272 Usage :
273 Function:
274 Example :
275 Returns :
276 Args :
279 =cut
281 sub stack_trace_dump{
282 my ($self) = @_;
284 my @stack = $self->stack_trace();
286 shift @stack;
287 shift @stack;
288 shift @stack;
290 my $out;
291 my ($module,$function,$file,$position);
294 foreach my $stack ( @stack) {
295 ($module,$file,$position,$function) = @{$stack};
296 $out .= "STACK $function $file:$position\n";
299 return $out;
303 =head2 stack_trace
305 Title : stack_trace
306 Usage : @stack_array_ref= $self->stack_trace
307 Function: gives an array to a reference of arrays with stack trace info
308 each coming from the caller(stack_number) call
309 Returns : array containing a reference of arrays
310 Args : none
313 =cut
315 sub stack_trace{
316 my ($self) = @_;
318 my $i = 0;
319 my @out = ();
320 my $prev = [];
321 while( my @call = caller($i++)) {
322 # major annoyance that caller puts caller context as
323 # function name. Hence some monkeying around...
324 $prev->[3] = $call[3];
325 push(@out,$prev);
326 $prev = \@call;
328 $prev->[3] = 'toplevel';
329 push(@out,$prev);
330 return @out;
334 =head2 _rearrange
336 Usage : $object->_rearrange( array_ref, list_of_arguments)
337 Purpose : Rearranges named parameters to requested order.
338 Example : $self->_rearrange([qw(SEQUENCE ID DESC)],@param);
339 : Where @param = (-sequence => $s,
340 : -desc => $d,
341 : -id => $i);
342 Returns : @params - an array of parameters in the requested order.
343 : The above example would return ($s, $i, $d).
344 : Unspecified parameters will return undef. For example, if
345 : @param = (-sequence => $s);
346 : the above _rearrange call would return ($s, undef, undef)
347 Argument : $order : a reference to an array which describes the desired
348 : order of the named parameters.
349 : @param : an array of parameters, either as a list (in
350 : which case the function simply returns the list),
351 : or as an associative array with hyphenated tags
352 : (in which case the function sorts the values
353 : according to @{$order} and returns that new array.)
354 : The tags can be upper, lower, or mixed case
355 : but they must start with a hyphen (at least the
356 : first one should be hyphenated.)
357 Source : This function was taken from CGI.pm, written by Dr. Lincoln
358 : Stein, and adapted for use in Bio::Seq by Richard Resnick and
359 : then adapted for use in Bio::Root::Object.pm by Steve Chervitz,
360 : then migrated into Bio::Root::RootI.pm by Ewan Birney.
361 Comments :
362 : Uppercase tags are the norm,
363 : (SAC)
364 : This method may not be appropriate for method calls that are
365 : within in an inner loop if efficiency is a concern.
367 : Parameters can be specified using any of these formats:
368 : @param = (-name=>'me', -color=>'blue');
369 : @param = (-NAME=>'me', -COLOR=>'blue');
370 : @param = (-Name=>'me', -Color=>'blue');
371 : @param = ('me', 'blue');
372 : A leading hyphenated argument is used by this function to
373 : indicate that named parameters are being used.
374 : Therefore, the ('me', 'blue') list will be returned as-is.
376 : Note that Perl will confuse unquoted, hyphenated tags as
377 : function calls if there is a function of the same name
378 : in the current namespace:
379 : -name => 'foo' is interpreted as -&name => 'foo'
381 : For ultimate safety, put single quotes around the tag:
382 : ('-name'=>'me', '-color' =>'blue');
383 : This can be a bit cumbersome and I find not as readable
384 : as using all uppercase, which is also fairly safe:
385 : (-NAME=>'me', -COLOR =>'blue');
387 : Personal note (SAC): I have found all uppercase tags to
388 : be more managable: it involves less single-quoting,
389 : the key names stand out better, and there are no method naming
390 : conflicts.
391 : The drawbacks are that it's not as easy to type as lowercase,
392 : and lots of uppercase can be hard to read.
394 : Regardless of the style, it greatly helps to line
395 : the parameters up vertically for long/complex lists.
397 : Note that if @param is a single string that happens to start with
398 : a dash, it will be treated as a hash key and probably fail to
399 : match anything in the array_ref, so not be returned as normally
400 : happens when @param is a simple list and not an associative array.
402 =cut
404 sub _rearrange {
405 shift; #discard self
406 my $order = shift;
408 return @_ unless $_[0] && $_[0] =~ /^\-/;
410 push @_, undef unless $#_ % 2;
412 my %param;
413 for( my $i = 0; $i < @_; $i += 2 ) {
414 (my $key = $_[$i]) =~ tr/a-z\055/A-Z/d; #deletes all dashes!
415 $param{$key} = $_[$i+1];
417 return @param{map uc, @$order};
420 =head2 _set_from_args
422 Usage : $object->_set_from_args(\%args, -methods => \@methods)
423 Purpose : Takes a hash of user-supplied args whose keys match method names,
424 : and calls the method supplying it the corresponding value.
425 Example : $self->_set_from_args(\%args, -methods => [qw(sequence id desc)]);
426 : Where %args = (-sequence => $s,
427 : -description => $d,
428 : -ID => $i);
430 : the above _set_from_args calls the following methods:
431 : $self->sequence($s);
432 : $self->id($i);
433 : ( $self->description($i) is not called because 'description' wasn't
434 : one of the given methods )
435 Argument : \%args | \@args : a hash ref or associative array ref of arguments
436 : where keys are any-case strings corresponding to
437 : method names but optionally prefixed with
438 : hyphens, and values are the values the method
439 : should be supplied. If keys contain internal
440 : hyphens (eg. to separate multi-word args) they
441 : are converted to underscores, since method names
442 : cannot contain dashes.
443 : -methods => [] : (optional) only call methods with names in this
444 : array ref. Can instead supply a hash ref where
445 : keys are method names (of real existing methods
446 : unless -create is in effect) and values are array
447 : refs of synonyms to allow access to the method
448 : using synonyms. If there is only one synonym it
449 : can be supplied as a string instead of a single-
450 : element array ref
451 : -force => bool : (optional, default 0) call methods that don't
452 : seem to exist, ie. let AUTOLOAD handle them
453 : -create => bool : (optional, default 0) when a method doesn't
454 : exist, create it as a simple getter/setter
455 : (combined with -methods it would create all the
456 : supplied methods that didn't exist, even if not
457 : mentioned in the supplied %args)
458 : -code => '' | {}: (optional) when creating methods use the supplied
459 : code (a string which will be evaulated as a sub).
460 : The default code is a simple get/setter.
461 : Alternatively you can supply a hash ref where
462 : the keys are method names and the values are
463 : code strings. The variable '$method' will be
464 : available at evaluation time, so can be used in
465 : your code strings. Beware that the strict pragma
466 : will be in effect.
467 : -case_sensitive => bool : require case sensitivity on the part of
468 : user (ie. a() and A() are two different
469 : methods and the user must be careful
470 : which they use).
471 Comments :
472 : The \%args argument will usually be the args received during new()
473 : from the user. The user is allowed to get the case wrong, include
474 : 0 or more than one hyphens as a prefix, and to include hyphens as
475 : multi-word arg separators: '--an-arg' => 1, -an_arg => 1 and
476 : An_Arg => 1 are all equivalent, calling an_arg(1). However, in
477 : documentation users should only be told to use the standard form
478 : -an_arg to avoid confusion. A possible exception to this is a
479 : wrapper module where '--an-arg' is what the user is used to
480 : supplying to the program being wrapped.
482 : Another issue with wrapper modules is that there may be an
483 : argument that has meaning both to Bioperl and to the program, eg.
484 : -verbose. The recommended way of dealing with this is to leave
485 : -verbose to set the Bioperl verbosity whilst requesting users use
486 : an invented -program_verbose (or similar) to set the program
487 : verbosity. This can be resolved back with
488 : Bio::Tools::Run::WrapperBase's _setparams() method and code along
489 : the lines of:
490 : my %methods = map { $_ => $_ } @LIST_OF_ALL_ALLOWED_PROGRAM_ARGS
491 : delete $methods{'verbose'};
492 : $methods{'program_verbose'} = 'verbose';
493 : my $param_string = $self->_setparams(-methods => \%methods);
494 : system("$exe $param_string");
496 =cut
498 sub _set_from_args {
499 my ($self, $args, @own_args) = @_;
500 $self->throw("a hash/array ref of arguments must be supplied") unless ref($args);
502 my ($methods, $force, $create, $code, $case);
503 if (@own_args) {
504 ($methods, $force, $create, $code, $case) =
505 $self->_rearrange([qw(METHODS
506 FORCE
507 CREATE
508 CODE
509 CASE_SENSITIVE)], @own_args);
511 my $default_code = 'my $self = shift;
512 if (@_) { $self->{\'_\'.$method} = shift }
513 return $self->{\'_\'.$method};';
515 my %method_names = ();
516 my %syns = ();
517 if ($methods) {
518 my @names;
519 if (ref($methods) eq 'HASH') {
520 @names = keys %{$methods};
521 %syns = %{$methods};
523 else {
524 @names = @{$methods};
525 %syns = map { $_ => $_ } @names;
527 %method_names = map { $case ? $_ : lc($_) => $_ } @names;
530 # deal with hyphens
531 my %orig_args = ref($args) eq 'HASH' ? %{$args} : @{$args};
532 my %args;
533 while (my ($method, $value) = each %orig_args) {
534 $method =~ s/^-+//;
535 $method =~ s/-/_/g;
536 $args{$method} = $value;
539 # create non-existing methods on request
540 if ($create) {
541 unless ($methods) {
542 %syns = map { $_ => $case ? $_ : lc($_) } keys %args;
545 foreach my $method (keys %syns) {
546 $self->can($method) && next;
548 my $string = $code || $default_code;
549 if (ref($code) && ref($code) eq 'HASH') {
550 $string = $code->{$method} || $default_code;
553 my $sub = eval "sub { $string }";
554 $self->throw("Compilation error for $method : $@") if $@;
556 no strict 'refs';
557 *{ref($self).'::'.$method} = $sub;
561 # create synonyms of existing methods
562 while (my ($method, $syn_ref) = each %syns) {
563 my $method_ref = $self->can($method) || next;
565 foreach my $syn (@{ ref($syn_ref) ? $syn_ref : [$syn_ref] }) {
566 next if $syn eq $method;
567 $method_names{$case ? $syn : lc($syn)} = $syn;
568 next if $self->can($syn);
569 no strict 'refs';
570 *{ref($self).'::'.$syn} = $method_ref;
574 # set values for methods
575 while (my ($method, $value) = each %args) {
576 $method = $method_names{$case ? $method : lc($method)} || ($methods ? next : $method);
577 $self->can($method) || next unless $force;
578 $self->$method($value);
582 #----------------'
583 sub _rearrange_old {
584 #----------------
585 my($self,$order,@param) = @_;
587 # JGRG -- This is wrong, because we don't want
588 # to assign empty string to anything, and this
589 # code is actually returning an array 1 less
590 # than the length of @param:
592 ## If there are no parameters, we simply wish to return
593 ## an empty array which is the size of the @{$order} array.
594 #return ('') x $#{$order} unless @param;
596 # ...all we need to do is return an empty array:
597 # return unless @param;
599 # If we've got parameters, we need to check to see whether
600 # they are named or simply listed. If they are listed, we
601 # can just return them.
603 # The mod test fixes bug where a single string parameter beginning with '-' gets lost.
604 # This tends to happen in error messages such as: $obj->throw("-id not defined")
605 return @param unless (defined($param[0]) && $param[0]=~/^-/o && ($#param % 2));
607 # Tester
608 # print "\n_rearrange() named parameters:\n";
609 # my $i; for ($i=0;$i<@param;$i+=2) { printf "%20s => %s\n", $param[$i],$param[$i+1]; }; <STDIN>;
611 # Now we've got to do some work on the named parameters.
612 # The next few lines strip out the '-' characters which
613 # preceed the keys, and capitalizes them.
614 for (my $i=0;$i<@param;$i+=2) {
615 $param[$i]=~s/^\-//;
616 $param[$i]=~tr/a-z/A-Z/;
619 # Now we'll convert the @params variable into an associative array.
620 # local($^W) = 0; # prevent "odd number of elements" warning with -w.
621 my(%param) = @param;
623 # my(@return_array);
625 # What we intend to do is loop through the @{$order} variable,
626 # and for each value, we use that as a key into our associative
627 # array, pushing the value at that key onto our return array.
628 # my($key);
630 #foreach (@{$order}) {
631 # my($value) = $param{$key};
632 # delete $param{$key};
633 #push(@return_array,$param{$_});
636 return @param{@{$order}};
638 # print "\n_rearrange() after processing:\n";
639 # my $i; for ($i=0;$i<@return_array;$i++) { printf "%20s => %s\n", ${$order}[$i], $return_array[$i]; } <STDIN>;
641 # return @return_array;
644 =head2 _register_for_cleanup
646 Title : _register_for_cleanup
647 Usage : -- internal --
648 Function: Register a method to be called at DESTROY time. This is useful
649 and sometimes essential in the case of multiple inheritance for
650 classes coming second in the sequence of inheritance.
651 Returns :
652 Args : a code reference
654 The code reference will be invoked with the object as the first
655 argument, as per a method. You may register an unlimited number of
656 cleanup methods.
658 =cut
660 sub _register_for_cleanup {
661 my ($self,$method) = @_;
662 $self->throw_not_implemented();
665 =head2 _unregister_for_cleanup
667 Title : _unregister_for_cleanup
668 Usage : -- internal --
669 Function: Remove a method that has previously been registered to be called
670 at DESTROY time. If called with a method to be called at DESTROY time.
671 Has no effect if the code reference has not previously been registered.
672 Returns : nothing
673 Args : a code reference
675 =cut
677 sub _unregister_for_cleanup {
678 my ($self,$method) = @_;
679 $self->throw_not_implemented();
682 =head2 _cleanup_methods
684 Title : _cleanup_methods
685 Usage : -- internal --
686 Function: Return current list of registered cleanup methods.
687 Returns : list of coderefs
688 Args : none
690 =cut
692 sub _cleanup_methods {
693 my $self = shift;
694 unless ( $ENV{'BIOPERLDEBUG'} || $self->verbose > 0 ) {
695 carp("Use of Bio::Root::RootI is deprecated. Please use Bio::Root::Root instead");
697 return;
700 =head2 throw_not_implemented
702 Purpose : Throws a Bio::Root::NotImplemented exception.
703 Intended for use in the method definitions of
704 abstract interface modules where methods are defined
705 but are intended to be overridden by subclasses.
706 Usage : $object->throw_not_implemented();
707 Example : sub method_foo {
708 $self = shift;
709 $self->throw_not_implemented();
711 Returns : n/a
712 Args : n/a
713 Throws : A Bio::Root::NotImplemented exception.
714 The message of the exception contains
715 - the name of the method
716 - the name of the interface
717 - the name of the implementing class
719 If this object has a throw() method, $self->throw will be used.
720 If the object doesn't have a throw() method,
721 Carp::confess() will be used.
724 =cut
728 sub throw_not_implemented {
729 my $self = shift;
731 # Bio::Root::Root::throw() knows how to check for Error.pm and will
732 # throw an Error-derived object of the specified class (Bio::Root::NotImplemented),
733 # which is defined in Bio::Root::Exception.
734 # If Error.pm is not available, the name of the class is just included in the
735 # error message.
737 my $message = $self->_not_implemented_msg;
739 if ( $self->can('throw') ) {
740 my @args;
741 if ( $self->isa('Bio::Root::Root') ) {
742 # Use Root::throw() hash-based arguments instead of RootI::throw()
743 # single string argument whenever possible
744 @args = ( -text => $message, -class => 'Bio::Root::NotImplemented' );
745 } else {
746 @args = ( $message );
748 $self->throw(@args);
750 } else {
751 confess $message;
756 =head2 warn_not_implemented
758 Purpose : Generates a warning that a method has not been implemented.
759 Intended for use in the method definitions of
760 abstract interface modules where methods are defined
761 but are intended to be overridden by subclasses.
762 Generally, throw_not_implemented() should be used,
763 but warn_not_implemented() may be used if the method isn't
764 considered essential and convenient no-op behavior can be
765 provided within the interface.
766 Usage : $object->warn_not_implemented( method-name-string );
767 Example : $self->warn_not_implemented( "get_foobar" );
768 Returns : Calls $self->warn on this object, if available.
769 If the object doesn't have a warn() method,
770 Carp::carp() will be used.
771 Args : n/a
774 =cut
778 sub warn_not_implemented {
779 my $self = shift;
780 my $message = $self->_not_implemented_msg;
781 if( $self->can('warn') ) {
782 $self->warn( $message );
783 }else {
784 carp $message ;
788 # Unify 'not implemented' message. -Juguang
789 sub _not_implemented_msg {
790 my $self = shift;
791 my $package = ref $self;
792 my $meth = (caller(2))[3];
793 my $msg =<<EOD_NOT_IMP;
794 Abstract method \"$meth\" is not implemented by package $package.
795 This is not your fault - author of $package should be blamed!
796 EOD_NOT_IMP
797 return $msg;