File Coverage

blib/lib/Object/Meta/Plugin/Useful/Generic.pm
Criterion Covered Total %
statement 24 25 96.0
branch 1 2 50.0
condition 2 7 28.5
subroutine 6 6 100.0
pod 1 2 50.0
total 34 42 80.9


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2             # $Id: Generic.pm,v 1.1 2003/11/29 14:35:24 nothingmuch Exp $
3              
4             package Object::Meta::Plugin::Useful::Generic; # an extended base class with some logical features $$$ ## rename to Usefull::Generic;
5              
6 3     3   7713 use strict;
  3         6  
  3         78  
7 3     3   14 use warnings;
  3         3  
  3         60  
8 3     3   14 use warnings::register;
  3         6  
  3         442  
9              
10 3     3   15 use base 'Object::Meta::Plugin::Useful';
  3         4  
  3         1668  
11              
12             our $VERSION = 0.01;
13              
14             sub export { # utility method: export a list of method names
15 29     29 1 166 my $self = shift;
16 29         65 my @try_export = @_;
17            
18 29         37 my %tested = map { $_, undef } @{ $self->{exports} };
  0         0  
  29         150  
19            
20 29 50 0     64 push @{ $self->{exports} }, grep {
  69   50     729  
      33        
21 29         36 (not exists $tested{$_}) and $tested{$_} = 1 # make sure we didn't pass this one already
22             and $self->can($_) or (warnings::warnif($self,"Export of undefined method $_ attempted") and undef); # make sure we can use the method. UNIVERSAL::can should be replaced if magic is going on. To shut it up, 'no warnings Plugin::Class'.
23             } @try_export;
24            
25 29         40 @{ $self->{exports} }; # number on scalar, list on list
  29         107  
26             }
27              
28             sub exports {
29 30     30 0 36 my $self = shift;
30 30         34 @{ $self->{exports} };
  30         278  
31             }
32              
33             1; # Keep your mother happy.
34              
35             __END__