diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 8ca568e13..3331a64a6 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -355,13 +355,14 @@ The url of the post =cut -sub fixUrl { - my $self = shift; - my $url = shift; - $url =~ s/\./_/g; +around fixUrl => sub { + my $orig = shift; + my $self = shift; + my $url = shift; + $url =~ s/\./_/g; - $self->SUPER::fixUrl($url); -} + $self->$orig($url); +}; #------------------------------------------------------------------- @@ -1035,9 +1036,9 @@ non-sticky, locking and unlocking posts. Calls postProcess when it is done. =cut -sub processPropertiesFromFormPost { +override processPropertiesFromFormPost => sub { my $self = shift; - $self->SUPER::processPropertiesFromFormPost; + super(); my $session = $self->session; my $form = $session->form; my $i18n = WebGUI::International->new($session); @@ -1067,7 +1068,7 @@ sub processPropertiesFromFormPost { } delete $self->{_storageLocation}; $self->postProcess; -} +}; #------------------------------------------------------------------- @@ -1115,15 +1116,6 @@ sub postProcess { #------------------------------------------------------------------- -#sub publish { -# my $self = shift; -# $self->SUPER::publish(@_); -# -# $self->getThread->sumReplies; -#} - -#------------------------------------------------------------------- - =head2 purge Extend the base method to handle cleaning up storage locations. @@ -1223,12 +1215,12 @@ the thread rating. =cut -sub restore { +override restore => sub { my $self = shift; - $self->SUPER::restore(@_); + super(); $self->getThread->sumReplies; $self->getThread->updateThreadRating; -} +}; #------------------------------------------------------------------- @@ -1262,12 +1254,12 @@ An asset object to make the parent of this asset. =cut -sub setParent { +override setParent => sub { my $self = shift; my $newParent = shift; return 0 unless ($newParent->isa('WebGUI::Asset::Post')); - return $self->SUPER::setParent($newParent); -} + return super(); +}; #------------------------------------------------------------------- @@ -1307,9 +1299,9 @@ Moves post to the trash, updates reply counter on thread and recalculates the th =cut -sub trash { +override trash => sub { my $self = shift; - $self->SUPER::trash; + super(); $self->getThread->sumReplies if ($self->isReply); $self->getThread->updateThreadRating; if ($self->getThread->lastPostId eq $self->getId) { @@ -1326,7 +1318,7 @@ sub trash { order by creationDate desc",[$forumLineage.'%', $self->getId]); $self->getThread->getParent->update({lastPostId=>$id, lastPostDate=>$date}); } -} +}; #------------------------------------------------------------------- @@ -1691,7 +1683,7 @@ We're extending www_editSave() here to deal with editing a post that has been de =cut -sub www_editSave { +override www_editSave => sub { my $self = shift; my $assetId = $self->session->form->param("assetId"); if($assetId eq "new" && $self->getThread->getParent->useCaptcha) { @@ -1715,12 +1707,12 @@ sub www_editSave { } } } - my $output = $self->SUPER::www_editSave(); + my $output = super(); if ($currentTag) { # Go back to our original tag $currentTag->setWorking; } return $output; -} +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/RichEdit.pm b/lib/WebGUI/Asset/RichEdit.pm index 24c333239..9d610538c 100644 --- a/lib/WebGUI/Asset/RichEdit.pm +++ b/lib/WebGUI/Asset/RichEdit.pm @@ -204,9 +204,9 @@ Returns the TabForm object that will be used in generating the edit page for thi =cut -sub getEditForm { +override getEditForm => sub { my $self = shift; - my $tabform = $self->SUPER::getEditForm(); + my $tabform = super(); my $i18n = WebGUI::International->new($self->session,'Asset_RichEdit'); my %buttons; tie %buttons, "Tie::IxHash"; @@ -441,7 +441,7 @@ sub getEditForm { name => "allowMedia", ); return $tabform; -} +}; @@ -477,11 +477,11 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e =cut -sub getToolbar { +override getToolbar => sub { my $self = shift; return undef if ($self->getToolbarState); - return $self->SUPER::getToolbar(); -} + return super(); +}; diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 3abbf5e9c..f1f3e403a 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -242,9 +242,9 @@ Extend the base method to duplicate shortcut overrides. =cut -sub duplicate { +override duplicate => sub { my $self = shift; - my $newAsset = $self->SUPER::duplicate(@_); + my $newAsset = super(); $self->session->db->write(<<'END_SQL', [$newAsset->getId, $self->getId]); INSERT INTO Shortcut_overrides (assetId, fieldName, newValue) SELECT ?, fieldName, newValue @@ -252,7 +252,7 @@ FROM Shortcut_overrides WHERE assetId = ? END_SQL return $newAsset; -} +}; #------------------------------------------------------------------- @@ -278,9 +278,9 @@ Extend the base class to handle hand drawing the query build and other pieces. =cut -sub getEditForm { +override getEditForm => sub { my $self = shift; - my $tabform = $self->SUPER::getEditForm(); + my $tabform = super(); my $originalTemplate; my $i18n = WebGUI::International->new($self->session, "Asset_Shortcut"); my $shortcut = $self->getShortcut; @@ -355,7 +355,7 @@ sub getEditForm { ); } return $tabform; -} +}; #------------------------------------------------------------------- @@ -814,13 +814,13 @@ the scratch variables, and to uncache the overrides. =cut -sub processPropertiesFromFormPost { +override processPropertiesFromFormPost => sub { my $self = shift; - $self->SUPER::processPropertiesFromFormPost; + super(); my $scratchId = "Shortcut_" . $self->getId; $self->session->scratch->delete($scratchId); $self->uncacheOverrides; -} +}; #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Sku.pm b/lib/WebGUI/Asset/Sku.pm index b796b6842..d6a2498a6 100644 --- a/lib/WebGUI/Asset/Sku.pm +++ b/lib/WebGUI/Asset/Sku.pm @@ -190,11 +190,11 @@ Extends the base class to add Tax information for the Sku, in a new tab. =cut -sub getEditForm { +override getEditForm => sub { my $self = shift; my $session = $self->session; - my $tabform = $self->SUPER::getEditForm; + my $tabform = super(); my $taxDriver = WebGUI::Shop::Tax->getDriver( $session ); my $definition = $taxDriver->skuFormDefinition; @@ -210,7 +210,7 @@ sub getEditForm { } return $tabform; -} +}; #------------------------------------------------------------------- @@ -220,11 +220,11 @@ Not to be modified, just defines a new tab. =cut -sub getEditTabs { +override getEditTabs => sub { my $self = shift; my $i18n = WebGUI::International->new($self->session,"Asset_Sku"); - return ($self->SUPER::getEditTabs(), ['shop', $i18n->get('shop'), 9]); -} + return (super(), ['shop', $i18n->get('shop'), 9]); +}; #------------------------------------------------------------------- @@ -571,10 +571,10 @@ Extends the base class to process the tax data. =cut -sub processPropertiesFromFormPost { +override processPropertiesFromFormPost => sub { my $self = shift; - my $output = $self->SUPER::processPropertiesFromFormPost( @_ ); + my $output = super(); my $taxDriver = WebGUI::Shop::Tax->new( $self->session )->getDriver; $self->session->log->fatal( 'Could not instanciate tax driver.' ) unless $taxDriver; @@ -582,7 +582,7 @@ sub processPropertiesFromFormPost { $self->setTaxConfiguration( $taxDriver->className, $taxDriver->processSkuFormPost ); return $output; -} +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Snippet.pm b/lib/WebGUI/Asset/Snippet.pm index 59e08f794..bf35bdef1 100644 --- a/lib/WebGUI/Asset/Snippet.pm +++ b/lib/WebGUI/Asset/Snippet.pm @@ -172,11 +172,11 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e =cut -sub getToolbar { +override getToolbar => sub { my $self = shift; return undef if ($self->getToolbarState); - return '
'.$self->SUPER::getToolbar().'
'; -} + return ''.super().'
'; +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Template.pm b/lib/WebGUI/Asset/Template.pm index d66fe7705..5ad588ade 100644 --- a/lib/WebGUI/Asset/Template.pm +++ b/lib/WebGUI/Asset/Template.pm @@ -174,14 +174,14 @@ Extra Head Tags. =cut -sub drawExtraHeadTags { - my ($self, $params) = @_; +override drawExtraHeadTags => sub { + my ($self) = @_; if ($self->namespace eq 'style') { my $i18n = WebGUI::International->new($self->session); return $i18n->get(881); } - return $self->SUPER::drawExtraHeadTags($params); -} + return super(); +}; #------------------------------------------------------------------- @@ -208,12 +208,12 @@ Override to add attachments to package data =cut -sub exportAssetData { +override exportAssetData => sub { my ( $self ) = @_; - my $data = $self->SUPER::exportAssetData; + my $data = super(); $data->{template_attachments} = $self->getAttachments; return $data; -} +}; #------------------------------------------------------------------- @@ -262,9 +262,9 @@ Returns the TabForm object that will be used in generating the edit page for thi =cut -sub getEditForm { +override getEditForm => sub { my $self = shift; - my $tabform = $self->SUPER::getEditForm(); + my $tabform = super(); my $i18n = WebGUI::International->new($self->session, 'Asset_Template'); $tabform->hidden({ name=>"returnUrl", @@ -392,7 +392,7 @@ sub getEditForm { $properties->raw("