| File: | blib/lib/OpenSRF.pm |
| Coverage: | 35.0% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package OpenSRF; | ||||||
| 2 | |||||||
| 3 | 14 14 14 | 73 49 85 | use strict; | ||||
| 4 | 14 14 14 | 87 69 96 | use vars qw/$AUTOLOAD/; | ||||
| 5 | |||||||
| 6 | 14 14 14 | 150 72 86 | use Error; | ||||
| 7 | require UNIVERSAL::require; | ||||||
| 8 | |||||||
| 9 | # $Revision$ | ||||||
| 10 | |||||||
| 11 - 19 | =head1 NAME OpenSRF - Top level class for OpenSRF perl modules. =head1 VERSION Version 1.4.0 =cut | ||||||
| 20 | |||||||
| 21 | our $VERSION = 1.4.0; | ||||||
| 22 | |||||||
| 23 - 30 | =head1 METHODS =head2 AUTOLOAD Traps methods calls for methods that have not been defined so they don't propogate up the class hierarchy. =cut | ||||||
| 31 | |||||||
| 32 | sub AUTOLOAD { | ||||||
| 33 | 0 | my $self = shift; | |||||
| 34 | 0 | my $type = ref($self) || $self; | |||||
| 35 | 0 | my $name = $AUTOLOAD; | |||||
| 36 | 0 | my $otype = ref $self; | |||||
| 37 | |||||||
| 38 | 0 | my ($package, $filename, $line) = caller; | |||||
| 39 | 0 | my ($package1, $filename1, $line1) = caller(1); | |||||
| 40 | 0 | my ($package2, $filename2, $line2) = caller(2); | |||||
| 41 | 0 | my ($package3, $filename3, $line3) = caller(3); | |||||
| 42 | 0 | my ($package4, $filename4, $line4) = caller(4); | |||||
| 43 | 0 | my ($package5, $filename5, $line5) = caller(5); | |||||
| 44 | 0 | $name =~ s/.*://; # strip fully-qualified portion | |||||
| 45 | 0 | warn <<" WARN"; | |||||
| 46 | **** | ||||||
| 47 | ** ${name}() isn't there. Please create me somewhere (like in $type)! | ||||||
| 48 | ** Error at $package ($filename), line $line | ||||||
| 49 | ** Call Stack (5 deep): | ||||||
| 50 | ** $package1 ($filename1), line $line1 | ||||||
| 51 | ** $package2 ($filename2), line $line2 | ||||||
| 52 | ** $package3 ($filename3), line $line3 | ||||||
| 53 | ** $package4 ($filename4), line $line4 | ||||||
| 54 | ** $package5 ($filename5), line $line5 | ||||||
| 55 | ** Object type was $otype | ||||||
| 56 | **** | ||||||
| 57 | WARN | ||||||
| 58 | } | ||||||
| 59 | |||||||
| 60 | |||||||
| 61 | |||||||
| 62 - 67 | =head2 alert_abstract This method is called by abstract methods to ensure that the process dies when an undefined abstract method is called. =cut | ||||||
| 68 | |||||||
| 69 | sub alert_abstract() { | ||||||
| 70 | 0 | 1 | my $c = shift; | ||||
| 71 | 0 | my $class = ref( $c ) || $c; | |||||
| 72 | 0 | my ($file, $line, $method) = (caller(1))[1..3]; | |||||
| 73 | 0 | die " * Call to abstract method $method at $file, line $line"; | |||||
| 74 | } | ||||||
| 75 | |||||||
| 76 - 80 | =head2 class Returns the scalar value of its caller. =cut | ||||||
| 81 | |||||||
| 82 | 0 | 1 | sub class { return scalar(caller); } | ||||
| 83 | |||||||
| 84 | 1; | ||||||