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

  • Work with all your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in one place. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!

View
 

FindImportedSymbols

Page history last edited by David B 12 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.