TT#29909 fix perlcritic RequireUseStrict

by using strict where it wasn't used before
plus fix all bugs that were discovered along the way by enabling strict

Change-Id: I7f9a8bf0cee74014fd7551ec26f2ab3922715efc
changes/87/18887/2
Gerhard Jungwirth 7 years ago
parent 00633d1618
commit 985d433900

@ -1,3 +1,6 @@
use warnings;
use strict;
use lib 'inc'; use lib 'inc';
use Local::Module::Build; use Local::Module::Build;

@ -1,5 +1,8 @@
package NGCP::Panel::Block::Block; package NGCP::Panel::Block::Block;
use warnings;
use strict;
use Template; use Template;
sub new { sub new {

@ -1,5 +1,8 @@
package NGCP::Panel::Block::Contract::ProfileMappingsList; package NGCP::Panel::Block::Contract::ProfileMappingsList;
use warnings;
use strict;
use parent ("NGCP::Panel::Block::Block"); use parent ("NGCP::Panel::Block::Block");
sub template { sub template {

@ -1,5 +1,8 @@
package NGCP::Panel::Block::Contract::ProfileMappingsTimeline; package NGCP::Panel::Block::Contract::ProfileMappingsTimeline;
use warnings;
use strict;
use parent ("NGCP::Panel::Block::Block"); use parent ("NGCP::Panel::Block::Block");
sub template { sub template {

@ -1,5 +1,8 @@
package NGCP::Panel::Block::Contract::ProfileNetworkMappings; package NGCP::Panel::Block::Contract::ProfileNetworkMappings;
use warnings;
use strict;
use parent ("NGCP::Panel::Block::Block"); use parent ("NGCP::Panel::Block::Block");
sub template { sub template {

@ -1,4 +1,8 @@
package NGCP::Panel::Controller::API::MetaConfigDefs; package NGCP::Panel::Controller::API::MetaConfigDefs;
use warnings;
use strict;
use NGCP::Panel::Utils::Generic qw(:all); use NGCP::Panel::Utils::Generic qw(:all);
use boolean qw(true); use boolean qw(true);
use Data::HAL qw(); use Data::HAL qw();

@ -1,4 +1,8 @@
package NGCP::Panel::Form; package NGCP::Panel::Form;
use warnings;
use strict;
use Module::Load::Conditional qw/can_load/; use Module::Load::Conditional qw/can_load/;
my %forms = (); my %forms = ();

@ -1,4 +1,8 @@
package NGCP::Panel::Template::Plugin::DeviceConfig; package NGCP::Panel::Template::Plugin::DeviceConfig;
use warnings;
use strict;
use parent 'Template::Plugin'; use parent 'Template::Plugin';
use Crypt::RC4; use Crypt::RC4;

@ -1,5 +1,8 @@
package NGCP::Panel::Utils::DeviceFirmware; package NGCP::Panel::Utils::DeviceFirmware;
use warnings;
use strict;
use English; use English;
sub insert_firmware_data { sub insert_firmware_data {

@ -1,5 +1,8 @@
package NGCP::Panel::Utils::Fax; package NGCP::Panel::Utils::Fax;
use warnings;
use strict;
use English; use English;
use File::Temp qw/tempfile/; use File::Temp qw/tempfile/;
use File::Slurp; use File::Slurp;
@ -76,7 +79,7 @@ sub send_fax {
my $client = new NGCP::Fax; my $client = new NGCP::Fax;
use Data::Dumper; use Data::Dumper;
$c->log->debug('invoke send_fax with args: ' . Dumper(\%sendfax_args)); $c->log->debug('invoke send_fax with args: ' . Dumper(\%sendfax_args));
$client->send_fax(\%sendfax_args); my $res = $client->send_fax(\%sendfax_args);
$c->log->debug("webfax: res=$res;"); $c->log->debug("webfax: res=$res;");
} }
@ -120,9 +123,10 @@ sub get_fax {
return unless $filepath; return unless $filepath;
} else { } else {
if ($format) { if ($format) {
($tmp_fh, $filepath) = unless ( ($tmp_fh, $filepath) = File::Temp::tempfile( DIR => $c->config->{faxserver}{spool_dir}."/tmp") ) {
File::Temp::tempfile( DIR => $cfg->{spool_dir}."/tmp") $c->log->error("Cannot create temp file: $ERRNO");
or $self->error("Cannot create temp file: $ERRNO"); return;
}
binmode $tmp_fh; binmode $tmp_fh;
close $tmp_fh; close $tmp_fh;
print $tmp_fh $item->voip_fax_data->data; print $tmp_fh $item->voip_fax_data->data;
@ -167,7 +171,7 @@ sub process_fax_journal_item {
my $dst_sub = $result->callee_subscriber // undef; #undef, if not local, or if callee is username my $dst_sub = $result->callee_subscriber // undef; #undef, if not local, or if callee is username
#try finding it: #try finding it:
unless ($dst_sub) { unless ($dst_sub) {
my $dst_src_sub = $c->model('DB')->resultset('provisioning_voip_subscribers')->search({ my $prov_dst_sub = $c->model('DB')->resultset('provisioning_voip_subscribers')->search({
'username' => $result->callee, 'username' => $result->callee,
})->first(); })->first();
if ($prov_dst_sub) { if ($prov_dst_sub) {

@ -1,5 +1,8 @@
package NGCP::Panel::Utils::Interception; package NGCP::Panel::Utils::Interception;
use warnings;
use strict;
use Data::Dumper; use Data::Dumper;
use LWP::UserAgent; use LWP::UserAgent;
use TryCatch; use TryCatch;

@ -1,5 +1,8 @@
package NGCP::Panel::Utils::MySQL; package NGCP::Panel::Utils::MySQL;
use warnings;
use strict;
sub bulk_insert { sub bulk_insert {
my(%params) = @_; my(%params) = @_;
my ($c, $s, $trans, $query, $data, $chunksize) = @params{qw/c schema do_transaction query data chunk_size/}; my ($c, $s, $trans, $query, $data, $chunksize) = @params{qw/c schema do_transaction query data chunk_size/};

@ -1,5 +1,8 @@
#!/usr/bin/perl -w #!/usr/bin/perl -w
use warnings;
use strict;
my $path = '/tmp/lnp.csv'; my $path = '/tmp/lnp.csv';
my $carrier_base = 'carrier_'; my $carrier_base = 'carrier_';

@ -1,5 +1,8 @@
package Parent; package Parent;
use warnings;
use strict;
our $VERSION = 1.23; our $VERSION = 1.23;
sub VERSION { $VERSION } sub VERSION { $VERSION }

@ -1,3 +1,5 @@
## no critic (RequireUseWarnings, RequireUseStrict)
our $old = 0; our $old = 0;
BEGIN { BEGIN {
unshift @INC, sub { unshift @INC, sub {

@ -1,5 +1,8 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use warnings;
use strict;
use Catalyst::ScriptRunner; use Catalyst::ScriptRunner;
Catalyst::ScriptRunner->run('NGCP::Panel', 'CGI'); Catalyst::ScriptRunner->run('NGCP::Panel', 'CGI');

@ -1,4 +1,8 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use warnings;
use strict;
use Convert::Ascii85 qw(); use Convert::Ascii85 qw();
use IO::Uncompress::UnXz qw(unxz $UnXzError); use IO::Uncompress::UnXz qw(unxz $UnXzError);

@ -1,5 +1,8 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use warnings;
use strict;
use Catalyst::ScriptRunner; use Catalyst::ScriptRunner;
Catalyst::ScriptRunner->run('NGCP::Panel', 'FastCGI'); Catalyst::ScriptRunner->run('NGCP::Panel', 'FastCGI');

@ -1,5 +1,8 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use warnings;
use strict;
BEGIN { BEGIN {
$ENV{CATALYST_SCRIPT_GEN} = 40; $ENV{CATALYST_SCRIPT_GEN} = 40;
} }

@ -1,5 +1,8 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use warnings;
use strict;
use Catalyst::ScriptRunner; use Catalyst::ScriptRunner;
Catalyst::ScriptRunner->run('NGCP::Panel', 'Test'); Catalyst::ScriptRunner->run('NGCP::Panel', 'Test');

@ -1,3 +1,6 @@
use warnings;
use strict;
#use Sipwise::Base; #use Sipwise::Base;
use Net::Domain qw(hostfqdn); use Net::Domain qw(hostfqdn);
use JSON qw(); use JSON qw();

@ -1,7 +1,9 @@
use warnings;
use strict;
use threads qw(); use threads qw();
#use Sipwise::Base;
use Test::More;
use Test::More;
BEGIN { BEGIN {

Loading…
Cancel
Save