Name

ELF::Extract::Sections::Section - An Objective reference to a section in an ELF file.

Description

Generally Intended for use by ELF::Extract::Sections as a meta-structure for tracking data, but generated objects are returned to you for you to deal with

Synopsis

use ELF::Extract::Sections::Section;

my $s = ELF::Extract::Sections::Section->new(
    source => '/foo/bar.pl',
    name   => '.comment',
    offset => 45670,
    size   => 1244,
);

# prints a human friendly description
print $s->to_string;

# does likewise.
print "$s";

# Compare with another section ( preferably in the same file, meaningless otherwise
if( $s->compare( $y , 'name' ) ){

}

# Unimplemented
$s->write_to ( file => '/tmp/out.txt' );

# Retuns the sections contents as a string
print $s->contents;

Methods

-> new ( %PARAMS )

4 Parameters, all required.

source

Str|Path::Class::File: Either a String or a Path::Class instance pointing to the file in mention.

name

Str: The ELF Section Name

size

Int: The ELF Section Size

offset

Int: Position in bytes relative to the start of the file.

Returns an ELF::Extract::Sections::Section object.

-> source

returns Path::Class::File

-> name

returns Str

-> offset

returns Int

-> size

returns Int

-> to_string

returns Str description of the object

[ Section {name} of size {size} in {file} @ {start} to {stop} ]

-> compare ( %PARAMS )

2 Parameters, both required

other

ELF::Extract::Sections::Section: Item to compare with

field

Str['name','offset','size']: Field to compare with.

returns Int of comparison result, between -1 and 1

-> write_to ( %PARAMS )

UNIMPLEMENTED AS OF YET

file

Str|Path::Class::File: File target to write section contents to.

-> contents

returns Str of binary data read out of file.