List Info

Thread: Re: Fun Perl question




Re: Fun Perl question
country flaguser name
Germany
2008-02-19 09:58:51
On Tuesday 19 February 2008 16:04, Peter Corlett wrote:
> So there's me with this bit of code that's running a
bit slow. I run the
> following command:
> 
>   perl -MProf
./test.pl
> 
> and then follow it with dproffpp to see the results.
I'm then left
> scratching my head to work out why I've got
"Unable to open tmon.out" before
> spotting my silly mistake.
> 
perl -dProf
...

> The fun question is: why did the original command seem
to work?
> 
perl -MDProf should have blown up with a no such module
error.

perl -MProf
appears to have ignored the -M argument (Prof)
entirely, 
probably because of the leading colon...

> (I've already worked out the answer, by the way, but it
might be an amusing
> puzzle for somebody else.)
> 
Go on, put us out of our misery.

-- 
Richard Foley
Ciao - shorter than aufwiedersehen

http://www.rfi.net/

Re: Fun Perl question
country flaguser name
United Kingdom
2008-02-19 10:26:42
On Tue, Feb 19, 2008 at 04:58:51PM +0100, Richard Foley
wrote:
[...]
> Go on, put us out of our misery.

"-MProf&quo
t; puts "use: DProf;" at the start of the script.
This is a label
followed by a bareword, and because there's no strict,
that's acceptable to
the interpreter.

It doesn't have to be a bareword either:

perl -M:die="Just Another Perl Hacker" -e0


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )