}
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+# A rather unsubtle method of blowing away all the state information
+# from a parser object so it can be reused. Provided as a utility for
+# backward compatibilty in Pod::Man, etc. but not recommended for
+# general use.
+
+sub reinit {
+ my $self = shift;
+ foreach (qw(source_dead source_filename doc_has_started
+start_of_pod_block content_seen last_was_blank paras curr_open
+line_count pod_para_count in_pod ~tried_gen_errata errata errors_seen
+Title)) {
+
+ delete $self->{$_};
+ }
+}
+
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1;
use strict;
use vars qw($VERSION $MAX_VERSION_WITHIN $SLEEPY);
-$VERSION = 2.03_01; ## Current version of this package
+$VERSION = 3.04; ## Current version of this package
BEGIN { *DEBUG = sub () {0} unless defined &DEBUG; } # set DEBUG level
use Carp ();
my $name = join '::', @m, $shortname;
$self->_simplify_base($name);
- if ($name eq lc($name) || $name eq uc($name)) {
+ # On VMS, case-preserved document names can't be constructed from
+ # filenames, so try to extract them from the "=head1 NAME" tag in the
+ # file instead.
+ if ($^O eq 'VMS' && ($name eq lc($name) || $name eq uc($name))) {
open PODFILE, "<$file" or die "_path2modname: Can't open $file: $!";
my $in_pod = 0;
my $in_name = 0;
- while (<PODFILE>) {
- chomp;
- $in_pod = 1 if m/^=\w/;
- $in_pod = 0 if m/^=cut/;
+ my $line;
+ while ($line = <PODFILE>) {
+ chomp $line;
+ $in_pod = 1 if ($line =~ m/^=\w/);
+ $in_pod = 0 if ($line =~ m/^=cut/);
next unless $in_pod; # skip non-pod text
- next if m/^\s*\z/; # and blank lines
- next if ($in_pod && m/^X</); # and commands
+ next if ($line =~ m/^\s*\z/); # and blank lines
+ next if ($in_pod && ($line =~ m/^X</)); # and commands
if ($in_name) {
- if( m/(\w+::)?(\w+)/) {
+ if ($line =~ m/(\w+::)?(\w+)/) {
# substitute case-preserved version of name
my $podname = $2;
- my $prefix = $1;
+ my $prefix = $1 || '';
$verbose and print "Attempting case restore of '$name' from '$prefix$podname'\n";
unless ($name =~ s/$prefix$podname/$prefix$podname/i) {
$verbose and print "Attempting case restore of '$name' from '$podname'\n";
last;
}
}
- $in_name = 1 if m/^=head1 NAME/;
+ $in_name = 1 if ($line =~ m/^=head1 NAME/);
}
close PODFILE;
}