Olivier Mengué > Parse-nm-0.09 > Parse::nm

Download:
Parse-nm-0.09.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.09   Source  

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);
    Parse::nm->parse($fh, %options);

->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

PLATFORM SUPPORT ^

POSIX systems

OK.

StrawberryPerl (Windows)

Work in progress (patches welcome).

OpenBSD

Parse::nm can not work on OpenBSD (at least up to 4.6) because 'nm' doesn't have a POSIX-compatible mode.

http://www.openbsd.org/cgi-bin/man.cgi?query=nm&apropos=0&sektion=0&manpath=OpenBSD+4.6&arch=i386&format=html#STANDARDS

AUTHOR ^

Olivier Mengué, dolmen@cpan.org

COPYRIGHT AND LICENSE ^

Copyright © 2010-2011 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 have available.

syntax highlighting: