Skip to content

Commit

Permalink
Fixed Perl::Critic errors in Kernel/Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mgruner committed Feb 25, 2013
1 parent 5174cb7 commit 8bef0bb
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Kernel/Modules/AdminGenericInterfaceMappingSimple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ sub Run {
$Self->{LayoutObject}->ChallengeTokenCheck();

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# if there is an error return to edit screen
if ( $GetParam->{Error} ) {
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Modules/AdminGenericInterfaceTransportHTTPSOAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sub Run {
}

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# check required parameters
my %Error;
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminGenericInterfaceWebservice.pm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ sub Run {
}

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new confguration
$WebserviceData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -246,7 +246,7 @@ sub Run {
my $WebserviceData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new confguration
$WebserviceData->{Name} = $GetParam->{Name};
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminPackageManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ sub Run {
# ------------------------------------------------------------ #

if ( exists $ENV{MOD_PERL} ) {
if ( defined $mod_perl::VERSION ) {
if ( $mod_perl::VERSION >= 1.99 ) {
if ( defined $mod_perl::VERSION ) { ## no critic
if ( $mod_perl::VERSION >= 1.99 ) { ## no critic

# check if Apache::Reload is loaded
my $ApacheReload = 0;
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Modules/AdminProcessManagement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ sub Run {
->{Config}->{Fields}->{$AssignedField}
};
if ( $Values{Config} ) {
$Values{Config} = Dumper( $Values{Config} );
$Values{Config} = Dumper( $Values{Config} ); ## no critic
$Values{Config} =~ s{ \s* \$VAR1 \s* =}{}xms;
$Values{Config} =~ s{\s+\{}{\{}xms;
}
Expand Down Expand Up @@ -1007,7 +1007,7 @@ sub Run {
my $ProcessData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new confguration
$ProcessData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -1165,7 +1165,7 @@ sub Run {
my $ProcessData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new confguration
$ProcessData->{Name} = $GetParam->{Name};
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminProcessManagementActivity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ sub Run {
my $ActivityData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new configuration
$ActivityData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -321,7 +321,7 @@ sub Run {
my $ActivityData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new configuration
$ActivityData->{Name} = $GetParam->{Name};
Expand Down
8 changes: 4 additions & 4 deletions Kernel/Modules/AdminProcessManagementActivityDialog.pm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ sub Run {
my $ActivityDialogData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new confguration
$ActivityDialogData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -212,7 +212,7 @@ sub Run {
}

# check if permission exists
if ( defined $GetParam->{Permission} and $GetParam->{Permission} ne '' ) {
if ( defined $GetParam->{Permission} && $GetParam->{Permission} ne '' ) {
my $PermissionList = $Self->{ConfigObject}->Get('System::Permission');

my %PermissionLookup = map { $_ => 1 } @{$PermissionList};
Expand Down Expand Up @@ -394,7 +394,7 @@ sub Run {
my $ActivityDialogData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new confguration
$ActivityDialogData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -475,7 +475,7 @@ sub Run {
}

# check if permission exists
if ( defined $GetParam->{Permission} and $GetParam->{Permission} ne '' ) {
if ( defined $GetParam->{Permission} && $GetParam->{Permission} ne '' ) {

my $PermissionList = $Self->{ConfigObject}->Get('System::Permission');

Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminProcessManagementPath.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ sub Run {
my $PathData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

$PathData->{ProcessEntityID} = $GetParam->{ProcessEntityID} || $GetParam->{ID};
$PathData->{TransitionEntityID} = $GetParam->{TransitionEntityID} || $GetParam->{EntityID};
Expand All @@ -113,7 +113,7 @@ sub Run {
my $TransferData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# merge changed data into process config
$TransferData->{ProcessEntityID} = $GetParam->{ProcessEntityID};
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminProcessManagementTransition.pm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sub Run {
my $TransitionData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new configuration
$TransitionData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -278,7 +278,7 @@ sub Run {
my $TransitionData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new configuration
$TransitionData->{Name} = $GetParam->{Name};
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminProcessManagementTransitionAction.pm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ sub Run {
my $TransitionActionData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new configuration
$TransitionActionData->{Name} = $GetParam->{Name};
Expand Down Expand Up @@ -290,7 +290,7 @@ sub Run {
my $TransitionActionData;

# get parameter from web browser
my $GetParam = $Self->_GetParams;
my $GetParam = $Self->_GetParams();

# set new configuration
$TransitionActionData->{Name} = $GetParam->{Name};
Expand Down
3 changes: 2 additions & 1 deletion Kernel/Modules/AdminSMIME.pm
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ sub _SignerCertificateOverview {
my @SignerCertResults = $Self->{CryptObject}->PrivateSearch(
Search => $Param{CertFingerprint},
);
my %SignerCert = %{ $SignerCertResults[0] } if @SignerCertResults;
my %SignerCert;
%SignerCert = %{ $SignerCertResults[0] } if @SignerCertResults;

# get all certificates
my @AvailableCerts = $Self->{CryptObject}->CertificateSearch();
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Modules/AdminSysConfig.pm
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ sub Run {
my $TypeKey = $Self->{ParamObject}->GetParam(
Param => $ElementKey . 'LoaderType' . ( $Index + 1 )
) || 'JavaScript';
if ( $TypeKey and ( $Key eq $TypeKey ) ) {
if ( $TypeKey && ( $Key eq $TypeKey ) ) {
push @LoaderArray, $Loader[$Index];
}
}
Expand Down Expand Up @@ -715,7 +715,7 @@ sub Run {
# if running under PerlEx, reload the application (and thus the configuration)
if (
exists $ENV{'GATEWAY_INTERFACE'}
and $ENV{'GATEWAY_INTERFACE'} eq "CGI-PerlEx"
&& $ENV{'GATEWAY_INTERFACE'} eq "CGI-PerlEx"
)
{
PerlEx::ReloadAll();
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Modules/AgentTicketAttachment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ sub Run {
# write tmp file
my $FileTempObject = Kernel::System::FileTemp->new( %{$Self} );
my ( $FH, $Filename ) = $FileTempObject->TempFile();
if ( open( my $ViewerDataFH, '>', $Filename ) ) {
print $ViewerDataFH $Data{Content};
if ( open( my $ViewerDataFH, '>', $Filename ) ) { ## no critic
print $ViewerDataFH $Data{Content}; ## no critic
close $ViewerDataFH;
}
else {
Expand All @@ -127,7 +127,7 @@ sub Run {

# use viewer
my $Content = '';
if ( open( my $ViewerFH, "$Viewer $Filename |" ) ) {
if ( open( my $ViewerFH, "-|", "$Viewer $Filename" ) ) { ## no critic
while (<$ViewerFH>) {
$Content .= $_;
}
Expand Down
9 changes: 6 additions & 3 deletions Kernel/Modules/AgentTicketPhone.pm
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,12 @@ sub Run {
# multiple addresses list
# check email address
my $CountFrom = scalar @MultipleCustomer || 1;
my %CustomerDataFrom = $Self->{CustomerUserObject}->CustomerUserDataGet(
User => $Article{CustomerUserID},
) if $Article{CustomerUserID};
my %CustomerDataFrom;
if ( $Article{CustomerUserID} ) {
%CustomerDataFrom = $Self->{CustomerUserObject}->CustomerUserDataGet(
User => $Article{CustomerUserID},
);
}

for my $Email ( Mail::Address->parse($ArticleFrom) ) {

Expand Down
30 changes: 17 additions & 13 deletions Kernel/Modules/Installer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ sub Run {
if ( -f '/etc/SuSE-release' ) {
$Dist{Vendor} = 'SuSE';
if ( exists $ENV{MOD_PERL} ) {
eval 'require mod_perl';
if ( defined $mod_perl::VERSION ) {
eval 'require mod_perl'; ## no critic
if ( defined $mod_perl::VERSION ) { ## no critic
$Dist{Webserver} = 'rcapache2 restart';
}
}
Expand All @@ -94,8 +94,8 @@ sub Run {
$Dist{Webserver} = 'service httpd restart';
}
elsif ( exists $ENV{MOD_PERL} ) {
eval 'require mod_perl';
if ( defined $mod_perl::VERSION ) {
eval 'require mod_perl'; ## no critic
if ( defined $mod_perl::VERSION ) { ## no critic
$Dist{Webserver} = 'Apache2 + mod_perl2';
}
}
Expand Down Expand Up @@ -347,7 +347,7 @@ sub Run {
Name => 'DatabaseResultBack',
Data => {},
);
print STDERR "ERR: $DBI::errstr - $_\n";
print STDERR "ERR: $DBI::errstr - $_\n"; ## no critic
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'Installer',
Data => {},
Expand Down Expand Up @@ -387,7 +387,7 @@ sub Run {
Name => 'DatabaseResultBack',
Data => {},
);
print STDERR "ERR: $DBI::errstr - $_\n";
print STDERR "ERR: $DBI::errstr - $_\n"; ## no critic
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'Installer',
Data => {},
Expand Down Expand Up @@ -424,7 +424,7 @@ sub Run {
Name => 'DatabaseResultBack',
Data => {},
);
print STDERR "ERR: $DBI::errstr - $_\n";
print STDERR "ERR: $DBI::errstr - $_\n"; ## no critic
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'Installer',
Data => {},
Expand Down Expand Up @@ -983,8 +983,10 @@ sub ReConfigure {

# read config file
my $ConfigFile = "$Self->{Path}/Kernel/Config.pm";
## no critic
open( my $In, '<', $ConfigFile )
|| return "Can't open $ConfigFile: $!";
## use critic
my $Config = '';
while (<$In>) {
if ( $_ =~ /^#/ ) {
Expand All @@ -1010,9 +1012,11 @@ sub ReConfigure {
close $In;

# write new config file
## no critic
open( my $Out, '>', $ConfigFile )
|| return "Can't open $ConfigFile: $!";
print $Out $Config;
## use critic
close $Out;

return;
Expand All @@ -1022,23 +1026,23 @@ sub ParseSQLFile {
my ( $Self, $File ) = @_;

my @SQL;
if ( open( my $In, '<', $File ) ) {
if ( open( my $In, '<', $File ) ) { ## no critic
my $SQLEnd = 0;
my $SQLSingel = '';
my $SQLStatement = '';
while (<$In>) {
if ( $_ !~ /^(#|--)/ ) {
if ( $_ =~ /^(.*)(;|;\s)$/ || $_ =~ /^(\));/ ) {
$SQLSingel .= $1;
$SQLStatement .= $1;
$SQLEnd = 1;
}
else {
$SQLSingel .= $_;
$SQLStatement .= $_;
}
}
if ($SQLEnd) {
push @SQL, $SQLSingel;
push @SQL, $SQLStatement;
$SQLEnd = 0;
$SQLSingel = '';
$SQLStatement = '';
}
}
close $In;
Expand Down

0 comments on commit 8bef0bb

Please sign in to comment.