NAME
ELF::Extract::Sections - Extract Raw Chunks of data from identifiable ELF Sections
VERSION
version 0.02071411
SYNOPSIS
use ELF::Extract::Sections;
# Create an extractor object for foo.so
my $extractor = ELF::Extract::Sections->new( file => '/path/to/foo.so' );
# Scan file for section data, returns a hash
my %sections = ${ $extractor->sections };
# Retreive the section object for the comment section
my $data = $sections{.comment};
# Print the stringified explanation of the section
print "$data";
# Get the raw bytes out of the section.
print $data->contents # returns bytes
CAVEATS
PUBLIC ATTRIBUTES
-> file
Returns the file the section data is being created for.
-> sections
Returns a HashRef of the available sections.
-> scanner
Returns the name of the default scanner plug-in
PUBLIC METHODS
-> new ( file => FILENAME )
-> new ( file => FILENAME , scanner => 'Objdump' )
Creates A new Section Extractor object
-> sorted_sections ( field => SORT_BY ) -> sorted_sections ( field => SORT_BY, descending => DESCENDING ) Returns an ArrayRef sorted by the SORT_BY field. May be Ascending or Descending depending on requirements.
DESCENDING
Optional parameters. True for descending, False or absent for ascending.
SORT_BY
A String of the field to sort by. Valid options at present are
name
The Section Name
offset
The Sections offset relative to the start of the file.
size
The Size of the section.
PUBLIC ATTRIBUTE BUILDERS
These aren't really user serviceable, but they make your front end work.
-> buildsections
PRIVATE ATTRIBUTES
-> scannerpackage
-> scannerinstance
PRIVATE ATTRIBUTE BUILDERS
buildscannerpackage
-> buildscannerinstance
PRIVATE_METHODS
-> stashrecord( HashRef, Str, Str )
-> buildsection_section( Str, Int, Int, File )
-> buildsection_table( HashRef )
-> scanguess_size
-> scanwith_size
DEBUGGING
This library uses Log::Log4perl. To see more verbose processing notices, do this:
use Log::Log4perl qw( :easy );
Log::Log4perl->easy_init($DEBUG);
For convenience to make sure you don't happen to miss this fact, we never initialize Log4perl ourselves, so it will spit the following message if you have not set it up:
Log4perl: Seems like no initialization happened. Forgot to call init()?
To suppress this, just do
use Log::Log4perl qw( :easy );
I request however you don't do that for modules intended to be consumed by others without good cause.
ACKNOWLEDGEMENTS
AUTHOR
Kent Fredric <kentnl@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Kent Fredric.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.