in reply to Re^2: Problem with around BUILDARGS
in thread Problem with around BUILDARGS
So the problem is that $self is not an object instance, but rather the class. One way to solve this is to use builder instead of default like so.
has 'serverLocation' => (is=>'ro',isa=>'Str',builder =>'buildServerLoc +ation'); sub buildServerLocation { return "$Bin/lib/selenium-server-standalone-2.0b2.jar" } sub FOREIGNBUILDARGS { my $class = shift; my %args = ( @_ == 1 ? %{ $_[0] } : @_ ); $args{serverLocation} ||= $class->buildServerLocation; $args{host}//="localhost"; $args{port}//=4444; $args{browser}//="*firefox"; $args{browser_url}//='http://wwww.google.com'; return %args; }
-stvn
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Problem with around BUILDARGS
by saintex (Scribe) on Mar 29, 2011 at 14:23 UTC | |
Re^4: Problem with around BUILDARGS
by saintex (Scribe) on Apr 19, 2011 at 16:45 UTC | |
by stvn (Monsignor) on Apr 21, 2011 at 00:49 UTC | |
by saintex (Scribe) on Apr 21, 2011 at 08:38 UTC | |
by stvn (Monsignor) on Apr 21, 2011 at 19:44 UTC | |
by saintex (Scribe) on Apr 22, 2011 at 10:00 UTC | |
|
In Section
Seekers of Perl Wisdom