From fa09c415986152984e158d243c91ee55cd210df2 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 24 Jan 2008 21:58:15 +0000 Subject: [PATCH] replaced return; with return undef; --- docs/changelog/7.x.x.txt | 1 + lib/Spectre/Workflow.pm | 2 +- lib/WebGUI/AdSpace.pm | 8 +-- lib/WebGUI/AdSpace/Ad.pm | 2 +- lib/WebGUI/Asset.pm | 50 +++++++++---------- lib/WebGUI/Asset/Event.pm | 16 +++--- lib/WebGUI/Asset/File.pm | 6 +-- lib/WebGUI/Asset/File/Image.pm | 2 +- lib/WebGUI/Asset/File/Image/Photo.pm | 2 +- lib/WebGUI/Asset/File/ZipArchive.pm | 6 +-- lib/WebGUI/Asset/Post.pm | 14 +++--- lib/WebGUI/Asset/Post/Thread.pm | 8 +-- lib/WebGUI/Asset/RSSCapable.pm | 4 +- lib/WebGUI/Asset/RichEdit.pm | 2 +- lib/WebGUI/Asset/Shortcut.pm | 2 +- lib/WebGUI/Asset/Snippet.pm | 2 +- lib/WebGUI/Asset/WikiPage.pm | 4 +- lib/WebGUI/Asset/Wobject/Calendar.pm | 10 ++-- lib/WebGUI/Asset/Wobject/Collaboration.pm | 2 +- .../Asset/Wobject/EventManagementSystem.pm | 8 +-- lib/WebGUI/Asset/Wobject/Gallery/Utility.pm | 6 +-- lib/WebGUI/Asset/Wobject/GalleryAlbum.pm | 2 +- lib/WebGUI/Asset/Wobject/Matrix.pm | 2 +- lib/WebGUI/Asset/Wobject/Poll.pm | 2 +- lib/WebGUI/Asset/Wobject/ProjectManager.pm | 6 +-- lib/WebGUI/Asset/Wobject/SQLForm.pm | 8 +-- lib/WebGUI/Asset/Wobject/SQLReport.pm | 8 +-- lib/WebGUI/Asset/Wobject/StockData.pm | 2 +- lib/WebGUI/Asset/Wobject/SyndicatedContent.pm | 6 +-- lib/WebGUI/Asset/Wobject/WSClient.pm | 2 +- lib/WebGUI/AssetClipboard.pm | 2 +- lib/WebGUI/AssetPackage.pm | 2 +- lib/WebGUI/AssetTrash.pm | 2 +- lib/WebGUI/AssetVersioning.pm | 8 +-- lib/WebGUI/Auth.pm | 8 +-- lib/WebGUI/Auth/WebGUI.pm | 4 +- lib/WebGUI/Cache/Database.pm | 4 +- lib/WebGUI/Cache/FileCache.pm | 10 ++-- lib/WebGUI/Commerce/Item.pm | 4 +- lib/WebGUI/Commerce/Payment.pm | 8 +-- lib/WebGUI/Commerce/Payment/Cash.pm | 2 +- lib/WebGUI/Commerce/Payment/ITransact.pm | 10 ++-- lib/WebGUI/Commerce/Shipping.pm | 4 +- lib/WebGUI/Commerce/Transaction.pm | 4 +- lib/WebGUI/Content/Asset.pm | 2 +- lib/WebGUI/Content/Maintenance.pm | 2 +- lib/WebGUI/Content/Prefetch.pm | 2 +- lib/WebGUI/Content/Setup.pm | 4 +- lib/WebGUI/DatabaseLink.pm | 4 +- lib/WebGUI/DateTime.pm | 4 +- lib/WebGUI/Form.pm | 2 +- lib/WebGUI/Form/Checkbox.pm | 4 +- lib/WebGUI/Form/Color.pm | 2 +- lib/WebGUI/Form/DynamicField.pm | 2 +- lib/WebGUI/Form/Email.pm | 2 +- lib/WebGUI/Form/File.pm | 4 +- lib/WebGUI/Form/Hidden.pm | 2 +- lib/WebGUI/Form/Image.pm | 2 +- lib/WebGUI/Form/List.pm | 2 +- lib/WebGUI/Form/Phone.pm | 2 +- lib/WebGUI/Form/Radio.pm | 2 +- lib/WebGUI/Form/ReadOnly.pm | 4 +- lib/WebGUI/Form/SelectSlider.pm | 2 +- lib/WebGUI/Form/TimeField.pm | 4 +- lib/WebGUI/Form/Zipcode.pm | 2 +- lib/WebGUI/FormValidator.pm | 4 +- lib/WebGUI/Group.pm | 2 +- lib/WebGUI/HTML.pm | 8 +-- lib/WebGUI/HTMLForm.pm | 2 +- lib/WebGUI/Image/Graph.pm | 4 +- lib/WebGUI/Image/Graph/Pie.pm | 2 +- lib/WebGUI/Image/Palette.pm | 14 +++--- lib/WebGUI/Inbox.pm | 4 +- lib/WebGUI/Inbox/Message.pm | 6 +-- lib/WebGUI/LDAPLink.pm | 10 ++-- lib/WebGUI/Macro/AdSpace.pm | 2 +- lib/WebGUI/Macro/AssetProxy.pm | 2 +- lib/WebGUI/Macro/RandomAssetProxy.pm | 2 +- lib/WebGUI/Macro/Thumbnail.pm | 2 +- lib/WebGUI/Mail/Get.pm | 8 +-- lib/WebGUI/Mail/Send.pm | 8 +-- lib/WebGUI/Operation.pm | 2 +- lib/WebGUI/Operation/AdSpace.pm | 2 +- lib/WebGUI/Operation/Help.pm | 4 +- lib/WebGUI/Operation/SSO.pm | 2 +- lib/WebGUI/Operation/SpellCheck.pm | 4 +- lib/WebGUI/Operation/User.pm | 2 +- lib/WebGUI/Operation/VersionTag.pm | 2 +- lib/WebGUI/PassiveProfiling.pm | 8 +-- lib/WebGUI/PerformanceProfiler.pm | 2 +- lib/WebGUI/Product.pm | 8 +-- lib/WebGUI/ProfileCategory.pm | 2 +- lib/WebGUI/ProfileField.pm | 14 +++--- lib/WebGUI/SQL.pm | 6 +-- lib/WebGUI/SQL/ResultSet.pm | 2 +- lib/WebGUI/Search/Index.pm | 4 +- lib/WebGUI/Session.pm | 2 +- lib/WebGUI/Session/DateTime.pm | 8 +-- lib/WebGUI/Session/Form.pm | 4 +- lib/WebGUI/Session/Http.pm | 10 ++-- lib/WebGUI/Session/Scratch.pm | 8 +-- lib/WebGUI/Session/Stow.pm | 6 +-- lib/WebGUI/Session/Style.pm | 6 +-- lib/WebGUI/Session/Url.pm | 6 +-- lib/WebGUI/Storage.pm | 14 +++--- lib/WebGUI/Text.pm | 2 +- lib/WebGUI/User.pm | 10 ++-- lib/WebGUI/Utility.pm | 6 +-- lib/WebGUI/VersionTag.pm | 4 +- lib/WebGUI/Workflow.pm | 2 +- lib/WebGUI/Workflow/Activity.pm | 10 ++-- lib/WebGUI/Workflow/Cron.pm | 2 +- lib/WebGUI/Workflow/Instance.pm | 6 +-- 113 files changed, 287 insertions(+), 286 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 7a5bbe75b..29aa7ed4c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -5,6 +5,7 @@ - fix: AssetPackage.pm would give an error on importing a package through the web interface, but the package would be imported successfully. - fix: 7.5.0 upgrade template for time tracker was corrupt. + - fix: replaced return; with return undef; and changed WGBP. 7.5.0 - rfe: Search Asset returns URLs diff --git a/lib/Spectre/Workflow.pm b/lib/Spectre/Workflow.pm index b5270a257..aa94413ac 100644 --- a/lib/Spectre/Workflow.pm +++ b/lib/Spectre/Workflow.pm @@ -374,7 +374,7 @@ sub getNextInstance { return $instance; } $self->debug("Didn't see any workflow instances to run."); - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/AdSpace.pm b/lib/WebGUI/AdSpace.pm index 2ba634790..16e341f38 100644 --- a/lib/WebGUI/AdSpace.pm +++ b/lib/WebGUI/AdSpace.pm @@ -76,9 +76,9 @@ sub create { my $class = shift; my $session = shift; my $properties = shift || {}; - return unless $properties->{name}; + return undef unless $properties->{name}; my $test = $class->newByName($session, $properties->{name}); - return if defined $test; + return undef if defined $test; my $id = $session->db->setRow("adSpace","adSpaceId",{adSpaceId=>"new"}); my $self = $class->new($session, $id); $self->set($properties); @@ -236,7 +236,7 @@ sub new { my $session = shift; my $id = shift; my $properties = $session->db->getRow("adSpace","adSpaceId",$id); - return unless $properties->{adSpaceId}; + return undef unless $properties->{adSpaceId}; bless {_session=>$session, _properties=>$properties}, $class; } @@ -261,7 +261,7 @@ sub newByName { my $session = shift; my $name = shift; my $properties = $session->db->getRow("adSpace","name",$name); - return unless $properties->{adSpaceId}; + return undef unless $properties->{adSpaceId}; bless {_session=>$session, _properties=>$properties}, $class; } diff --git a/lib/WebGUI/AdSpace/Ad.pm b/lib/WebGUI/AdSpace/Ad.pm index b184791be..98ac48a8f 100644 --- a/lib/WebGUI/AdSpace/Ad.pm +++ b/lib/WebGUI/AdSpace/Ad.pm @@ -156,7 +156,7 @@ sub new { my $session = shift; my $id = shift; my $properties = $session->db->getRow("advertisement","adId",$id); - return unless $properties->{adId}; + return undef unless $properties->{adId}; bless {_session=>$session, _properties=>$properties}, $class; } diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 49732b902..833a77416 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -91,7 +91,7 @@ The missing URL. sub addMissing { my $self = shift; my $assetUrl = shift; - return unless ($self->session->var->isAdminOn); + return undef unless ($self->session->var->isAdminOn); my $ac = $self->getAdminConsole; my $i18n = WebGUI::International->new($self->session, "Asset"); my $output = $i18n->get("missing page query"); @@ -314,7 +314,7 @@ sub checkView { return $notFound->www_view; } $self->logView(); - return; + return undef; } #------------------------------------------------------------------- @@ -1179,7 +1179,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e sub getToolbar { my $self = shift; - return unless $self->canEdit; + return undef unless $self->canEdit; return $self->{_toolbar} if (exists $self->{_toolbar}); my $userUiLevel = $self->session->user->profileField("uiLevel"); my $uiLevels = $self->session->config->get("assetToolbarUiLevel"); @@ -1337,7 +1337,7 @@ sub getValue { } return $self->{_propertyDefinitions}{$key}{defaultValue}; } - return; + return undef; } @@ -1371,7 +1371,7 @@ sub loadModule { return $className; } $session->errorHandler->error("Couldn't compile asset package: ".$className.". Root cause: ".$@); - return; + return undef; } #------------------------------------------------------------------- @@ -1389,7 +1389,7 @@ sub logView { WebGUI::PassiveProfiling::add($self->session,$self->getId); WebGUI::PassiveProfiling::addPage($self->session,$self->getId) if ($self->get("className") eq "WebGUI::Asset::Wobject::Layout"); } - return; + return undef; } @@ -1593,7 +1593,7 @@ sub manageAssets { '; $self->session->output->print($output); - return; + return undef; } #------------------------------------------------------------------- @@ -1620,7 +1620,7 @@ sub manageAssetsSearch { $output .= WebGUI::Form::formFooter($self->session); $self->session->output->print($output); $output = ''; - return unless ($self->session->form->get("doit") && ($self->session->form->get("keywords") ne "" || $self->session->form->get("class") ne "any")); + return undef unless ($self->session->form->get("doit") && ($self->session->form->get("keywords") ne "" || $self->session->form->get("class") ne "any")); my $class = $self->session->form->process("class","className") eq "any" ? undef : $self->session->form->process("class","className"); my $assets = WebGUI::Search->new($self->session,0)->search({ keywords=>$self->session->form->get("keywords"), @@ -1685,7 +1685,7 @@ sub manageAssetsSearch { //]]>
 
'; $self->session->output->print($output); - return; + return undef; } #------------------------------------------------------------------- @@ -1722,22 +1722,22 @@ sub new { unless (defined $assetId) { $session->errorHandler->error("Asset constructor new() requires an assetId."); - return; + return undef; } - return unless ($revisionDate); + return undef unless ($revisionDate); unless ($class ne 'WebGUI::Asset' or defined $className) { ($className) = $session->db->quickArray("select className from asset where assetId=?", [$assetId]); unless ($className) { $session->errorHandler->error("Couldn't instantiate asset: ".$assetId. ": couldn't find class name"); - return; + return undef; } } if ($className) { $class = $class->loadModule($session, $className); - return unless (defined $class); + return undef unless (defined $class); } my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]); @@ -1749,7 +1749,7 @@ sub new { $properties = WebGUI::Asset->assetDbProperties($session, $assetId, $class, $revisionDate); unless (exists $properties->{assetId}) { $session->errorHandler->error("Asset $assetId $class $revisionDate is missing properties. Consult your database tables for corruption. "); - return; + return undef; } $cache->set($properties,60*60*24); } @@ -1759,7 +1759,7 @@ sub new { return $object; } $session->errorHandler->error("Something went wrong trying to instanciate a '$className' with assetId '$assetId', but I don't know what!"); - return; + return undef; } #------------------------------------------------------------------- @@ -1794,7 +1794,7 @@ sub newByDynamicClass { # confess "newByDynamicClass requires assetId" # unless $assetId; # So just return instead - return unless ( $session && blessed $session eq 'WebGUI::Session' ) + return undef unless ( $session && blessed $session eq 'WebGUI::Session' ) && $assetId; # Cache the className lookup @@ -1813,7 +1813,7 @@ sub newByDynamicClass { unless ( $className ) { $session->errorHandler->error("Couldn't find className for asset '$assetId'"); - return; + return undef; } return WebGUI::Asset->new($session,$assetId,$className,$revisionDate); @@ -1840,10 +1840,10 @@ sub newByPropertyHashRef { my $class = shift; my $session = shift; my $properties = shift; - return unless defined $properties; - return unless exists $properties->{className}; + return undef unless defined $properties; + return undef unless exists $properties->{className}; my $className = $class->loadModule($session, $properties->{className}); - return unless (defined $className); + return undef unless (defined $className); bless {_session=>$session, _properties => $properties}, $className; } @@ -1884,7 +1884,7 @@ sub newByUrl { return WebGUI::Asset->new($session,$id, $class, $revisionDate); } else { $session->errorHandler->warn("The URL $url was requested, but does not exist in your asset tree."); - return; + return undef; } } return WebGUI::Asset->getDefault($session); @@ -1948,7 +1948,7 @@ sub processPropertiesFromFormPost { $self->session->db->beginTransaction; $self->update(\%data); $self->session->db->commit; - return; + return undef; } @@ -2282,7 +2282,7 @@ sub www_add { my $self = shift; my %prototypeProperties; my $class = $self->loadModule($self->session, $self->session->form->process("class","className")); - return unless (defined $class); + return undef unless (defined $class); return $self->session->privilege->insufficient() unless ($class->canAdd($self->session)); if ($self->session->form->process('prototype')) { my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class); @@ -2380,7 +2380,7 @@ sub www_changeUrlConfirm { return 'redirect'; } - return; + return undef; } #------------------------------------------------------------------- @@ -2564,7 +2564,7 @@ sub www_view { return $check if (defined $check); $self->prepareView; $self->session->output->print($self->view); - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 057aedb81..fca5e7aae 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -298,7 +298,7 @@ sub getDateTimeStart { #$self->session->errorHandler->warn($self->getId.":: Date: $date -- Time: $time"); if (!$date) { $self->session->errorHandler->warn("Event::getDateTimeStart -- This event (".$self->get("assetId").") has no start date."); - return; + return undef; } if ($time) { @@ -337,7 +337,7 @@ sub getDateTimeEnd { #$self->session->errorHandler->warn($self->getId.":: Date: $date -- Time: $time"); if (!$date) { $self->session->errorHandler->warn("Event::getDateTimeEnd -- This event (".$self->get("assetId").") has no end date."); - return; + return undef; } if ($time) { @@ -405,7 +405,7 @@ sub getEventNext { }); - return unless $events->[0]; + return undef unless $events->[0]; return WebGUI::Asset->newByDynamicClass($self->session,$events->[0]); } @@ -461,7 +461,7 @@ sub getEventPrev { limit => 1, }); - return unless $events->[0]; + return undef unless $events->[0]; return WebGUI::Asset->newByDynamicClass($self->session,$events->[0]); } @@ -711,7 +711,7 @@ sub getRecurrenceDates { my %date; my $recur = {$self->getRecurrence}; - return unless $recur->{recurType}; + return undef unless $recur->{recurType}; my %dayNames = ( monday => "m", @@ -1650,7 +1650,7 @@ sub processPropertiesFromFormPost { delete $self->{_storageLocation}; $self->requestAutoCommit; - return; + return undef; } #------------------------------------------------------------------- @@ -1691,7 +1691,7 @@ sub setRecurrence { my $self = shift; my $vars = shift; - my $type = $vars->{recurType} || return; + my $type = $vars->{recurType} || return undef; my $pattern; if ($type eq "daily" || $type eq "weekday") { @@ -1794,7 +1794,7 @@ sub setRelatedLinks { } } - return; + return undef; } #################################################################### diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index e4de5744e..2442a31f4 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -230,7 +230,7 @@ sub getFileUrl { #------------------------------------------------------------------- sub getFileIconUrl { my $self = shift; - return unless $self->get("filename"); ## Why do I have to do this when creating new Files? + return undef unless $self->get("filename"); ## Why do I have to do this when creating new Files? return $self->getStorageLocation->getFileIconUrl($self->get("filename")); } @@ -337,7 +337,7 @@ sub processPropertiesFromFormPost { $storage->delete; } - return; + return undef; } @@ -483,7 +483,7 @@ sub updatePropertiesFromStorage { $self->update({ filename => $filename, }); - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/File/Image.pm b/lib/WebGUI/Asset/File/Image.pm index ff7baea00..f06f10d0b 100644 --- a/lib/WebGUI/Asset/File/Image.pm +++ b/lib/WebGUI/Asset/File/Image.pm @@ -208,7 +208,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e sub getToolbar { my $self = shift; - return if ($self->getToolbarState); + return undef if ($self->getToolbarState); return $self->SUPER::getToolbar(); } diff --git a/lib/WebGUI/Asset/File/Image/Photo.pm b/lib/WebGUI/Asset/File/Image/Photo.pm index 22670d1d3..4702c79b6 100644 --- a/lib/WebGUI/Asset/File/Image/Photo.pm +++ b/lib/WebGUI/Asset/File/Image/Photo.pm @@ -677,7 +677,7 @@ sub updateExifDataFromFile { my $self = shift; my $storage = $self->getStorageLocation; - return; + return undef; my $info = ImageInfo( $storage->getPath( $self->get('filename') ) ); use Data::Dumper; $self->session->errorHandler->info( Dumper $info ); $self->update({ diff --git a/lib/WebGUI/Asset/File/ZipArchive.pm b/lib/WebGUI/Asset/File/ZipArchive.pm index aed826a9b..ac99abc27 100644 --- a/lib/WebGUI/Asset/File/ZipArchive.pm +++ b/lib/WebGUI/Asset/File/ZipArchive.pm @@ -167,20 +167,20 @@ sub processPropertiesFromFormPost { my $file = $self->get("filename"); - #return unless $file; + #return undef unless $file; my $i18n = WebGUI::International->new($self->session, 'Asset_ZipArchive'); unless ($self->session->form->process("showPage")) { $storage->delete; $self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId)); $self->session->scratch->set("za_error",$i18n->get("za_show_error")); - return; + return undef; } unless ($file =~ m/\.tar/i || $file =~ m/\.zip/i) { $storage->delete; $self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId)); $self->session->scratch->set("za_error",$i18n->get("za_error")); - return; + return undef; } unless ($self->unzip($storage,$self->get("filename"))) { diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index e30e13e4f..988852fa5 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -48,7 +48,7 @@ sub addChild { my @other = @_; if ($properties->{className} ne "WebGUI::Asset::Post") { $self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className")); - return; + return undef; } return $self->SUPER::addChild($properties, @other); } @@ -371,7 +371,7 @@ sub getEditUrl { #------------------------------------------------------------------- sub getImageUrl { my $self = shift; - return if ($self->get("storageId") eq ""); + return undef if ($self->get("storageId") eq ""); my $storage = $self->getStorageLocation; my $url; foreach my $filename (@{$storage->getFiles}) { @@ -578,7 +578,7 @@ sub getThread { #------------------------------------------------------------------- sub getThumbnailUrl { my $self = shift; - return if ($self->get("storageId") eq ""); + return undef if ($self->get("storageId") eq ""); my $storage = $self->getStorageLocation; my $url; foreach my $filename (@{$storage->getFiles}) { @@ -663,8 +663,8 @@ An integer indicating either thumbss up (+1) or thumbs down (-1) sub insertUserPostRating { my $self = shift; my $rating = shift; - return unless ($rating == -1 || $rating == 1); - return if $self->hasRated; + return undef unless ($rating == -1 || $rating == 1); + return undef if $self->hasRated; $self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values (?,?,?,?,?)", [$self->getId, $self->session->user->userId, @@ -914,8 +914,8 @@ An integer indicating either thumbss up (+1) or thumbs down (-1) sub rate { my $self = shift; my $rating = shift; - return unless ($rating == -1 || $rating == 1); - return if $self->hasRated; + return undef unless ($rating == -1 || $rating == 1); + return undef if $self->hasRated; $self->insertUserPostRating($rating); $self->recalculatePostRating(); $self->getThread->updateThreadRating(); diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 3fe020199..3db8d96a7 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -86,7 +86,7 @@ sub duplicateBranch { #------------------------------------------------------------------- sub createSubscriptionGroup { my $self = shift; - return if ($self->get("subscriptionGroupId")); + return undef if ($self->get("subscriptionGroupId")); my $group = WebGUI::Group->new($self->session, "new"); $group->name($self->getId); $group->description("The group to store subscriptions for the thread ".$self->getId); @@ -167,7 +167,7 @@ sub definition { sub DESTROY { my $self = shift; - return unless defined $self; + return undef unless defined $self; $self->{_next}->DESTROY if (defined $self->{_next}); $self->{_previous}->DESTROY if (defined $self->{_previous}); $self->SUPER::DESTROY; @@ -594,8 +594,8 @@ An integer between 1 and 5 (5 being best) to rate this post with. sub rate { my $self = shift; my $rating = shift; - return unless ($rating == -1 || $rating == 1); - return if $self->hasRated; + return undef unless ($rating == -1 || $rating == 1); + return undef if $self->hasRated; $self->SUPER::rate($rating); ##Thread specific karma adjustment for CS diff --git a/lib/WebGUI/Asset/RSSCapable.pm b/lib/WebGUI/Asset/RSSCapable.pm index 3a648aa73..cc43e2019 100644 --- a/lib/WebGUI/Asset/RSSCapable.pm +++ b/lib/WebGUI/Asset/RSSCapable.pm @@ -144,7 +144,7 @@ sub processPropertiesFromFormPost { $self->_ensureRssFromParentAbsent; } - return; + return undef; } #------------------------------------------------------------------- @@ -159,7 +159,7 @@ if there is no such feed. sub getRssUrl { my $self = shift; my $rssFromParentId = $self->get('rssCapableRssFromParentId'); - return unless defined $rssFromParentId; + return undef unless defined $rssFromParentId; WebGUI::Asset->newByDynamicClass($self->session, $rssFromParentId)->getUrl; } diff --git a/lib/WebGUI/Asset/RichEdit.pm b/lib/WebGUI/Asset/RichEdit.pm index a5cf9362a..691558f6a 100644 --- a/lib/WebGUI/Asset/RichEdit.pm +++ b/lib/WebGUI/Asset/RichEdit.pm @@ -422,7 +422,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e sub getToolbar { my $self = shift; - return if ($self->getToolbarState); + return undef if ($self->getToolbarState); return $self->SUPER::getToolbar(); } diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 5bc9714e7..8bcc32bd0 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -365,7 +365,7 @@ sub getOverridesList { $output .= ''; $output .= ''; my $shortcut = $self->getShortcutOriginal; - return unless defined $shortcut; + return undef unless defined $shortcut; foreach my $definition (@{$shortcut->definition($self->session)}) { foreach my $prop (keys %{$definition->{properties}}) { next if $definition->{properties}{$prop}{fieldType} eq 'hidden'; diff --git a/lib/WebGUI/Asset/Snippet.pm b/lib/WebGUI/Asset/Snippet.pm index aae8ef770..69db98952 100644 --- a/lib/WebGUI/Asset/Snippet.pm +++ b/lib/WebGUI/Asset/Snippet.pm @@ -117,7 +117,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e sub getToolbar { my $self = shift; - return if ($self->getToolbarState); + return undef if ($self->getToolbarState); return '

'.$self->SUPER::getToolbar().'

'; } diff --git a/lib/WebGUI/Asset/WikiPage.pm b/lib/WebGUI/Asset/WikiPage.pm index 151274a0e..38926dd1d 100644 --- a/lib/WebGUI/Asset/WikiPage.pm +++ b/lib/WebGUI/Asset/WikiPage.pm @@ -27,7 +27,7 @@ You can't add children to a wiki page. =cut sub addChild { - return; + return undef; } #------------------------------------------------------------------- @@ -185,7 +185,7 @@ sub getEditForm { sub getWiki { my $self = shift; my $parent = $self->getParent; - return unless defined $parent and $parent->isa('WebGUI::Asset::Wobject::WikiMaster'); + return undef unless defined $parent and $parent->isa('WebGUI::Asset::Wobject::WikiMaster'); return $parent; } diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm index da40ba68d..10df5ac3f 100644 --- a/lib/WebGUI/Asset/Wobject/Calendar.pm +++ b/lib/WebGUI/Asset/Wobject/Calendar.pm @@ -267,7 +267,7 @@ sub addChild { if ($properties->{className} ne "WebGUI::Asset::Event") { $self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className")); - return; + return undef; } return $self->SUPER::addChild($properties, @other); @@ -360,7 +360,7 @@ sub createSubscriptionGroup { groupIdSubscription => $group->getId }); - return; + return undef; } @@ -579,7 +579,7 @@ this Calendar. sub getEvent { my $self = shift; my $assetId = shift; - # Warn and return if no assetId + # Warn and return undef if no assetId $self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEvent :: No asset ID."), return unless $assetId; @@ -632,10 +632,10 @@ sub getEventsIn { my $tz = $self->session->user->profileField("timeZone"); - # Warn and return if no startDate or endDate + # Warn and return undef if no startDate or endDate unless ($start && $end) { $self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEventsIn() called with not enough arguments at ".join('::',(caller)[1,2])); - return; + return undef; } # Create objects and adjust for timezone diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index d70749ad2..d3a1fca45 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -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; + return undef; } return $self->SUPER::addChild($properties, @other); } diff --git a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm index b36faddd0..031377684 100644 --- a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm +++ b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm @@ -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 unless $isApproved; + return undef 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 if $isChild; + return undef 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 unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered)); + return undef 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]):(); @@ -1397,7 +1397,7 @@ sub verifyPrerequisitesForm { my %var; #If there is no missing event data, return nothing - return unless scalar(@$missingEventMessageLoop); + return undef unless scalar(@$missingEventMessageLoop); my $i18n = WebGUI::International->new($self->session, 'Asset_EventManagementSystem'); diff --git a/lib/WebGUI/Asset/Wobject/Gallery/Utility.pm b/lib/WebGUI/Asset/Wobject/Gallery/Utility.pm index d529a788c..979ed9699 100644 --- a/lib/WebGUI/Asset/Wobject/Gallery/Utility.pm +++ b/lib/WebGUI/Asset/Wobject/Gallery/Utility.pm @@ -102,7 +102,7 @@ sub addAlbumFromCollaboration { $class->addAlbumFromThread( $gallery, $thread ); } - return; + return undef; } #---------------------------------------------------------------------------- @@ -126,7 +126,7 @@ sub addAlbumFromFilesystem { # TODO!!! - return; + return undef; } #---------------------------------------------------------------------------- @@ -198,7 +198,7 @@ sub addAlbumFromThread { } } - return; + return undef; } 1; diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index 7562852f7..789cc4b75 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -141,7 +141,7 @@ sub addArchive { }); $versionTag->requestCommit; - return; + return undef; } #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index b1eb3fada..fada45951 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -97,7 +97,7 @@ sub definition { #------------------------------------------------------------------- sub duplicate { # Buggo: how do we duplicate these? - return; + return undef; } diff --git a/lib/WebGUI/Asset/Wobject/Poll.pm b/lib/WebGUI/Asset/Wobject/Poll.pm index 5967f235d..8d930de8f 100644 --- a/lib/WebGUI/Asset/Wobject/Poll.pm +++ b/lib/WebGUI/Asset/Wobject/Poll.pm @@ -299,7 +299,7 @@ sub getGraphConfig { my $self = shift; my $config = $self->get("graphConfiguration"); - return unless $config; + return undef unless $config; return $self->thawGraphConfig($config); } diff --git a/lib/WebGUI/Asset/Wobject/ProjectManager.pm b/lib/WebGUI/Asset/Wobject/ProjectManager.pm index 387a2f02e..21b2a319c 100644 --- a/lib/WebGUI/Asset/Wobject/ProjectManager.pm +++ b/lib/WebGUI/Asset/Wobject/ProjectManager.pm @@ -57,7 +57,7 @@ sub _clobberImproperDependants { my $self = shift; my $projectId = shift; my @nondependTaskIds = $self->session->db->buildArray("SELECT sequenceNumber FROM PM_task WHERE projectId = ? AND taskType <> 'timed'", [$projectId]); - return unless @nondependTaskIds; + return undef unless @nondependTaskIds; $self->session->db->write("UPDATE PM_task SET dependants = NULL WHERE projectId = ? AND dependants IN (".join(', ', ('?') x @nondependTaskIds).")", [$projectId, @nondependTaskIds]); } @@ -444,12 +444,12 @@ sub getProjectInstance { my $session = shift; my $db = $session->db; my $projectId = $_[0]; - return unless $projectId; + return undef unless $projectId; my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]); if($assetId) { return WebGUI::Asset->newByDynamicClass($session,$assetId); } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index ccc0dd13b..12e904169 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -824,8 +824,8 @@ recent revision will be fetched. sub _getFileFromDatabase { my ($constraint, $dbLink); my $self = shift; - my $recordId = shift || return; - my $fieldName = shift || return; + my $recordId = shift || return undef; + my $fieldName = shift || return undef; my $revision = shift; $dbLink = $self->_getDbLink; @@ -4086,7 +4086,7 @@ sub _constructSearchQuery { my $searchType = ($self->session->form->process("searchType") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchType')) eq 'and' ? 'and' : 'or'; - return if (!@constraints); + return undef if (!@constraints); # Construct the search query my $sortField = @sortClauses ? ('('.join('+', @sortClauses).') AS sqlform_orderby') : '1 AS sqlform_orderby'; @@ -4260,7 +4260,7 @@ sub _clearScratch { $scratch->delete("SQLForm_${id}$tag"); } - return; # nothing explicitly + return undef; # nothing explicitly } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/SQLReport.pm b/lib/WebGUI/Asset/Wobject/SQLReport.pm index 51cdc481e..d5115bc84 100644 --- a/lib/WebGUI/Asset/Wobject/SQLReport.pm +++ b/lib/WebGUI/Asset/Wobject/SQLReport.pm @@ -286,7 +286,7 @@ sub getEditForm { function toggleQuery(Id) { queryClass = "query" + Id; var tr = document.getElementsByTagName("tr"); - if (tr == null) return; + if (tr == null) return undef; for (i=0; i < tr.length; i++) { if(tr[i].className == queryClass) { if(tr[i].style.display == 'none') { @@ -384,7 +384,7 @@ sub download { my $self = shift; # Instead of going through some costly exercises... - return if ($self->getValue("downloadType") eq "none"); + return undef if ($self->getValue("downloadType") eq "none"); # Initiate an empty debug loop $self->{_debug_loop} = [] ; @@ -419,7 +419,7 @@ sub download { } else { # I don't know what to do - return; + return undef; } } @@ -705,7 +705,7 @@ sub www_download { my $self = shift; # Only allow if download type is not "none" - return if $self->getValue("downloadType") eq "none"; + return undef if $self->getValue("downloadType") eq "none"; # Only allow users in appropriate group return $self->session->privilege->noAccess() diff --git a/lib/WebGUI/Asset/Wobject/StockData.pm b/lib/WebGUI/Asset/Wobject/StockData.pm index 4edcb88c9..f3a5dadd0 100644 --- a/lib/WebGUI/Asset/Wobject/StockData.pm +++ b/lib/WebGUI/Asset/Wobject/StockData.pm @@ -154,7 +154,7 @@ sub _convertToEpoch { my $time = $_[1]; unless ($date =~ m{^\d+/\d+/\d+} and $time =~ m{^\d+:\d+}) { - return; + return undef; } my ($month,$day,$year) = split("/",$date); diff --git a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm index 822ab1bf5..232680fe7 100644 --- a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm @@ -279,7 +279,7 @@ sub _find_record { } } - return; + return undef; } #------------------------------------------------------------------- @@ -338,7 +338,7 @@ sub _get_rss_data { if (!$response->is_success()) { $session->errorHandler->warn("Error retrieving url '$url': " . $response->status_line()); - return; + return undef; } my $xml = $response->content(); @@ -370,7 +370,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; + return undef; } # make sure that the {channel} points to the channel diff --git a/lib/WebGUI/Asset/Wobject/WSClient.pm b/lib/WebGUI/Asset/Wobject/WSClient.pm index 48bb5f6b6..90643b94c 100644 --- a/lib/WebGUI/Asset/Wobject/WSClient.pm +++ b/lib/WebGUI/Asset/Wobject/WSClient.pm @@ -376,7 +376,7 @@ sub view { # hashref } elsif (ref $return eq 'HASH') { - @result = $return; + @result = $return undef; # blessed object, to be stripped with Data::Structure::Util } elsif ( ref $return) { diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm index c4282b098..1ec31eaad 100644 --- a/lib/WebGUI/AssetClipboard.pm +++ b/lib/WebGUI/AssetClipboard.pm @@ -48,7 +48,7 @@ Removes asset from lineage, places it in clipboard state. The "gap" in the linea sub cut { my $self = shift; - return if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage")); + return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage")); $self->session->db->beginTransaction; $self->session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']); $self->session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$self->session->user->userId, $self->session->datetime->time(), $self->getId]); diff --git a/lib/WebGUI/AssetPackage.pm b/lib/WebGUI/AssetPackage.pm index 4cb6b13c0..9ee86562a 100644 --- a/lib/WebGUI/AssetPackage.pm +++ b/lib/WebGUI/AssetPackage.pm @@ -265,7 +265,7 @@ sub www_deployPackage { my $packageMasterAsset = WebGUI::Asset->newByDynamicClass($self->session, $packageMasterAssetId); unless ($packageMasterAsset->getValue('isPackage')) { #only deploy packages $self->session->errorHandler->security('deploy an asset as a package which was not set as a package.'); - return; + return undef; } my $masterLineage = $packageMasterAsset->get("lineage"); if (defined $packageMasterAsset && $packageMasterAsset->canView && $self->get("lineage") !~ /^$masterLineage/) { diff --git a/lib/WebGUI/AssetTrash.pm b/lib/WebGUI/AssetTrash.pm index 5b97f6bfe..2b64963fa 100644 --- a/lib/WebGUI/AssetTrash.pm +++ b/lib/WebGUI/AssetTrash.pm @@ -212,7 +212,7 @@ lineage is changed in state to trash-limbo. sub trash { my $self = shift; - return if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage")); + return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage")); foreach my $asset ($self, @{$self->getLineage(['descendants'], {returnObjects => 1})}) { $asset->_invokeWorkflowOnExportedFiles($self->session->setting->get('trashWorkflow'), 1); } diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index 1c4797847..548b736ff 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -180,7 +180,7 @@ Override this method in your asset if you want your asset to automatically run i =cut sub getAutoCommitWorkflowId { - return; + return undef; } #------------------------------------------------------------------- @@ -306,7 +306,7 @@ Returns the user who locked this asset, or undef if the asset is unlocked. sub lockedBy { my $self = shift; my $userId = $self->get("isLockedBy"); - return unless defined $userId; + return undef unless defined $userId; return WebGUI::User->new($self->session, $userId); } @@ -543,9 +543,9 @@ sub www_purgeRevision { my $session = $self->session; return $session->privilege->insufficient() unless $self->canEdit; my $revisionDate = $session->form->process("revisionDate"); - return unless $revisionDate; + return undef unless $revisionDate; my $asset = WebGUI::Asset->new($session,$self->getId,$self->get("className"),$revisionDate); - return if ($asset->get('revisionDate') != $revisionDate); + return undef if ($asset->get('revisionDate') != $revisionDate); my $parent = $asset->getParent; $asset->purgeRevision; if ($session->form->process("proceed") eq "manageRevisionsInTag") { diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm index c3ada6e8d..2b6b8cc58 100644 --- a/lib/WebGUI/Auth.pm +++ b/lib/WebGUI/Auth.pm @@ -304,7 +304,7 @@ sub createAccountSave { ); } - return; + return undef; } #------------------------------------------------------------------- @@ -364,7 +364,7 @@ sub deactivateAccountConfirm { #}); $self->logout; - return; + return undef; } #------------------------------------------------------------------- @@ -680,7 +680,7 @@ sub login { $self->session->errorHandler->warn($error) if $error; } - return; + return undef; } #------------------------------------------------------------------- @@ -705,7 +705,7 @@ sub logout { $self->session->errorHandler->warn($error) if $error; } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index 9ed382420..f78b02125 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -251,7 +251,7 @@ sub createAccountSave { $self->logout; return $self->displayLogin($i18n->get('check email for validation','AuthWebGUI')); } - return; + return undef; } #------------------------------------------------------------------- @@ -577,7 +577,7 @@ sub editUserSettingsFormSave { return \@errors; } else { - return; + return undef; } } diff --git a/lib/WebGUI/Cache/Database.pm b/lib/WebGUI/Cache/Database.pm index 77dd446d1..41e6b14b4 100644 --- a/lib/WebGUI/Cache/Database.pm +++ b/lib/WebGUI/Cache/Database.pm @@ -94,7 +94,7 @@ Retrieve content from the filesystem cache. sub get { my $self = shift; - return if ($self->session->config->get("disableCache")); + return undef if ($self->session->config->get("disableCache")); # getting better performance using native dbi than webgui sql my $dbh = $self->session->db->dbh; my $sth = $dbh->prepare("select content from cache where namespace=? and cachekey=? and expires>?"); @@ -102,7 +102,7 @@ sub get { my $data = $sth->fetchrow_arrayref; $sth->finish; my $content = $data->[0]; - return unless ($content); + return undef unless ($content); # Storable doesn't like non-reference arguments, so we wrap it in a scalar ref. return ${thaw($content)}; } diff --git a/lib/WebGUI/Cache/FileCache.pm b/lib/WebGUI/Cache/FileCache.pm index 6f825acd9..779426d98 100644 --- a/lib/WebGUI/Cache/FileCache.pm +++ b/lib/WebGUI/Cache/FileCache.pm @@ -105,12 +105,12 @@ Retrieve content from the filesystem cache. sub get { my $self = shift; - return if ($self->session->config->get("disableCache")); + return undef if ($self->session->config->get("disableCache")); my $folder = $self->getFolder; if (-e $folder."/expires" && -e $folder."/cache" && open(my $FILE,"<",$folder."/expires")) { my $expires = <$FILE>; close($FILE); - return if ($expires < $self->session->datetime->time()); + return undef if ($expires < $self->session->datetime->time()); my $value; eval {$value = retrieve($folder."/cache")}; if (ref $value eq "SCALAR") { @@ -119,7 +119,7 @@ sub get { return $value; } } - return; + return undef; } #------------------------------------------------------------------- @@ -171,7 +171,7 @@ sub getNamespaceSize { my $expiresModifier = shift || 0; $self->session->stow->set("cacheSize", 0); File::Find::find({no_chdir=>1, wanted=> sub { - return unless $File::Find::name =~ m/^(.*)expires$/; + return undef unless $File::Find::name =~ m/^(.*)expires$/; my $dir = $1; if (open(my $FILE,"<",$dir."/expires")) { my $expires = <$FILE>; @@ -244,7 +244,7 @@ sub set { eval {mkpath($path,0)}; if ($@) { $self->session->errorHandler->error("Couldn't create cache folder: ".$path." : ".$@); - return; + return undef; } } my $value; diff --git a/lib/WebGUI/Commerce/Item.pm b/lib/WebGUI/Commerce/Item.pm index 9146f248c..fac417781 100644 --- a/lib/WebGUI/Commerce/Item.pm +++ b/lib/WebGUI/Commerce/Item.pm @@ -84,7 +84,7 @@ undef if it's not recurring. =cut sub duration { - return; + return undef; } #------------------------------------------------------------------- @@ -97,7 +97,7 @@ your item you don't have to override this method or if you do, you can just retu =cut sub handler { - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Commerce/Payment.pm b/lib/WebGUI/Commerce/Payment.pm index f727749b8..1eafcb8e4 100644 --- a/lib/WebGUI/Commerce/Payment.pm +++ b/lib/WebGUI/Commerce/Payment.pm @@ -134,7 +134,7 @@ You only need to override this method if your gateway uses a webbased contacting =cut sub confirmRecurringTransaction { - return; + return undef; } #------------------------------------------------------------------- @@ -277,7 +277,7 @@ The term number you want the status of. =cut sub getRecurringPaymentStatus { - return; + return undef; } #------------------------------------------------------------------- @@ -383,7 +383,7 @@ A hashref containing: =cut sub normalTransaction { - return; + return undef; } #------------------------------------------------------------------- @@ -408,7 +408,7 @@ A hashref containing: =cut sub recurringTransaction { - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Commerce/Payment/Cash.pm b/lib/WebGUI/Commerce/Payment/Cash.pm index 6aa22a797..c27a0ea91 100644 --- a/lib/WebGUI/Commerce/Payment/Cash.pm +++ b/lib/WebGUI/Commerce/Payment/Cash.pm @@ -36,7 +36,7 @@ our @ISA = qw(WebGUI::Commerce::Payment); #------------------------------------------------------------------- sub connectionError { - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Commerce/Payment/ITransact.pm b/lib/WebGUI/Commerce/Payment/ITransact.pm index 2245a7fb2..288fd806d 100644 --- a/lib/WebGUI/Commerce/Payment/ITransact.pm +++ b/lib/WebGUI/Commerce/Payment/ITransact.pm @@ -119,7 +119,7 @@ sub connectionError { $self = shift; return $self->resultMessage if ($self->{_connectionError}); - return; + return undef; } #------------------------------------------------------------------- @@ -325,7 +325,7 @@ sub getRecurringPaymentStatus { my $transactionData = $self->session->db->quickHashRef("select * from ITransact_recurringStatus where gatewayId=".$self->session->db->quote($recurringId)); unless ($transactionData->{recipe}) { # if for some reason there's no transaction data, we shouldn't calc anything $self->session->errorHandler->error("For some reason recurring transaction $recurringId doesn't have any recurring status transaction data. This is most likely because you don't have the Recurring Postback URL set in your ITransact virtual terminal."); - return; + return undef; } my $lastTerm = int(($transactionData->{lastTransaction} - $transactionData->{initDate}) / $resolve{$transactionData->{recipe}}) + 1; @@ -337,7 +337,7 @@ sub getRecurringPaymentStatus { $paymentHistory{resultCode} = $transactionData->{status}.' '.$transactionData->{errorMessage}; $paymentHistory{resultCode} = 0 if $transactionData->{status} eq 'OK'; } else { - return; + return undef; } return \%paymentHistory; @@ -350,7 +350,7 @@ sub errorCode { $resultCode = $self->{_response}->{Status}; return $resultCode unless ($resultCode eq 'OK'); - return; + return undef; } #------------------------------------------------------------------- @@ -607,7 +607,7 @@ sub transactionError { $resultCode = $self->resultCode; return $self->resultMessage if ($resultCode ne 'OK'); - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Commerce/Shipping.pm b/lib/WebGUI/Commerce/Shipping.pm index 6d6e251f6..88ec3c8cc 100644 --- a/lib/WebGUI/Commerce/Shipping.pm +++ b/lib/WebGUI/Commerce/Shipping.pm @@ -401,7 +401,7 @@ you'll have to overload this method. Defaults to undef. =cut sub trackingNumber { - return; + return undef; } #------------------------------------------------------------------- @@ -414,7 +414,7 @@ info of his package. Overload this method if your plugin supports tracking. Defa =cut sub trackingUrl { - return; + return undef; } 1; diff --git a/lib/WebGUI/Commerce/Transaction.pm b/lib/WebGUI/Commerce/Transaction.pm index b1c4ec737..9108d5d26 100644 --- a/lib/WebGUI/Commerce/Transaction.pm +++ b/lib/WebGUI/Commerce/Transaction.pm @@ -95,7 +95,7 @@ sub cancelTransaction { $self->status('Canceled'); - return; + return undef; } #------------------------------------------------------------------- @@ -293,7 +293,7 @@ sub getByGatewayId { " and gateway=".$self->session->db->quote($paymentGateway)); return WebGUI::Commerce::Transaction->new($self->session, $transactionId) if $transactionId; - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Content/Asset.pm b/lib/WebGUI/Content/Asset.pm index ac5d2eef7..14b920736 100644 --- a/lib/WebGUI/Content/Asset.pm +++ b/lib/WebGUI/Content/Asset.pm @@ -206,7 +206,7 @@ sub tryAssetMethod { my $asset = shift; my $method = shift; my $state = $asset->get("state"); - return if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published + return undef if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published $session->asset($asset); my $methodToTry = "www_".$method; my $output = eval{$asset->$methodToTry()}; diff --git a/lib/WebGUI/Content/Maintenance.pm b/lib/WebGUI/Content/Maintenance.pm index ce87385b8..06ec50b16 100644 --- a/lib/WebGUI/Content/Maintenance.pm +++ b/lib/WebGUI/Content/Maintenance.pm @@ -56,7 +56,7 @@ sub handler { close($FILE); return $output; } - return; + return undef; } diff --git a/lib/WebGUI/Content/Prefetch.pm b/lib/WebGUI/Content/Prefetch.pm index 0c344f23c..60d51caf7 100644 --- a/lib/WebGUI/Content/Prefetch.pm +++ b/lib/WebGUI/Content/Prefetch.pm @@ -52,7 +52,7 @@ sub handler { $http->sendHeader; return "none"; } - return; + return undef; } 1; diff --git a/lib/WebGUI/Content/Setup.pm b/lib/WebGUI/Content/Setup.pm index d1cdc3cb0..8039c4d8c 100644 --- a/lib/WebGUI/Content/Setup.pm +++ b/lib/WebGUI/Content/Setup.pm @@ -112,7 +112,7 @@ The current WebGUI::Session object. sub handler { my $session = shift; unless ($session->setting->get("specialState") eq "init") { - return; + return undef; } $session->http->setCacheControl("none"); my $i18n = WebGUI::International->new($session, "WebGUI"); @@ -489,7 +489,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; } # remove init state $session->setting->remove('specialState'); $session->http->setRedirect($session->url->gateway("?setup=complete")); - return; + return undef; } else { $legend = "Admin Acccount"; diff --git a/lib/WebGUI/DatabaseLink.pm b/lib/WebGUI/DatabaseLink.pm index 65360385c..32ab90c1d 100644 --- a/lib/WebGUI/DatabaseLink.pm +++ b/lib/WebGUI/DatabaseLink.pm @@ -248,7 +248,7 @@ sub db { } else { $self->session->errorHandler->warn("DatabaseLink [".$self->getId."] The DSN specified is of an improper format."); } - return; + return undef; } #------------------------------------------------------------------- @@ -344,7 +344,7 @@ sub new { unless (defined($databaseLink{databaseLinkId})) { $session->errorHandler->warn("Could not find database link '".$databaseLinkId."'"); - return; + return undef; } bless {_session=>$session, _databaseLink => \%databaseLink }, $class; diff --git a/lib/WebGUI/DateTime.pm b/lib/WebGUI/DateTime.pm index b45921972..d123e2252 100755 --- a/lib/WebGUI/DateTime.pm +++ b/lib/WebGUI/DateTime.pm @@ -171,7 +171,7 @@ sub new # If no DateTime object created yet, I don't know how unless ($self) { - return; + return undef; } @@ -548,7 +548,7 @@ A string representing the output format for the date. Defaults to '%z %Z'. You c sub webguiDate { my $self = shift; my $session = $self->session; - return unless ($session); + return undef unless ($session); my $format = shift || "%z %Z"; my $temp; diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm index 398ae446f..529c0ad4e 100644 --- a/lib/WebGUI/Form.pm +++ b/lib/WebGUI/Form.pm @@ -68,7 +68,7 @@ sub AUTOLOAD { my $control = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::".$name, "new", [ $session, @params ]) }; if ($@) { $session->errorHandler->error($@); - return; + return undef; } return $control->toHtml; } diff --git a/lib/WebGUI/Form/Checkbox.pm b/lib/WebGUI/Form/Checkbox.pm index 44b64c1db..4899b56af 100644 --- a/lib/WebGUI/Form/Checkbox.pm +++ b/lib/WebGUI/Form/Checkbox.pm @@ -91,7 +91,7 @@ A class method that returns a value to be used as the autogenerated ID for this =cut sub generateIdParameter { - return; + return undef; } #------------------------------------------------------------------- @@ -112,7 +112,7 @@ sub getValueFromPost { if (defined $formValue) { return $formValue; } else { - return; + return undef; } } diff --git a/lib/WebGUI/Form/Color.pm b/lib/WebGUI/Form/Color.pm index 6bd00ed7c..8f985530e 100644 --- a/lib/WebGUI/Form/Color.pm +++ b/lib/WebGUI/Form/Color.pm @@ -75,7 +75,7 @@ An optional value to use instead of POST input. sub getValueFromPost { my $self = shift; my $color = @_ ? shift : $self->session->form->param($self->get("name")); - return unless $color =~ /\#\w{6}/; + return undef unless $color =~ /\#\w{6}/; return $color; } diff --git a/lib/WebGUI/Form/DynamicField.pm b/lib/WebGUI/Form/DynamicField.pm index fd266e55f..6788a948c 100644 --- a/lib/WebGUI/Form/DynamicField.pm +++ b/lib/WebGUI/Form/DynamicField.pm @@ -118,7 +118,7 @@ sub new { eval ($load); if ($@) { $session->errorHandler->error("Couldn't compile form control: ".$fieldType.". Root cause: ".$@); - return; + return undef; } my $formObj = $cmd->new($session, $param); if ($formObj->isa('WebGUI::Form::List')) { diff --git a/lib/WebGUI/Form/Email.pm b/lib/WebGUI/Form/Email.pm index bc83081d0..dee8a5434 100644 --- a/lib/WebGUI/Form/Email.pm +++ b/lib/WebGUI/Form/Email.pm @@ -86,7 +86,7 @@ sub getValueFromPost { if ($value =~ /^([0-9a-zA-Z]([-.+\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/i) { return $value; } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/File.pm b/lib/WebGUI/Form/File.pm index ff1b0a1a1..2d820f763 100644 --- a/lib/WebGUI/Form/File.pm +++ b/lib/WebGUI/Form/File.pm @@ -220,14 +220,14 @@ sub getValueFromPost { my @files = @{ $storage->getFiles }; if (scalar(@files) < 1) { $storage->delete; - return; + return undef; } else { my $id = $storage->getId; $self->set("value", $id); return $id; } } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/Hidden.pm b/lib/WebGUI/Form/Hidden.pm index 8d8599089..f701ca168 100644 --- a/lib/WebGUI/Form/Hidden.pm +++ b/lib/WebGUI/Form/Hidden.pm @@ -77,7 +77,7 @@ A class method that returns a value to be used as the autogenerated ID for this =cut sub generateIdParameter { - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/Image.pm b/lib/WebGUI/Form/Image.pm index 014b71d22..4442f8bdb 100644 --- a/lib/WebGUI/Form/Image.pm +++ b/lib/WebGUI/Form/Image.pm @@ -200,7 +200,7 @@ sub getValueFromPost { @files = @images; } - return unless @files; + return undef unless @files; $storage->generateThumbnail($_) for @images; # Make a thumbnail for each filename in @images } } diff --git a/lib/WebGUI/Form/List.pm b/lib/WebGUI/Form/List.pm index d90e8b88d..00885766c 100644 --- a/lib/WebGUI/Form/List.pm +++ b/lib/WebGUI/Form/List.pm @@ -93,7 +93,7 @@ method. sub correctValues { my ($self, $value) = @_; - return unless defined $value; + return undef unless defined $value; my @defaultValues; if (ref $value eq "ARRAY") { @defaultValues = @{ $value }; diff --git a/lib/WebGUI/Form/Phone.pm b/lib/WebGUI/Form/Phone.pm index 10ddb27c4..fed9bae9b 100644 --- a/lib/WebGUI/Form/Phone.pm +++ b/lib/WebGUI/Form/Phone.pm @@ -86,7 +86,7 @@ sub getValueFromPost { if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) { return $value; } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/Radio.pm b/lib/WebGUI/Form/Radio.pm index 67287669a..cc43a7384 100644 --- a/lib/WebGUI/Form/Radio.pm +++ b/lib/WebGUI/Form/Radio.pm @@ -85,7 +85,7 @@ A class method that returns a value to be used as the autogenerated ID for this =cut sub generateIdParameter { - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/ReadOnly.pm b/lib/WebGUI/Form/ReadOnly.pm index 04c04b74a..c9ae0a197 100644 --- a/lib/WebGUI/Form/ReadOnly.pm +++ b/lib/WebGUI/Form/ReadOnly.pm @@ -78,7 +78,7 @@ Returns undef. =cut sub getValueFromPost { - return; + return undef; } #------------------------------------------------------------------- @@ -103,7 +103,7 @@ Outputs nothing. =cut sub toHtmlAsHidden { - return; + return undef; } diff --git a/lib/WebGUI/Form/SelectSlider.pm b/lib/WebGUI/Form/SelectSlider.pm index cd9cf07b0..f7f2ba31b 100644 --- a/lib/WebGUI/Form/SelectSlider.pm +++ b/lib/WebGUI/Form/SelectSlider.pm @@ -173,7 +173,7 @@ sub getSliderValue { return $i if $keys[$i] eq $self->get('value')->[0]; } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Form/TimeField.pm b/lib/WebGUI/Form/TimeField.pm index 8a77f69a0..092cb2786 100644 --- a/lib/WebGUI/Form/TimeField.pm +++ b/lib/WebGUI/Form/TimeField.pm @@ -132,7 +132,7 @@ sub getValueFromPost { return $value } else { - return; + return undef; } } @@ -147,7 +147,7 @@ sub getValueFromPost { } else { # Mysql format my $value = $self->session->form->param($self->get("name")); - return unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/; + return undef unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/; return $value; } } diff --git a/lib/WebGUI/Form/Zipcode.pm b/lib/WebGUI/Form/Zipcode.pm index 3c260b906..6025787e4 100644 --- a/lib/WebGUI/Form/Zipcode.pm +++ b/lib/WebGUI/Form/Zipcode.pm @@ -94,7 +94,7 @@ sub getValueFromPost { if ($value =~ /^[A-Z\d\s\-]+$/) { return $value; } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/FormValidator.pm b/lib/WebGUI/FormValidator.pm index e916e6a02..325576bcd 100644 --- a/lib/WebGUI/FormValidator.pm +++ b/lib/WebGUI/FormValidator.pm @@ -74,7 +74,7 @@ sub AUTOLOAD { my $control = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::".$name, "new", [ $self->session, $params ]) }; if ($@) { $self->session->errorHandler->error($@); - return; + return undef; } return $control->getValueFromPost(@args); } @@ -176,7 +176,7 @@ sub process { return $default; } if ($value =~ /^[\s]+$/) { - return; + return undef; } return $value; } diff --git a/lib/WebGUI/Group.pm b/lib/WebGUI/Group.pm index f88f53209..ce2ca5f22 100755 --- a/lib/WebGUI/Group.pm +++ b/lib/WebGUI/Group.pm @@ -1024,7 +1024,7 @@ sub new { unless ($groupExists) { $self->{_session}->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:' .'['.$self->{_groupId}.']'); - return; + return undef; } } diff --git a/lib/WebGUI/HTML.pm b/lib/WebGUI/HTML.pm index b30668573..0655bb2e9 100644 --- a/lib/WebGUI/HTML.pm +++ b/lib/WebGUI/HTML.pm @@ -121,7 +121,7 @@ sub filter { } ; #HTML::Parser event handler called with non-tag text (no tags) my $html_parser_text_sub = sub { - return if $html_parser_inside_tag{script} || $html_parser_inside_tag{style}; # do not output text + return undef if $html_parser_inside_tag{script} || $html_parser_inside_tag{style}; # do not output text $html_parser_text .= $_[0] ; } ; my $parser = HTML::Parser->new(api_version => 3, @@ -236,7 +236,7 @@ sub html2text { } }; my $textHandler = sub { - return if $inside->{script} || $inside->{style}; + return undef if $inside->{script} || $inside->{style}; if ($_[0] =~ /\S+/) { $text .= $_[0]; } @@ -303,7 +303,7 @@ sub makeAbsolute { if(not exists $linkElements{$tagname}) { # no need to touch this tag $absolute .= $text; - return; + return undef; } # Build a hash with tag attributes @@ -356,7 +356,7 @@ sub makeParameterSafe { my $text = shift; ${ $text } =~ s/,/,/g; ${ $text } =~ s/'/'/g; - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index bb3e9504d..073768a12 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -88,7 +88,7 @@ sub AUTOLOAD { my $control = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::".$name, "new", [ $self->session, %params ]) }; if ($@) { $self->session->errorHandler->error($@); - return; + return undef; } $self->{_data} .= $control->toHtmlWithWrapper; } diff --git a/lib/WebGUI/Image/Graph.pm b/lib/WebGUI/Image/Graph.pm index bfa5fd88b..2b1fee538 100644 --- a/lib/WebGUI/Image/Graph.pm +++ b/lib/WebGUI/Image/Graph.pm @@ -602,12 +602,12 @@ sub processConfigurationForm { my $class = shift; my $session = shift; - return unless ($class->getPluginList($session)); + return undef unless ($class->getPluginList($session)); my $namespace = "WebGUI::Image::".$session->form->process('graphingPlugin'); $namespace =~ s/_/::/g; - return unless (isIn($namespace, @{$class->getPluginList($session)})); + return undef unless (isIn($namespace, @{$class->getPluginList($session)})); my $graph = $class->load($session, $namespace); diff --git a/lib/WebGUI/Image/Graph/Pie.pm b/lib/WebGUI/Image/Graph/Pie.pm index 62869cd88..08433ea08 100644 --- a/lib/WebGUI/Image/Graph/Pie.pm +++ b/lib/WebGUI/Image/Graph/Pie.pm @@ -493,7 +493,7 @@ sub drawLabel { my $slice = shift; # Draw labels only once - return unless ($slice->{mainSlice}); + return undef unless ($slice->{mainSlice}); $startRadius = $self->getRadius * $slice->{scaleFactor}+ $self->getStickOffset; $stopRadius = $startRadius + $self->getStickLength; diff --git a/lib/WebGUI/Image/Palette.pm b/lib/WebGUI/Image/Palette.pm index 67e9c0185..c273ce2bf 100644 --- a/lib/WebGUI/Image/Palette.pm +++ b/lib/WebGUI/Image/Palette.pm @@ -148,7 +148,7 @@ sub getColorIndex { return $index if ($self->getColor($index)->getId eq $color->getId); } - return; + return undef; } #------------------------------------------------------------------- @@ -372,7 +372,7 @@ sub removeColor { my $self = shift; my $paletteIndex = shift; - return unless (defined $paletteIndex); + return undef unless (defined $paletteIndex); my $color = $self->getColor($paletteIndex); @@ -426,10 +426,10 @@ sub setColor { my $index = shift; my $color = shift; - return if ($index >= $self->getNumberOfColors); - return if ($index < 0); - return unless (defined $index); - return unless (defined $color); + return undef if ($index >= $self->getNumberOfColors); + return undef if ($index < 0); + return undef unless (defined $index); + return undef unless (defined $color); $color->save; @@ -484,7 +484,7 @@ sub setPaletteIndex { my $self = shift; my $index = shift; - return unless (defined $index); + return undef unless (defined $index); $index = ($self->getNumberOfColors - 1) if ($index >= $self->getNumberOfColors); $index = 0 if ($index < 0); diff --git a/lib/WebGUI/Inbox.pm b/lib/WebGUI/Inbox.pm index aab7ddaa2..d7c70bf3c 100644 --- a/lib/WebGUI/Inbox.pm +++ b/lib/WebGUI/Inbox.pm @@ -72,10 +72,10 @@ sub addPrivateMessage { my $userId = $messageData->{userId}; my $sentBy = $messageData->{sentBy} || $self->session->user->userId; - return unless $userId; + return undef unless $userId; my $u = WebGUI::User->new($self->session,$userId); - return unless ($isReply || $u->acceptsPrivateMessages($sentBy)); + return undef unless ($isReply || $u->acceptsPrivateMessages($sentBy)); return $self->addMessage($messageData); } diff --git a/lib/WebGUI/Inbox/Message.pm b/lib/WebGUI/Inbox/Message.pm index 5d9e976fe..2659dc5a6 100644 --- a/lib/WebGUI/Inbox/Message.pm +++ b/lib/WebGUI/Inbox/Message.pm @@ -264,16 +264,16 @@ sub setStatus { my $userId = shift || $self->session->user->userId; unless ($status) { $self->session->errorHandler->warn("No status passed in for message. Exit without update"); - return; + return undef; } if($status eq "completed") { $self->setCompleted($userId); - return; + return undef; } $self->{_properties}{status} = $status; $self->session->db->setRow("inbox","messageId",$self->{_properties}); - return; + return undef; } 1; diff --git a/lib/WebGUI/LDAPLink.pm b/lib/WebGUI/LDAPLink.pm index 9790abc19..49ac3b586 100644 --- a/lib/WebGUI/LDAPLink.pm +++ b/lib/WebGUI/LDAPLink.pm @@ -219,7 +219,7 @@ sub new { my $class = shift; my $session = shift; $ldapLinkId = shift; - return unless $ldapLinkId; + return undef unless $ldapLinkId; $ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]); bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class; } @@ -291,7 +291,7 @@ sub recurseProperty { my $count = $_[4] || 0; my $recurseFilter = $_[5] || $self->get->{ldapGlobalRecursiveFilter}; my $rfAlreadyTransformed = $_[6]; - return unless($ldap && $base && $property); + return undef unless($ldap && $base && $property); if (length $recurseFilter and not $rfAlreadyTransformed) { $recurseFilter =~ tr/\r//d; @@ -302,7 +302,7 @@ sub recurseProperty { #Prevent infinite recursion $count++; - return if $count == 99; + return undef if $count == 99; #search the base my $msg = $ldap->search( @@ -310,8 +310,8 @@ sub recurseProperty { scope => 'sub', filter => "&(objectClass=*)" ); - #return if nothing found - return if($msg->code || $msg->count == 0); + #return undef if nothing found + return undef if($msg->code || $msg->count == 0); #loop through the results for (my $i = 0; $i < $msg->count; $i++) { my $entry = $msg->entry($i); diff --git a/lib/WebGUI/Macro/AdSpace.pm b/lib/WebGUI/Macro/AdSpace.pm index 9c0eb2667..69c554f59 100644 --- a/lib/WebGUI/Macro/AdSpace.pm +++ b/lib/WebGUI/Macro/AdSpace.pm @@ -37,7 +37,7 @@ sub process { return "[AD:".$name."]"; } my $adSpace = WebGUI::AdSpace->newByName($session, $name); - return unless defined $adSpace; + return undef unless defined $adSpace; return $adSpace->displayImpression; } diff --git a/lib/WebGUI/Macro/AssetProxy.pm b/lib/WebGUI/Macro/AssetProxy.pm index e2d5065e7..52ef0b2a2 100644 --- a/lib/WebGUI/Macro/AssetProxy.pm +++ b/lib/WebGUI/Macro/AssetProxy.pm @@ -50,7 +50,7 @@ sub process { $output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators()); return $output; } - return; + return undef; } else { my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy'); return $i18n->get('invalid url'); diff --git a/lib/WebGUI/Macro/RandomAssetProxy.pm b/lib/WebGUI/Macro/RandomAssetProxy.pm index 08e19562a..0d188bfcd 100644 --- a/lib/WebGUI/Macro/RandomAssetProxy.pm +++ b/lib/WebGUI/Macro/RandomAssetProxy.pm @@ -50,7 +50,7 @@ sub process { $randomAsset->prepareView; return $randomAsset->view; } - return; + return undef; } else { return $i18n->get('childless'); } diff --git a/lib/WebGUI/Macro/Thumbnail.pm b/lib/WebGUI/Macro/Thumbnail.pm index 88eb49e72..7d36ec837 100644 --- a/lib/WebGUI/Macro/Thumbnail.pm +++ b/lib/WebGUI/Macro/Thumbnail.pm @@ -37,7 +37,7 @@ sub process { if (my $image = WebGUI::Asset::File::Image->newByUrl($session,$url)) { return $image->getThumbnailUrl; } else { - return; + return undef; } } diff --git a/lib/WebGUI/Mail/Get.pm b/lib/WebGUI/Mail/Get.pm index 7805da237..720fda622 100644 --- a/lib/WebGUI/Mail/Get.pm +++ b/lib/WebGUI/Mail/Get.pm @@ -77,11 +77,11 @@ sub connect { my $pop = Net::POP3->new($params->{server}, Timeout => 60); unless (defined $pop) { $session->errorHandler->error("Couldn't connect to POP3 server ". $params->{server}); - return; + return undef; } unless ($pop->login($params->{account}, $params->{password})) { $session->errorHandler->error("Couldn't log in to POP3 server ".$params->{server}." as ".$params->{account}); - return; + return undef; } my $messageNumbers = $pop->list; my @ids = (); @@ -150,7 +150,7 @@ Retrieves the next available message from the server. Returns undef if there are sub getNextMessage { my $self = shift; my $id = pop(@{$self->{_ids}}); - return unless $id; + return undef unless $id; my $rawMessage = $self->{_pop}->get($id); my $parser = MIME::Parser->new; $parser->output_to_core(1); @@ -159,7 +159,7 @@ sub getNextMessage { $self->{_pop}->delete($id); } else { $self->session->errorHandler->error("Could not parse POP3 message $id"); - return; + return undef; } my $head = $parsedMessage->head; my $type = $head->get("Content-Type"); diff --git a/lib/WebGUI/Mail/Send.pm b/lib/WebGUI/Mail/Send.pm index aa4dcad76..c4cc53bcc 100644 --- a/lib/WebGUI/Mail/Send.pm +++ b/lib/WebGUI/Mail/Send.pm @@ -178,7 +178,7 @@ sub addHtmlRaw { Type => "text/html", ); - return; + return undef; } @@ -208,7 +208,7 @@ sub addText { Data => wrap( '', '', $text ), ); - return; + return undef; } @@ -423,9 +423,9 @@ sub retrieve { my $class = shift; my $session = shift; my $messageId = shift; - return unless $messageId; + return undef unless $messageId; my $data = $session->db->getRow("mailQueue","messageId", $messageId); - return unless $data->{messageId}; + return undef unless $data->{messageId}; $session->db->deleteRow("mailQueue","messageId", $messageId); my $parser = MIME::Parser->new; $parser->output_to_core(1); diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm index b57330797..513876fca 100644 --- a/lib/WebGUI/Operation.pm +++ b/lib/WebGUI/Operation.pm @@ -58,7 +58,7 @@ sub execute { if ( $@ ) { die $@ if ($@ =~ "^fatal:"); $session->errorHandler->error($@); - return; + return undef; } } else { $session->errorHandler->security("execute an invalid operation: ".$op); diff --git a/lib/WebGUI/Operation/AdSpace.pm b/lib/WebGUI/Operation/AdSpace.pm index cb8d86f24..e2507e295 100644 --- a/lib/WebGUI/Operation/AdSpace.pm +++ b/lib/WebGUI/Operation/AdSpace.pm @@ -54,7 +54,7 @@ Handles a click on an advertisement. sub www_clickAd { my $session = shift; my $id = $session->form->param("id"); - return unless $id; + return undef unless $id; my $url = WebGUI::AdSpace->countClick($session, $id); $session->http->setRedirect($url); return "Redirecting to $url"; diff --git a/lib/WebGUI/Operation/Help.pm b/lib/WebGUI/Operation/Help.pm index ee5e95f42..242c327f6 100644 --- a/lib/WebGUI/Operation/Help.pm +++ b/lib/WebGUI/Operation/Help.pm @@ -91,7 +91,7 @@ and set the __PROCESSED flag to prevent processing entries twice. sub _process { my ($session, $helpEntry, $key) = @_; - return if exists($helpEntry->{__PROCESSED}) and $helpEntry->{__PROCESSED}; + return undef if exists($helpEntry->{__PROCESSED}) and $helpEntry->{__PROCESSED}; $helpEntry->{related} = [ _related($session, $helpEntry->{related}) ]; ##Add an ISA link unless it already exists. ##This simplifies handling later. @@ -157,7 +157,7 @@ sub _get { } else { $session->errorHandler->warn("Unable to load help for $namespace -> $id"); - return; + return undef; } } diff --git a/lib/WebGUI/Operation/SSO.pm b/lib/WebGUI/Operation/SSO.pm index 48dee8c09..c46c8ad11 100644 --- a/lib/WebGUI/Operation/SSO.pm +++ b/lib/WebGUI/Operation/SSO.pm @@ -45,7 +45,7 @@ sub www_ssoViaSessionId { } } } - return; + return undef; } diff --git a/lib/WebGUI/Operation/SpellCheck.pm b/lib/WebGUI/Operation/SpellCheck.pm index 46091b43e..16000c7ce 100644 --- a/lib/WebGUI/Operation/SpellCheck.pm +++ b/lib/WebGUI/Operation/SpellCheck.pm @@ -41,12 +41,12 @@ An instanciated session object. sub _getSpeller { my ($baseDir, $userDir, $homeDir); my $session = shift; - return unless Text::Aspell->can('new'); + return undef unless Text::Aspell->can('new'); my $speller = Text::Aspell->new; # Get language my $lang = $session->form->process('lang'); - return unless (isIn($lang, map {m/^.*?:([^:]*):.*?$/} $speller->list_dictionaries)); + return undef unless (isIn($lang, map {m/^.*?:([^:]*):.*?$/} $speller->list_dictionaries)); # User homedir my $userId = $session->user->userId; diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index 912db4a12..07ffcb551 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -295,7 +295,7 @@ Allows an administrator to assume another user. sub www_becomeUser { my $session = shift; return $session->privilege->adminOnly() unless canEdit($session); - return unless WebGUI::User->validUserId($session, $session->form->process("uid")); + return undef unless WebGUI::User->validUserId($session, $session->form->process("uid")); $session->var->end($session->var->get("sessionId")); $session->user({userId=>$session->form->process("uid")}); return ""; diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index 590773feb..e394e4702 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -537,7 +537,7 @@ sub www_setWorkingVersionTag { $tag->setWorking(); } if ($session->form->param("backToSite")) { - return; + return undef; } return www_manageVersions($session); } diff --git a/lib/WebGUI/PassiveProfiling.pm b/lib/WebGUI/PassiveProfiling.pm index 85d1b6e47..c9d532ca0 100644 --- a/lib/WebGUI/PassiveProfiling.pm +++ b/lib/WebGUI/PassiveProfiling.pm @@ -55,7 +55,7 @@ The assetId to add. sub add { my $session = shift; - return unless ($session->setting->get("passiveProfilingEnabled")); + return undef unless ($session->setting->get("passiveProfilingEnabled")); my $assetId = shift; $session->db->write("insert into passiveProfileLog (passiveProfileLogId, userId, sessionId, assetId, dateOfEntry) values (?,?,?,?,?)", [ @@ -63,7 +63,7 @@ sub add { $session->var->get("sessionId"), $assetId, $session->datetime->time(), ]); - return; + return undef; } #------------------------------------------------------------------- @@ -84,13 +84,13 @@ The assetId of the page you want to log. sub addPage { my $session = shift; - return unless ($session->setting->get("passiveProfilingEnabled")); + return undef unless ($session->setting->get("passiveProfilingEnabled")); my $pageId = shift; my @wids = $session->db->buildArray("select assetId from asset where parentId=".$session->db->quote($pageId)); foreach my $wid (@wids) { add($session,$wid); } - return; + return undef; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/PerformanceProfiler.pm b/lib/WebGUI/PerformanceProfiler.pm index 5c69c8790..2dc2fc27b 100755 --- a/lib/WebGUI/PerformanceProfiler.pm +++ b/lib/WebGUI/PerformanceProfiler.pm @@ -429,7 +429,7 @@ function addSTClassName(el, sClassName) { var l = p.length; for (var i = 0; i < l; i++) { if (p[i] == sClassName) - return; + return undef; } p[p.length] = sClassName; el.className = p.join(" ").replace( /(^\s+)|(\s+$)/g, "" ); diff --git a/lib/WebGUI/Product.pm b/lib/WebGUI/Product.pm index 53e351ee1..3b82cbe45 100755 --- a/lib/WebGUI/Product.pm +++ b/lib/WebGUI/Product.pm @@ -73,7 +73,7 @@ sub delete { $self->session->db->write("delete from productVariants where productId=".$self->session->db->quote($self->get('productId'))); $self->session->db->write("delete from products where productId=".$self->session->db->quote($self->get('productId'))); - return; + return undef; } #------------------------------------------------------------------- @@ -87,7 +87,7 @@ sub deleteParameter { $self->updateVariants; - return; + return undef; } #------------------------------------------------------------------- @@ -110,7 +110,7 @@ sub deleteOption { $self->updateVariants; - return; + return undef; } #------------------------------------------------------------------- @@ -136,7 +136,7 @@ sub getByOptionId { ($productId) = $session->db->quickArray("select productId from productParameters as t1, productParameterOptions as t2 ". "where t1.parameterId=t2.parameterId and t2.optionId=".$session->db->quote($optionId)); - return unless ($productId); + return undef unless ($productId); return WebGUI::Product->new($session,$productId); } diff --git a/lib/WebGUI/ProfileCategory.pm b/lib/WebGUI/ProfileCategory.pm index 7b8c78ccd..040addfc9 100644 --- a/lib/WebGUI/ProfileCategory.pm +++ b/lib/WebGUI/ProfileCategory.pm @@ -278,7 +278,7 @@ sub new { my $class = shift; my $session = shift; my $id = shift; - return unless ($id); + return undef unless ($id); my $properties = $session->db->getRow("userProfileCategory","profileCategoryId",$id); bless {_session=>$session, _properties=>$properties}, $class; } diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index 2fdde8d02..3e710b000 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -109,8 +109,8 @@ sub create { "select count(*) from userProfileField where fieldName=?", [$fieldName] ); - return if $fieldNameExists; - return if $class->isReservedFieldName($fieldName); + return undef if $fieldNameExists; + return undef if $class->isReservedFieldName($fieldName); ### Data okay, create the field # Add the record @@ -553,11 +553,11 @@ sub new { my $class = shift; my $session = shift; my $id = shift; - return unless ($id); - return if $class->isReservedFieldName($id); + return undef unless ($id); + return undef if $class->isReservedFieldName($id); my $properties = $session->db->getRow("userProfileField","fieldName",$id); # Reject properties that don't exist. - return unless scalar keys %$properties; + return undef unless scalar keys %$properties; bless {_session=>$session, _properties=>$properties}, $class; } @@ -731,10 +731,10 @@ The unique ID of a category to assign this field to. sub setCategory { my $self = shift; my $categoryId = shift; - return unless ($categoryId); + return undef unless ($categoryId); my $currentCategoryId = $self->get("profileCategoryId"); - return if ($categoryId eq $currentCategoryId); + return undef if ($categoryId eq $currentCategoryId); my ($sequenceNumber) = $self->session->db->quickArray("select max(sequenceNumber) from userProfileField where profileCategoryId=".$self->session->db->quote($categoryId)); $self->session->db->setRow("userProfileField","fieldName",{fieldName=>$self->getId, profileCategoryId=>$categoryId, sequenceNumber=>$sequenceNumber+1}); diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm index bf82d1442..23491a040 100644 --- a/lib/WebGUI/SQL.pm +++ b/lib/WebGUI/SQL.pm @@ -323,7 +323,7 @@ sub connect { unless (defined $dbh) { $session->errorHandler->error("Couldn't connect to database: $dsn"); - return; + return undef; } ##Set specific attributes for this database. @@ -571,11 +571,11 @@ sub quickCSV { $sth = $self->prepare($sql); $sth->execute($params); - return unless $csv->combine($sth->getColumnNames); + return undef unless $csv->combine($sth->getColumnNames); $output = $csv->string(); while (@data = $sth->array) { - return unless $csv->combine(@data); + return undef unless $csv->combine(@data); $output .= $csv->string(); } diff --git a/lib/WebGUI/SQL/ResultSet.pm b/lib/WebGUI/SQL/ResultSet.pm index 775bc1a47..fe52991c7 100644 --- a/lib/WebGUI/SQL/ResultSet.pm +++ b/lib/WebGUI/SQL/ResultSet.pm @@ -313,7 +313,7 @@ sub unconditionalRead { $sth->execute(@$placeholders) or $errorHandler->warn("Unconditional read failed: ".$sql." : ".$sth->errstr); bless {_sql=>$sql, _db=>$db, _sth=>$sth}, $class; } else { - return; + return undef; } } diff --git a/lib/WebGUI/Search/Index.pm b/lib/WebGUI/Search/Index.pm index 4859059f4..97facab41 100644 --- a/lib/WebGUI/Search/Index.pm +++ b/lib/WebGUI/Search/Index.pm @@ -55,14 +55,14 @@ sub addFile { if ($path =~ m/\.(\w+)$/) { my $type = lc($1); if ($filters->{$type}) { - open my $fh, "$filters->{$type} $path |" or return; # open pipe to filter + open my $fh, "$filters->{$type} $path |" or return undef; # open pipe to filter $content = do { local $/; <$fh> }; # slurp file close $fh; } } return $self->addKeywords($content) if $content =~ m/\S/; # only index if we fine non-whitespace - return; + return undef; } diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index a743d0dd3..5373c6686 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -183,7 +183,7 @@ sub db { } else { if ($skipFatal) { - return; + return undef; } else { $self->errorHandler->fatal("Couldn't connect to WebGUI database, and can't continue without it."); diff --git a/lib/WebGUI/Session/DateTime.pm b/lib/WebGUI/Session/DateTime.pm index c6de14b6c..47c881346 100644 --- a/lib/WebGUI/Session/DateTime.pm +++ b/lib/WebGUI/Session/DateTime.pm @@ -422,7 +422,7 @@ An integer ranging from 1-7 representing the day of the week (Sunday is 1 and Sa sub getDayName { my $self = shift; my $day = shift; - return unless ($day >= 1 && $day <= 7); + return undef unless ($day >= 1 && $day <= 7); my $i18n = WebGUI::International->new($self->session,'DateTime'); return $i18n->get((qw/monday tuesday wednesday thursday friday saturday sunday/)[$day-1]); @@ -552,7 +552,7 @@ An integer ranging from 1-12 representing the month. sub getMonthName { my $self = shift; my $month = shift; - return unless ($month >= 1 && $month <= 12); + return undef unless ($month >= 1 && $month <= 12); my $i18n = WebGUI::International->new($self->session,'DateTime'); return $i18n->get((qw/january february march april may june @@ -734,7 +734,7 @@ sub mailToEpoch { my $dt = eval {$parser->parse_datetime($date)}; if ($@) { $self->session->errorHandler->warn($date." is not a valid date for email, and is so poorly formatted, we can't even guess what it is."); - return; + return undef; } return $dt->epoch; } @@ -909,7 +909,7 @@ A string in the format of YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. sub setToEpoch { my $self = shift; my $set = shift; - return unless $set; + return undef unless $set; my $time_zone = $self->getTimeZone(); my $parser = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%d %H:%M:%S', time_zone=>$time_zone); my $dt = $parser->parse_datetime($set); diff --git a/lib/WebGUI/Session/Form.pm b/lib/WebGUI/Session/Form.pm index e7ef138c9..48674b148 100644 --- a/lib/WebGUI/Session/Form.pm +++ b/lib/WebGUI/Session/Form.pm @@ -110,7 +110,7 @@ sub param { @data = $self->session->request->param($field); return wantarray ? @data : $data[0]; } else { - return; + return undef; } } else { if ($self->session->request) { @@ -123,7 +123,7 @@ sub param { } return keys %params; } else { - return; + return undef; } } } diff --git a/lib/WebGUI/Session/Http.pm b/lib/WebGUI/Session/Http.pm index 2461158ca..f0bab73c2 100644 --- a/lib/WebGUI/Session/Http.pm +++ b/lib/WebGUI/Session/Http.pm @@ -264,11 +264,11 @@ Generates and sends HTTP headers for a response. sub sendHeader { my $self = shift; - return if ($self->{_http}{noHeader}); + return undef if ($self->{_http}{noHeader}); return $self->_sendMinimalHeader unless defined $self->session->db(1); my ($request, $datetime, $config, $var) = $self->session->quick(qw(request datetime config var)); - return unless $request; + return undef unless $request; my $userId = $var->get("userId"); # send webgui session cookie @@ -305,7 +305,7 @@ sub sendHeader { $request->status($self->getStatus()); $request->status_line($self->getStatus().' '.$self->getStatusDescription()); } - return; + return undef; } sub _sendMinimalHeader { @@ -316,7 +316,7 @@ sub _sendMinimalHeader { $request->no_cache(1); $request->status($self->getStatus()); $request->status_line($self->getStatus().' '.$self->getStatusDescription()); - return; + return undef; } @@ -508,7 +508,7 @@ sub setRedirect { my $self = shift; my $url = shift; my @params = $self->session->form->param; - return if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self + return undef if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self $self->session->errorHandler->info("Redirecting to $url"); $self->{_http}{location} = $url; $self->setStatus("302", "Redirect"); diff --git a/lib/WebGUI/Session/Scratch.pm b/lib/WebGUI/Session/Scratch.pm index d21b82d6b..a369ac24c 100644 --- a/lib/WebGUI/Session/Scratch.pm +++ b/lib/WebGUI/Session/Scratch.pm @@ -60,7 +60,7 @@ The name of the scratch variable. sub delete { my $self = shift; my $name = shift; - return unless ($name); + return undef unless ($name); my $value = delete $self->{_data}{$name}; $self->session->db->write("delete from userSessionScratch where name=? and sessionId=?", [$name, $self->session->getId]); return $value; @@ -97,7 +97,7 @@ The name of the scratch variable. sub deleteName { my $self = shift; my $name = shift; - return unless ($name); + return undef unless ($name); delete $self->{_data}{$name}; $self->session->db->write("delete from userSessionScratch where name=?", [$name]); } @@ -122,7 +122,7 @@ sub deleteNameByValue { my $self = shift; my $name = shift; my $value = shift; - return unless ($name and defined $value); + return undef unless ($name and defined $value); delete $self->{_data}{$name} if ($self->{_data}{$name} eq $value); $self->session->db->write("delete from userSessionScratch where name=? and value=?", [$name,$value]); } @@ -215,7 +215,7 @@ sub set { my $self = shift; my $name = shift; my $value = shift; - return unless ($name); + return undef unless ($name); $self->{_data}{$name} = $value; $self->session->db->write("insert into userSessionScratch (sessionId, name, value) values (?,?,?) on duplicate key update value=VALUES(value)", [$self->session->getId, $name, $value]); } diff --git a/lib/WebGUI/Session/Stow.pm b/lib/WebGUI/Session/Stow.pm index 4ac5d3ab2..8f2681127 100644 --- a/lib/WebGUI/Session/Stow.pm +++ b/lib/WebGUI/Session/Stow.pm @@ -58,7 +58,7 @@ The name of the stow variable. sub delete { my $self = shift; my $name = shift; - return unless ($name); + return undef unless ($name); delete $self->{_data}{$name}; } @@ -108,7 +108,7 @@ The name of the variable. sub get { my $self = shift; my $var = shift; - return if $self->session->config->get("disableCache"); + return undef if $self->session->config->get("disableCache"); return $self->{_data}{$var}; } @@ -167,7 +167,7 @@ sub set { if $self->session->config->get("disableCache"); my $name = shift; my $value = shift; - return unless ($name); + return undef unless ($name); $self->{_data}{$name} = $value; } diff --git a/lib/WebGUI/Session/Style.pm b/lib/WebGUI/Session/Style.pm index 4313c734e..b0388e3ea 100644 --- a/lib/WebGUI/Session/Style.pm +++ b/lib/WebGUI/Session/Style.pm @@ -280,7 +280,7 @@ sub setLink { my $url = shift; my $params = shift; $params = {} unless (defined $params and ref $params eq 'HASH'); - return if ($self->{_link}{$url}); + return undef if ($self->{_link}{$url}); my $tag = '{_javascript}{$url}); + return undef if ($self->{_javascript}{$url}); my $tag = '
'.$i18n->get('fieldName').''.$i18n->get('edit delete fieldname').''.$i18n->get('Original Value').''.$i18n->get('New value').''.$i18n->get('Replacement value').'