diff --git a/lib/WebGUI/Keyword.pm b/lib/WebGUI/Keyword.pm index eaec541ee..a851718e9 100644 --- a/lib/WebGUI/Keyword.pm +++ b/lib/WebGUI/Keyword.pm @@ -15,7 +15,13 @@ package WebGUI::Keyword; =cut use strict; -use Class::InsideOut qw(public register id); +use Moose; + +has session => ( + is => 'ro', + required => 1, +); + use HTML::TagCloud; use WebGUI::Paginator; @@ -40,6 +46,17 @@ These methods are available from this class: =cut +around BUILDARGS => sub { + my $orig = shift; + my $className = shift; + + ##Original arguments start here. + my $protoSession = $_[0]; + if (blessed $protoSession && $protoSession->isa('WebGUI::Session')) { + return $className->$orig(session => $protoSession); + } + return $className->$orig(@_); +}; #------------------------------------------------------------------- @@ -49,9 +66,6 @@ Returns a reference to the current session. =cut -public session => my %session; - - #------------------------------------------------------------------- =head2 deleteKeywordsForAsset ( $asset ) @@ -473,15 +487,6 @@ A reference to the current session. =cut -sub new { - my $class = shift; - my $session = shift; - my $self = bless \do {my $s}, $class; - register($self); - $session{id $self} = $session; - return $self; -} - #------------------------------------------------------------------- =head2 replaceKeyword ( { currentKeyword => $keyword1, newKeyword => $keyword2 } )