Created
May 16, 2017 16:21
-
-
Save dakkar/d7aed24c04d959ee201a54583307cbc7 to your computer and use it in GitHub Desktop.
Check what C libraries get loaded when loading a Perl module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| sub maps { | |
| open my $fh, '<', '/proc/self/maps'; | |
| my @lines = <$fh>; | |
| my %ret = map { | |
| m{\ {10}(/.+)$} ? ($1,$_) : () | |
| } @lines; | |
| return \%ret; | |
| } | |
| my $before_maps = maps(); | |
| my $target = shift; | |
| eval "require $target" or die "Can't load $target: $@\n"; | |
| my $after_maps = maps(); | |
| delete @{$after_maps}{keys %{$before_maps}}; | |
| local $\="\n"; | |
| print for sort keys %{$after_maps}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment