first round of Perl::Critic cleanups. Do not use return undef, use a bare return instead

This commit is contained in:
Colin Kuskie 2007-12-05 00:30:43 +00:00
parent 75041656ee
commit 96178fd70c
92 changed files with 209 additions and 209 deletions

View file

@ -257,7 +257,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Event") {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return undef;
return;
}
return $self->SUPER::addChild($properties, @other);

View file

@ -80,7 +80,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Post::Thread"
and $properties->{className} ne 'WebGUI::Asset::RSSFromParent') {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return undef;
return;
}
return $self->SUPER::addChild($properties, @other);
}

View file

@ -264,11 +264,11 @@ sub addToScratchCart {
my $scratchCart = $self->session->scratch->get('EMS_scratch_cart');
my @eventsInCart = split("\n",$scratchCart);
my ($isApproved) = $self->session->db->quickArray("select approved from EventManagementSystem_products where productId = ?",[$event]);
return undef unless $isApproved;
return unless $isApproved;
unless (scalar(@eventsInCart) || $scratchCart) {
# the cart is empty, so check if this is a master event or not.
my ($isChild) = $self->session->db->quickArray("select prerequisiteId from EventManagementSystem_products where productId = ?",[$event]);
return undef if $isChild;
return if $isChild;
$self->session->scratch->set('currentMainEvent',$event);
$self->session->scratch->set('EMS_scratch_cart', $event);
return $event;
@ -276,7 +276,7 @@ sub addToScratchCart {
# check if event is actually available.
my ($numberRegistered) = $self->session->db->quickArray("select count(*) from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where t.transactionId=p.transactionId and t.status='Completed' and r.purchaseId = p.purchaseId and r.returned=0 and r.productId=?",[$event]);
my ($maxAttendees) = $self->session->db->quickArray("select maximumAttendees from EventManagementSystem_products where productId=?",[$event]);
return undef unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
return unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
my $bid = $self->session->scratch->get('currentBadgeId');
my @pastEvents = ($bid)?$self->session->db->buildArray("select r.productId from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where r.returned=0 and r.badgeId=? and t.transactionId=p.transactionId and t.status='Completed' and p.purchaseId=r.purchaseId group by productId",[$bid]):();

View file

@ -97,7 +97,7 @@ sub definition {
#-------------------------------------------------------------------
sub duplicate {
# Buggo: how do we duplicate these?
return undef;
return;
}

View file

@ -444,12 +444,12 @@ sub getProjectInstance {
my $session = shift;
my $db = $session->db;
my $projectId = $_[0];
return undef unless $projectId;
return unless $projectId;
my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]);
if($assetId) {
return WebGUI::Asset->newByDynamicClass($session,$assetId);
}
return undef;
return;
}
#-------------------------------------------------------------------

View file

@ -824,8 +824,8 @@ recent revision will be fetched.
sub _getFileFromDatabase {
my ($constraint, $dbLink);
my $self = shift;
my $recordId = shift || return undef;
my $fieldName = shift || return undef;
my $recordId = shift || return;
my $fieldName = shift || return;
my $revision = shift;
$dbLink = $self->_getDbLink;
@ -4088,7 +4088,7 @@ sub _constructSearchQuery {
my $searchType = ($self->session->form->process("searchType") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchType')) eq 'and' ? 'and' : 'or';
return undef if (!@constraints);
return if (!@constraints);
# Construct the search query
my $sortField = @sortClauses ? ('('.join('+', @sortClauses).') AS sqlform_orderby') : '1 AS sqlform_orderby';

View file

@ -154,7 +154,7 @@ sub _convertToEpoch {
my $time = $_[1];
unless ($date =~ m{^\d+/\d+/\d+} and $time =~ m{^\d+:\d+}) {
return undef;
return;
}
my ($month,$day,$year) = split("/",$date);

View file

@ -289,7 +289,7 @@ sub _find_record {
}
}
return undef;
return;
}
#-------------------------------------------------------------------
@ -348,7 +348,7 @@ sub _get_rss_data {
if (!$response->is_success()) {
$session->errorHandler->warn("Error retrieving url '$url': " .
$response->status_line());
return undef;
return;
}
my $xml = $response->content();
@ -380,7 +380,7 @@ sub _get_rss_data {
$session->errorHandler->warn("error parsing rss for url $url :".$@);
#Returning undef on a parse failure is a change from previous behaviour,
#but it SHOULDN'T have a major effect.
return undef;
return;
}
# make sure that the {channel} points to the channel