in reply to Here there be cammels!

A bit cryptic, I need to guess what you mean.

You want to throw warnings, but with different line number and file reported?

update

I think there should be more straight forward methods, but neither warn nor Carp mention "line".

So, here a hack, till someone comes with something cleaner.

sub warn_from { my ($line,$file,$text) =@_; eval <<"__CODE__"; #line $line $file; warn \$text; __CODE__ } warn_from(42,'captain.pl', "I say what!");
-->
/usr/bin/perl -w /home/lanx/warn_new.pl I say what! at captain.pl; line 42.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Here there be cammels!
by hildred (Initiate) on Feb 28, 2015 at 22:21 UTC
    if you do this:
    foreach(<>){ warn $_; }
    you get <text> at dummy.pl line 5, <> line 6 I want to do that.
        In the second pass the file is closed.