Convert WebGUI::Keyword to use Moose.

This commit is contained in:
Colin Kuskie 2010-07-02 16:25:45 -07:00
parent c159067c36
commit c687ec6917

View file

@ -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 } )