diff --git a/Build.PL b/Build.PL index f501f2f311..bdf9f69556 100644 --- a/Build.PL +++ b/Build.PL @@ -1,3 +1,6 @@ +use warnings; +use strict; + use lib 'inc'; use Local::Module::Build; diff --git a/lib/NGCP/Panel/Block/Block.pm b/lib/NGCP/Panel/Block/Block.pm index 7f667e1ab3..a52c5da509 100644 --- a/lib/NGCP/Panel/Block/Block.pm +++ b/lib/NGCP/Panel/Block/Block.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Block::Block; +use warnings; +use strict; + use Template; sub new { diff --git a/lib/NGCP/Panel/Block/Contract/ProfileMappingsList.pm b/lib/NGCP/Panel/Block/Contract/ProfileMappingsList.pm index 14bbb2ee46..bb22ddc788 100644 --- a/lib/NGCP/Panel/Block/Contract/ProfileMappingsList.pm +++ b/lib/NGCP/Panel/Block/Contract/ProfileMappingsList.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Block::Contract::ProfileMappingsList; +use warnings; +use strict; + use parent ("NGCP::Panel::Block::Block"); sub template { diff --git a/lib/NGCP/Panel/Block/Contract/ProfileMappingsTimeline.pm b/lib/NGCP/Panel/Block/Contract/ProfileMappingsTimeline.pm index 216df332a8..abb51a488c 100644 --- a/lib/NGCP/Panel/Block/Contract/ProfileMappingsTimeline.pm +++ b/lib/NGCP/Panel/Block/Contract/ProfileMappingsTimeline.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Block::Contract::ProfileMappingsTimeline; +use warnings; +use strict; + use parent ("NGCP::Panel::Block::Block"); sub template { diff --git a/lib/NGCP/Panel/Block/Contract/ProfileNetworkMappings.pm b/lib/NGCP/Panel/Block/Contract/ProfileNetworkMappings.pm index 757d7437cb..49da15d29f 100644 --- a/lib/NGCP/Panel/Block/Contract/ProfileNetworkMappings.pm +++ b/lib/NGCP/Panel/Block/Contract/ProfileNetworkMappings.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Block::Contract::ProfileNetworkMappings; +use warnings; +use strict; + use parent ("NGCP::Panel::Block::Block"); sub template { diff --git a/lib/NGCP/Panel/Controller/API/MetaConfigDefs.pm b/lib/NGCP/Panel/Controller/API/MetaConfigDefs.pm index bbdcc7f6db..1a9410ea14 100644 --- a/lib/NGCP/Panel/Controller/API/MetaConfigDefs.pm +++ b/lib/NGCP/Panel/Controller/API/MetaConfigDefs.pm @@ -1,4 +1,8 @@ package NGCP::Panel::Controller::API::MetaConfigDefs; + +use warnings; +use strict; + use NGCP::Panel::Utils::Generic qw(:all); use boolean qw(true); use Data::HAL qw(); diff --git a/lib/NGCP/Panel/Form.pm b/lib/NGCP/Panel/Form.pm index 489184aff8..89a1a926f8 100644 --- a/lib/NGCP/Panel/Form.pm +++ b/lib/NGCP/Panel/Form.pm @@ -1,4 +1,8 @@ package NGCP::Panel::Form; + +use warnings; +use strict; + use Module::Load::Conditional qw/can_load/; my %forms = (); diff --git a/lib/NGCP/Panel/Template/Plugin/DeviceConfig.pm b/lib/NGCP/Panel/Template/Plugin/DeviceConfig.pm index c68f1f12ef..b7e4befe65 100644 --- a/lib/NGCP/Panel/Template/Plugin/DeviceConfig.pm +++ b/lib/NGCP/Panel/Template/Plugin/DeviceConfig.pm @@ -1,4 +1,8 @@ package NGCP::Panel::Template::Plugin::DeviceConfig; + +use warnings; +use strict; + use parent 'Template::Plugin'; use Crypt::RC4; diff --git a/lib/NGCP/Panel/Utils/DeviceFirmware.pm b/lib/NGCP/Panel/Utils/DeviceFirmware.pm index 1884ae53bb..2a81341fdc 100644 --- a/lib/NGCP/Panel/Utils/DeviceFirmware.pm +++ b/lib/NGCP/Panel/Utils/DeviceFirmware.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Utils::DeviceFirmware; +use warnings; +use strict; + use English; sub insert_firmware_data { diff --git a/lib/NGCP/Panel/Utils/Fax.pm b/lib/NGCP/Panel/Utils/Fax.pm index 69fc9403a4..3b7dc6d7f9 100644 --- a/lib/NGCP/Panel/Utils/Fax.pm +++ b/lib/NGCP/Panel/Utils/Fax.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Utils::Fax; +use warnings; +use strict; + use English; use File::Temp qw/tempfile/; use File::Slurp; @@ -76,7 +79,7 @@ sub send_fax { my $client = new NGCP::Fax; use Data::Dumper; $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;"); } @@ -120,9 +123,10 @@ sub get_fax { return unless $filepath; } else { if ($format) { - ($tmp_fh, $filepath) = - File::Temp::tempfile( DIR => $cfg->{spool_dir}."/tmp") - or $self->error("Cannot create temp file: $ERRNO"); + unless ( ($tmp_fh, $filepath) = File::Temp::tempfile( DIR => $c->config->{faxserver}{spool_dir}."/tmp") ) { + $c->log->error("Cannot create temp file: $ERRNO"); + return; + } binmode $tmp_fh; close $tmp_fh; 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 #try finding it: 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, })->first(); if ($prov_dst_sub) { diff --git a/lib/NGCP/Panel/Utils/Interception.pm b/lib/NGCP/Panel/Utils/Interception.pm index cf34a1d102..6d2f8dcf75 100644 --- a/lib/NGCP/Panel/Utils/Interception.pm +++ b/lib/NGCP/Panel/Utils/Interception.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Utils::Interception; +use warnings; +use strict; + use Data::Dumper; use LWP::UserAgent; use TryCatch; diff --git a/lib/NGCP/Panel/Utils/MySQL.pm b/lib/NGCP/Panel/Utils/MySQL.pm index 0990ac18dc..0cd19b3979 100644 --- a/lib/NGCP/Panel/Utils/MySQL.pm +++ b/lib/NGCP/Panel/Utils/MySQL.pm @@ -1,5 +1,8 @@ package NGCP::Panel::Utils::MySQL; +use warnings; +use strict; + sub bulk_insert { my(%params) = @_; my ($c, $s, $trans, $query, $data, $chunksize) = @params{qw/c schema do_transaction query data chunk_size/}; diff --git a/sandbox/create_lnp_csv.pl b/sandbox/create_lnp_csv.pl index ea5d6d7182..592c7ea20d 100755 --- a/sandbox/create_lnp_csv.pl +++ b/sandbox/create_lnp_csv.pl @@ -1,5 +1,8 @@ #!/usr/bin/perl -w +use warnings; +use strict; + my $path = '/tmp/lnp.csv'; my $carrier_base = 'carrier_'; diff --git a/sandbox/inheritance.pl b/sandbox/inheritance.pl index 27e537d242..8131fe4679 100644 --- a/sandbox/inheritance.pl +++ b/sandbox/inheritance.pl @@ -1,5 +1,8 @@ package Parent; +use warnings; +use strict; + our $VERSION = 1.23; sub VERSION { $VERSION } diff --git a/sandbox/tracemem.pm b/sandbox/tracemem.pm index 828622fff3..cf7c7edacd 100644 --- a/sandbox/tracemem.pm +++ b/sandbox/tracemem.pm @@ -1,3 +1,5 @@ + +## no critic (RequireUseWarnings, RequireUseStrict) our $old = 0; BEGIN { unshift @INC, sub { diff --git a/script/ngcp_panel_cgi.pl b/script/ngcp_panel_cgi.pl index 052db7d1cd..0553913534 100755 --- a/script/ngcp_panel_cgi.pl +++ b/script/ngcp_panel_cgi.pl @@ -1,5 +1,8 @@ #!/usr/bin/env perl +use warnings; +use strict; + use Catalyst::ScriptRunner; Catalyst::ScriptRunner->run('NGCP::Panel', 'CGI'); diff --git a/script/ngcp_panel_decode_crash b/script/ngcp_panel_decode_crash index eac307bddc..b0d46b2aba 100755 --- a/script/ngcp_panel_decode_crash +++ b/script/ngcp_panel_decode_crash @@ -1,4 +1,8 @@ #!/usr/bin/env perl + +use warnings; +use strict; + use Convert::Ascii85 qw(); use IO::Uncompress::UnXz qw(unxz $UnXzError); diff --git a/script/ngcp_panel_fastcgi.pl b/script/ngcp_panel_fastcgi.pl index a4dea79158..0519762800 100755 --- a/script/ngcp_panel_fastcgi.pl +++ b/script/ngcp_panel_fastcgi.pl @@ -1,5 +1,8 @@ #!/usr/bin/env perl +use warnings; +use strict; + use Catalyst::ScriptRunner; Catalyst::ScriptRunner->run('NGCP::Panel', 'FastCGI'); diff --git a/script/ngcp_panel_server.pl b/script/ngcp_panel_server.pl index 7b700770c4..d90ec49e58 100755 --- a/script/ngcp_panel_server.pl +++ b/script/ngcp_panel_server.pl @@ -1,5 +1,8 @@ #!/usr/bin/env perl +use warnings; +use strict; + BEGIN { $ENV{CATALYST_SCRIPT_GEN} = 40; } diff --git a/script/ngcp_panel_test.pl b/script/ngcp_panel_test.pl index 38fe843fa5..30f4cd4f6c 100755 --- a/script/ngcp_panel_test.pl +++ b/script/ngcp_panel_test.pl @@ -1,5 +1,8 @@ #!/usr/bin/env perl +use warnings; +use strict; + use Catalyst::ScriptRunner; Catalyst::ScriptRunner->run('NGCP::Panel', 'Test'); diff --git a/t/api-rest/api-customerfraudpreferences.t b/t/api-rest/api-customerfraudpreferences.t index f428278376..cfaaf1595a 100644 --- a/t/api-rest/api-customerfraudpreferences.t +++ b/t/api-rest/api-customerfraudpreferences.t @@ -1,3 +1,6 @@ +use warnings; +use strict; + #use Sipwise::Base; use Net::Domain qw(hostfqdn); use JSON qw(); diff --git a/t/api-rest/api-threads.t b/t/api-rest/api-threads.t index 8855a1f3c8..b4b7cf77ca 100644 --- a/t/api-rest/api-threads.t +++ b/t/api-rest/api-threads.t @@ -1,7 +1,9 @@ +use warnings; +use strict; + use threads qw(); -#use Sipwise::Base; -use Test::More; +use Test::More; BEGIN {