sub _init {
my $self = shift;
if (defined $self->{string}) {
- $self->_parse(\($self->{string}));
+ $self->_parse(\($self->{string}), $self->{lineno_offset}, $self->{fake_filename});
delete $self->{string};
}
elsif (defined $self->{file} and -e $self->{file}) {
. $self->{file} . "' for reading: $!";
local $/ = undef;
my $string = <$fh>;
- $self->_parse(\$string, $self->{file});
+ $self->_parse(\$string, $self->{lineno_offset}, $self->{file});
}
}
sub _parse {
my $self = shift;
my $stringref = shift;
+ my $lineno_offset = shift;
+ $lineno_offset = 0 if not defined $lineno_offset;
my $filename = shift;
$filename = '<string>' if not defined $filename;
# TODO order of sections, multiple sections of same type
# Heavily influenced by ExtUtils::ParseXS
my $section = 'typemap';
- my $lineno = 0;
+ my $lineno = $lineno_offset;
my $junk = "";
my $current = \$junk;
my @input_expr;