in reply to exports -- which module exports are used?
$ cat foo.pl #!/usr/bin/env perl use Carp; carp('boo'); # This is line 3 $ exports foo.pl foo.pl: 7: carp('boo'); # This is line 3 carp # use Carp qw< carp >; $
Am I reading that right? It looks like it tells me that the carp call is on line 7, but it is really on line 3. If I make this hack to exports, it seems to give me the line number I expect:
sub ReportExportUse { my( $fh, @mods ) = @_; my( @exports, %export_mod, %conflict ); GroupExports( \( @exports, %export_mod, %conflict ), @mods ); my %mod_export; my $inuse = 0; if( @exports ) { my $match = MatchWords( @exports ); $match = qr/$match/; local $_; local $. = 0; # <------------- HACK while( <$fh> ) {
Here is my new output:
foo.pl: 3: carp('boo'); # This is line 3 carp # use Carp qw< carp >;
There is probably a better solution, and I suspect it has something to do with the seek.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: exports -- which module exports are used? ($.)
by tye (Sage) on Oct 03, 2013 at 17:08 UTC | |
by toolic (Bishop) on Oct 03, 2013 at 17:24 UTC |