Changeset 514

Show
Ignore:
Timestamp:
02/07/02 08:08:11
Author:
miyagawa
Message:

symdump

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • original/trunk/Changes

    r426 r514  
    11Revision history for Perl extension original 
     2 
     30.02  Thu Feb  7 08:07:58 JST 2002 
     4        - use Devel::Symdump to find methods 
    25 
    360.01  Fri Jan 11 01:07:38 2002 
  • original/trunk/Makefile.PL

    r426 r514  
    44    'VERSION_FROM' => 'lib/original.pm', # finds $VERSION 
    55    'PREREQ_PM' => { 
    6         Test::More => 0.32, 
     6        'Test::More' => 0.32, 
     7        'Devel::Symdump' => 0, 
    78    }, 
    89); 
  • original/trunk/lib/original.pm

    r426 r514  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.01; 
     5$VERSION = 0.02; 
     6 
     7use Devel::Symdump; 
    68 
    79my %Registered; 
     
    1416    *{"$pkg\::import"} = sub { 
    1517        return if exists $Registered{$pkg}; 
    16         local $SIG{__WARN__} = sub {}
     18        local $^W = 0
    1719        for my $method (__find_methods($pkg)) { 
    1820            next if $method eq 'import'; 
     
    2729 
    2830sub __find_methods { 
    29     my $class = shift; 
    30     no strict 'refs'; 
    31     my $globhash = "$class\::"; 
    32     return grep { 
    33         $globhash->{$_} and *{$globhash->{$_}}{CODE}; 
    34     } keys %$globhash; 
     31    my $pkg = shift; 
     32    return map { s/^$pkg\:://; $_ } Devel::Symdump->functions($pkg); 
    3533} 
    3634