From 317d19842c40b5056989ad0ce22b632df9153444 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 18 Jan 2016 08:45:18 +0000 Subject: [PATCH] Silence "used only once: possible typo" warnings for variables that are part of modules' APIs --- IkiWiki/CGI.pm | 2 ++ IkiWiki/Plugin/aggregate.pm | 2 ++ IkiWiki/Plugin/autoindex.pm | 2 ++ IkiWiki/Plugin/calendar.pm | 2 ++ IkiWiki/Plugin/highlight.pm | 2 ++ IkiWiki/Plugin/remove.pm | 1 + IkiWiki/Plugin/tag.pm | 1 + IkiWiki/Render.pm | 1 + IkiWiki/Setup/Standard.pm | 2 ++ IkiWiki/Setup/Yaml.pm | 2 ++ debian/changelog | 2 ++ 11 files changed, 19 insertions(+) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 1763828a4..cbc2fe8eb 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -416,7 +416,9 @@ sub cgi (;$$) { eval q{use CGI}; error($@) if $@; + no warnings "once"; $CGI::DISABLE_UPLOADS=$config{cgi_disable_uploads}; + use warnings; if (! $q) { binmode(STDIN); diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index fbf88c627..be7da3a71 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -571,7 +571,9 @@ sub aggregate (@) { # XML::Feed doesn't work around XML::Atom's bizarre # API, so we will. Real unicode strings? Yes please. # See [[bugs/Aggregated_Atom_feeds_are_double-encoded]] + no warnings 'once'; local $XML::Atom::ForceUnicode = 1; + use warnings; my $c=$entry->content; # atom feeds may have no content, only a summary diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index d5ee4b58f..c443f01d2 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -46,6 +46,7 @@ sub genindex ($) { my $dir = $config{srcdir}; if (! $config{autoindex_commit}) { + no warnings 'once'; $dir = $IkiWiki::Plugin::transient::transientdir; } @@ -80,6 +81,7 @@ sub refresh () { $file=~s/^\.\/?//; return unless length $file; if (IkiWiki::file_pruned($file)) { + no warnings 'once'; $File::Find::prune=1; } elsif (! -l $_) { diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index c03b89667..45617afe8 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -141,7 +141,9 @@ sub autocreate { $template->param(month => $month) if defined $month; $template->param(pagespec => $config{archive_pagespec}); + no warnings 'once'; my $dir = $IkiWiki::Plugin::transient::transientdir; + use warnings; writefile($pagefile, $dir, $template->output); } diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm index ce919748a..f6908921e 100644 --- a/IkiWiki/Plugin/highlight.pm +++ b/IkiWiki/Plugin/highlight.pm @@ -201,7 +201,9 @@ sub highlight ($$) { my $gen; if (! exists $highlighters{$langfile}) { + no warnings 'once'; $gen = highlight::CodeGenerator::getInstance($highlight::XHTML); + use warnings; $gen->setFragmentCode(1); # generate html fragment $gen->setHTMLEnclosePreTag(1); # include stylish
 		if ($data_dir){
diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm
index 5c99b387e..6875844a3 100644
--- a/IkiWiki/Plugin/remove.pm
+++ b/IkiWiki/Plugin/remove.pm
@@ -23,6 +23,7 @@ sub getsetup () {
 }
 
 sub allowed_dirs {
+	no warnings 'once';
 	return grep { defined $_ } (
 		$config{srcdir},
 		$IkiWiki::Plugin::transient::transientdir,
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index 605f41599..8a0859b5c 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -120,6 +120,7 @@ sub gentag ($) {
 
 			my $dir = $config{srcdir};
 			if (! $config{tag_autocreate_commit}) {
+				no warnings 'once';
 				$dir = $IkiWiki::Plugin::transient::transientdir;
 			}
 
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 4c998b156..130257f71 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -326,6 +326,7 @@ sub find_src_files (;$$$) {
 		$page = pagename($file);
 		if (! exists $pagesources{$page} &&
 		    file_pruned($file)) {
+			no warnings 'once';
 			$File::Find::prune=1;
 			return;
 		}
diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm
index ea7d763bb..07a66f3db 100644
--- a/IkiWiki/Setup/Standard.pm
+++ b/IkiWiki/Setup/Standard.pm
@@ -33,6 +33,7 @@ sub dumpline ($$$$) {
 	
 	eval q{use Data::Dumper};
 	error($@) if $@;
+	no warnings 'once';
 	local $Data::Dumper::Terse=1;
 	local $Data::Dumper::Indent=1;
 	local $Data::Dumper::Pad="\t";
@@ -40,6 +41,7 @@ sub dumpline ($$$$) {
 	local $Data::Dumper::Quotekeys=0;
 	# only the perl version preserves utf-8 in output
 	local $Data::Dumper::Useperl=1;
+	use warnings;
 	
 	my $dumpedvalue;
 	if (($type eq 'boolean' || $type eq 'integer') && $value=~/^[0-9]+$/) {
diff --git a/IkiWiki/Setup/Yaml.pm b/IkiWiki/Setup/Yaml.pm
index 6bf20f480..8edd7126b 100644
--- a/IkiWiki/Setup/Yaml.pm
+++ b/IkiWiki/Setup/Yaml.pm
@@ -35,7 +35,9 @@ sub dumpline ($$$$) {
 	
 	eval q{use YAML::XS};
 	die $@ if $@;
+	no warnings 'once';
 	$YAML::XS::QuoteNumericStrings=0;
+	use warnings;
 
 	my $dump=decode_utf8(Dump({$key => $value}));
 	$dump=~s/^---\n//; # yaml header, we don't want
diff --git a/debian/changelog b/debian/changelog
index c72787f37..90d6aa626 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,6 +34,8 @@ ikiwiki (3.20150615) UNRELEASED; urgency=medium
   * d/control: remove leading article from Description
     (lintian: description-synopsis-starts-with-article)
   * d/control: Standards-Version: 3.9.6, no changes required
+  * Silence "used only once: possible typo" warnings for variables
+    that are part of modules' APIs
 
  -- Simon McVittie   Mon, 15 Jun 2015 18:13:23 +0100