Codebase list libtest-pod-perl / 512638e
this very sloppy debugging code shows: 1) line_count() returns lines 2 greater than the lines in the actual file... why why why? The Pod::Simple::Subclassing docs aren't exactly finished, and they mention a start_line attribute that simply isn't passed to the handlers -- among other caveats. Curious, ucky, etc. If these wrong line numbers are consistent between versions, they should be sorta usable. Odd. Rather than subtracting two, though, I'm going to store the line_count of the document. Maybe that'll help? Pfft, there's no point really. All the .pods and .pms in this distribution seem to show the same off-by-two line_count(). Weird. 2) we should whine in the text handler when {to} (from start) doesn't match text; resetting the "state" in the end handler. Paul Miller 14 years ago
2 changed file(s) with 43 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11 use base 'Pod::Simple';
22 use strict;
33
4 open our $debug, ">", "notes.txt";
5
46 sub _handle_element_start {
57 my($parser, $element_name, $attr_hash_r) = @_;
8 my $line = $parser->line_count -2;
9
10 # Curiously, Pod::Simple supports L<text|scheme:...> rather well.
11 if( $element_name eq "L" ) {
12 print $debug "<$element_name href='$attr_hash_r->{to}' type='$attr_hash_r->{type}'> ($line)\n" if $debug;
13
14 # if( $attr_hash_r->{type} eq "url" ) {
15 # $parser->whine($parser->line_count(), "L<text|scheme:...> is invalid according to perlpod");
16 # }
17 }
18
19 else {
20 print $debug "<$element_name> ($line)\n" if $debug;
21 }
622
723 return $parser->SUPER::_handle_element_start(@_);
824 }
925
1026 sub _handle_element_end {
1127 my($parser, $element_name) = @_;
28 my $line = $parser->line_count -2;
29
30 print $debug "</$element_name> ($line)\n" if $debug;
1231
1332 return $parser->SUPER::_handle_element_end(@_);
33 }
34
35 sub _handle_text {
36 my($parser, $text) = @_;
37 my $line = $parser->line_count -2;
38
39 print $debug "$text ($line)\n" if $debug;
40
41 return $parser->SUPER::_handle_text(@_);
1442 }
1543
1644 1;
0
01 =head1 COPYRIGHT
12
23 Copyright 2009, Paul Miller C<< <jettero@cpan.org> >>
34
5
6 ... test text, please ignore
7
48 =head1 SEE ALSO
9
10 ... test text, please ignore
511
612 Invalid according to L<perlpod/Formatting Codes>:
713
814 L<Paul's Perl Modules|http://voltar.org/perl>
915
16
17 This should be OK:
18
19 L<Paul's Perl Modules|http://voltar.org/perl>
20
21 This should also be OK: L<http://voltar.org/perl>
22
23 ... test text, please ignore
24
1025 =cut
1126