Below is a patch that uses #line at the start of each snipped POD segment to give me more meaningful error messages. I think it would be nice to name batches of tests like so: =for testing foo() =begin testing foo() to save typing and ease copy-and-pasting when creating subs that are like other subs. Pod::Tests could put this bit in a $Pod::Tests::testing_name variable and Testing.pm, Test.pm, Test::Simple, etc. could check and see if this is populated and fill in the test name / comment field if the caller didn't. Combined with line numbers and file named, this is a very clear and useful way of marking tests: the test name gives you an idea of what's failing, the file and line numbers take you right to the line. It also means that a little error message parsing like most editors can do could take you right to the file and line number when SelfTesting. - Barrie --- /usr/local/lib/perl5/site_perl/5.6.1/Pod/Tests.pm Tue Mar 13 17:37:24 2001 +++ lib/Pod/Tests.pm Sat Mar 24 10:05:06 2001 @@ -2,7 +2,7 @@ use strict; use vars qw($VERSION); -$VERSION = '0.02'; +$VERSION = '0.021'; =pod @@ -164,6 +164,7 @@ $self->_init; foreach (@_) { + $self->{_linenum}++; if( /^=(\w.*)/ and $self->{_sawblank} and !$self->{_inblock}) { $self->{_inpod} = 1; @@ -208,7 +209,6 @@ } } - $self->{_linenum}++; } push @{$self->{example}}, @{$self->{_for}{example}} if $self->{_for}{example} ; @@ -264,8 +264,9 @@ my($self) = shift; my $pod = { - code => $self->{_currpod}, - line => $self->{_forstart}, + code => $self->{_currpod}, + filename => $self->{_filename}, + line => $self->{_forstart}, }; push @{$self->{_for}{$self->{_infor}}}, $pod if @@ -303,8 +304,9 @@ my($self) = shift; my $pod = { - code => $self->{_currpod}, - line => $self->{_blockstart}, + code => $self->{_currpod}, + filename => $self->{_filename}, + line => $self->{_blockstart}, }; push @{$self->{_for}{$self->{_inblock}}}, $pod if @@ -334,7 +336,11 @@ return; } - return $self->parse_fh(\*POD); + $self->{_filename} = $file ; + my $r = $self->parse_fh(\*POD); + $self->{_filename} = undef ; + + return $r ; } @@ -397,10 +403,12 @@ my($self, @tests) = @_; my @code = (); - foreach my $test (@tests) { + my $fn = $test->{filename} + ? " $test->{filename}" + : "" ; push @code, <<CODE; -# From line $test->{line} +#line $test->{line} $fn $test->{code} CODE @@ -426,10 +434,14 @@ my @code = (); foreach my $example (@examples) { + my $fn = $example->{filename} + ? " $example->{filename}" + : "" ; push @code, <<CODE; # From line $example->{line} eval { local \$^W = 0; + #line $example->{line} $fn $example->{code}; }; ok(!\$@);