Subject: | Confused by -M with arguments |
B::Hooks::Parser is confused when used on the command line with -M that
has arguments. Here's a simple example emulating true.pm.
package Foo;
use B::Hooks::Parser;
sub import {
my $class = shift;
B::Hooks::Parser::inject('1;')
}
1;
And then on the command line:
$ perl -I ~/tmp -MFoo=foo,bar -wle 1
substr outside of string at
/usr/local/perl/5.10.1/lib/site_perl/5.10.1/darwin-thread-multi-64int-ld-2level/B/Hooks/Parser.pm
line 23.
BEGIN failed--compilation aborted.
This is means using any module that uses true.pm in a one liner with
arguments will blow up.
Some instrumentation reveals the problem:
$ perl -I ~/tmp -MFoo=foo,bar -wle 1
Line: 'use Foo split(/,/,q'
Offset: 30
substr outside of string at
/usr/local/perl/5.10.1/lib/site_perl/5.10.1/darwin-thread-multi-64int-ld-2level/B/Hooks/Parser.pm
line 26.
BEGIN failed--compilation aborted.
get_linestr() is not returning the whole line generated by Perl from the -M.