summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <rra@cpan.org>2021-09-06 18:26:45 -0700
committerRuss Allbery <rra@cpan.org>2021-09-06 18:26:45 -0700
commite314c1b3138dd3921274d0f31fca39228a7c51a4 (patch)
tree8f143120559a57e0dca69a480482f8be07dda6b2
parentf6cb2d41e604d4322d050bf3af8e3dcb06b908af (diff)
Move stashed spin Id string into module state
Move $DOCID into module state. There are no tests for this since I will probably drop support for this feature (I don't use it any more now that INN has been converted to Git).
-rwxr-xr-xlib/App/DocKnot/Spin.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/App/DocKnot/Spin.pm b/lib/App/DocKnot/Spin.pm
index 99446eb..05ec948 100755
--- a/lib/App/DocKnot/Spin.pm
+++ b/lib/App/DocKnot/Spin.pm
@@ -42,7 +42,7 @@ my $URL = 'https://www.eyrie.org/~eagle/software/web/';
use strict;
use subs qw(expand parse parse_context);
use warnings;
-use vars qw($DOCID $FILE @FILES $FULLPATH $ID $OUTPUT
+use vars qw($FILE @FILES $FULLPATH $ID $OUTPUT
@RSS %SITEDESCS %SITELINKS @SITEMAP
@STATE %VERSIONS %commands);
@@ -863,7 +863,7 @@ sub do_heading {
my $date = strftime ('%Y-%m-%d %T -0000', gmtime);
$output .= '<!-- Spun' . ($FILE eq '-' ? '' : ' from ' . fileparse($FILE))
. " by spin 1.80 on $date -->\n";
- $output .= "<!-- $DOCID -->\n" if $DOCID;
+ $output .= "<!-- $self->{id} -->\n" if $self->{id};
$output .= "\n<body>\n";
if ($FILE ne '-') {
$output .= $self->placement($file);
@@ -875,7 +875,7 @@ sub do_heading {
# (the identifier is later used in do_heading).
sub do_id {
my ($self, $format, $id) = @_;
- $DOCID = $id;
+ $self->{id} = $id;
return (1, '');
}
@@ -1007,7 +1007,7 @@ sub do_signature {
my $link = '<a href="%URL%">spun</a>';
my $source = $FILE;
$output .= $self->footer(
- $source, $file, $DOCID,
+ $source, $file, $self->{id},
"Last modified and\n $link %MOD%",
"Last $link\n %NOW% from thread modified %MOD%"
);
@@ -1189,6 +1189,7 @@ sub _spin {
@FILES = ([$in_fh, $in_path]);
# Initialize object state for a new document.
+ $self->{id} = undef;
$self->{macros} = {};
$self->{out_fh} = $out_fh;
$self->{space} = q{};
@@ -1235,7 +1236,6 @@ sub _spin {
print {$out_fh} $self->border_clear(), $self->{space};
# Clean up per-file data so that it's not carried to the next file.
- undef $DOCID;
undef @RSS;
}