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

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

FindImportedSymbols

Page history last edited by David B 15 years, 1 month 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.