| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

FindImportedSymbols

Page history last edited by David B 11 years, 8 months ago

Find which symbols come from which modules:

 

 

#!/usr/local/bin/perl

use strict;
use Data::Dumper;
use Symbol qw/ gensym qualify delete_package /;

for my $module (
  'Data::Dumper',
  'Symbol',
) {
  print "found $_ in main from $modulen"
    for find_exported_symbols( 'main', $module );
}

sub find_exported_symbols {
  my($in, $from) = @_;
  no strict 'refs';
  my($in_tbl, $from_tbl) = ( %{"$in::"}, %{"$from::"} );

  return grep {
    my $sym = $_;
    grep { *$sym == *$_ } keys %$from_tbl;
  } keys %$in_tbl;
}

 

-Attribution

Comments (0)

You don't have permission to comment on this page.