Skip to content

Commit

Permalink
Item13897: Small fixes
Browse files Browse the repository at this point in the history
- Fixed missing 'use' in Config.pm

- Foswiki::Func is now reporting about a call to deprecated function only
the first and every 100th call.
  • Loading branch information
vrurg committed Aug 4, 2016
1 parent 2b56d1a commit 000aece
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/lib/Foswiki/Config.pm
Expand Up @@ -20,6 +20,7 @@ use Unicode::Normalize;
use Cwd qw( abs_path );
use Try::Tiny;
use Foswiki qw(urlEncode urlDecode make_params);
use Foswiki::Configure::FileUtil;

use Moo;
use namespace::clean;
Expand Down
12 changes: 9 additions & 3 deletions core/lib/Foswiki/Func.pm
Expand Up @@ -49,6 +49,7 @@ System.DevelopingPlugins.
# deprecated functions section.

package Foswiki::Func;
use v5.14;

use strict;
use warnings;
Expand Down Expand Up @@ -2814,10 +2815,15 @@ sub AUTOLOAD {
my $funcBody;
if ( __PACKAGE__->can($deprecatedFunc) ) {
$funcBody = <<FBDY;
\$Foswiki::app->logger->warn(
state \$callCount = 100;
if ( \$callCount == 100 ) {
\$Foswiki::app->logger->warn(
"Function $AUTOLOAD is deprecated; read Foswiki::Func manual to find how to deal with it!"
);
return ${deprecatedFunc}(\@_);
);
\$callCount = 0;
}
\$callCount++;
return ${deprecatedFunc}(\@_);
FBDY
}
else {
Expand Down

0 comments on commit 000aece

Please sign in to comment.