Move WebGUI::Shop::Admin from Class::InsideOut over to Moose.
This commit is contained in:
parent
97b6a58597
commit
3807197cbb
1 changed files with 21 additions and 14 deletions
|
|
@ -1,7 +1,27 @@
|
|||
package WebGUI::Shop::Admin;
|
||||
|
||||
use strict;
|
||||
use Class::InsideOut qw{ :std };
|
||||
|
||||
use Moose;
|
||||
|
||||
has session => (
|
||||
is => 'ro',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
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(@_);
|
||||
};
|
||||
|
||||
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::Exception::Shop;
|
||||
use WebGUI::HTMLForm;
|
||||
|
|
@ -28,8 +48,6 @@ These subroutines are available from this package:
|
|||
|
||||
=cut
|
||||
|
||||
readonly session => my %session;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 canManage ( [ $user ] )
|
||||
|
|
@ -103,17 +121,6 @@ A reference to the current session.
|
|||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my ($class, $session) = @_;
|
||||
unless (defined $session && $session->isa("WebGUI::Session")) {
|
||||
WebGUI::Error::InvalidObject->throw(expected=>"WebGUI::Session", got=>(ref $session), error=>"Need a session.");
|
||||
}
|
||||
my $self = register $class;
|
||||
my $id = id $self;
|
||||
$session{ $id } = $session;
|
||||
return $self;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 session ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue