Silence "used only once: possible typo" warnings for variables that are part of modules' APIs

master
Simon McVittie 2016-01-18 08:45:18 +00:00
parent e33b4678c7
commit 317d19842c
11 changed files with 19 additions and 0 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 $_) {

View File

@ -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);
}

View File

@ -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 <pre>
if ($data_dir){

View File

@ -23,6 +23,7 @@ sub getsetup () {
}
sub allowed_dirs {
no warnings 'once';
return grep { defined $_ } (
$config{srcdir},
$IkiWiki::Plugin::transient::transientdir,

View File

@ -120,6 +120,7 @@ sub gentag ($) {
my $dir = $config{srcdir};
if (! $config{tag_autocreate_commit}) {
no warnings 'once';
$dir = $IkiWiki::Plugin::transient::transientdir;
}

View File

@ -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;
}

View File

@ -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]+$/) {

View File

@ -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

2
debian/changelog vendored
View File

@ -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 <smcv@debian.org> Mon, 15 Jun 2015 18:13:23 +0100