Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

geoff (2013)

geoff
  reversethis-{gro ... om} {ta} {ffoeg}
http://www.modperlcookbook.org/

see http://www.modperlcookbook.org/~geoff/ [modperlcookbook.org] for personal information, links to presentations, GPG key, and so on.

Journal of geoff (2013)

Monday June 28, 2004
08:55 AM

if you lie to perl it will bite your bottom

[ #19546 ]
thanks to Paul I just learned about a Perl feature I never knew existed. I've seen code like this

#line 500 Foo.pm

in XS-generated C and the occasional Perl file before and just figured it was a way of keeping track of things for developers - a helpful comment. as it turns out, this little bit of code has special meaning to perl. observe.

$ cat line.pl
#!/usr/bin/perl
#line 500 Foo.pm
die "yikes";

$ perl line.pl
yikes at Foo.pm line 500.

while this is kinda cool, as it turns out it creates some difficult to solve issues with Devel::Cover. so actually, I kinda loathe this feature at the moment as it is keeping me from being able to get nice coverage results for some code I am testing.

things that prohibit test coverage metrics--

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  •     #line 500 Foo.pm
    is a standard C feature, so in XS-generated C code it's understood by the C preprocessor. (lex, yacc and other code generators make extensive use of this feature.)

    A little-known fact is that perl actually understands this kind of comments as well.
  • #line 500 foo.pm

    is really handy when you've extracted tests from several sources into one .t