NAME

Parse::nm - Run and parse 'nm' command output with filter callbacks

SYNOPSIS

Class interface:

use Parse::nm;

Parse::nm->run(options => [ qw(-e) ],
               filters => [
                 {
                   name => qr/\.\w+/,
                   type => 'T',
                   action => sub {
                     print "$_[0]\n"
                   }
                 },
               ],
               files => 't.o',
            );

Object interface:

use Parse::nm;

my $pnm = Parse::nm->new(options => ...,
                         filters => ...);
$pnm->run(files => 'file1.o');
$pnm->run(files => 'file2.o');

$str = "TestFunc T 0 0 \n";
$pnm->parse(\$str);

METHODS

->new(%options)

Builds an object with the default options.

->parse(*GLOB, %options)

Parse 'nm -P'-style data coming from a filehandle.

Note that if your Perl is compiled with PerlIO (this is the default since 5.8.0), you can easily parse a string by opening a string reference to it.

open($fh, '<', \$str)
a string 

->run(%options)

Run nm and parse its output.

OPTIONS

options => [ ]

Command-line options given to nm to run it. The -P (POSIX-style output) is always given. -A (show input file) is currently incompatible.

files => [ ]

List of files to give to nm for parsing.

filters => \@filters
name => qr/\S+/

A regexp that must match the name of the symbol.

Don't use ^ or $: this is not supported.

type => qr/[A-Z]/

A regexp that must match the type of the symbol. Types are single ASCII letter. See the nm man page of your operating system for more information.

Don't use ^ or $: this is not supported.

action => sub { ... }

A callback that will be triggered for each line where both name and type match.

SEE ALSO

http://www.opengroup.org/onlinepubs/009695399/utilities/nm.html

Binutils::Objdump

AUTHOR

Olivier Mengué, dolmen@cpan.org

COPYRIGHT AND LICENSE

Copyright © 2010 Olivier Mengué.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.0 or, at your option, any later version of Perl 5 you may hava available.