Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Problem with around BUILDARGS

by saintex (Scribe)
on Apr 19, 2011 at 16:45 UTC ( #900171=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Problem with around BUILDARGS
in thread Problem with around BUILDARGS

Hello,
I tried just now to use this solution in a real case...

But It works, until you don't have to call the proprieties in your code.

If you try to call $self->serverLocation anyway in your code you have that error:

Can't use string ("nameOfTheClass") as a HASH ref while "strict refs" +in use at accessor serverLocation defined at /home/saintex/workspace/ +perl_scripts/navigator/classes/Browser/Selenium2.pm
Any help? Thank you


Comment on Re^4: Problem with around BUILDARGS
Download Code
Re^5: Problem with around BUILDARGS
by stvn (Monsignor) on Apr 21, 2011 at 00:49 UTC

    I would need to see more code, but I suspect that something inside the 'serverLocation' accessor is trying to use the "nameOfTheClass" as if it was an object instance. Show some more context and perhaps I can help.

    -stvn
      Hello, I'm trying to use the accessor as string.

      That is the method in my class:

      sub startServer { my $self = shift; defined(my $pid=fork) or die "Cannot fork: $!"; unless ($pid) { eval { exec 'java -jar '.$self->serverLocation; }; die "Impossibile far partire il server selenium: $@\n;" if ($@ +); } }
      Thank you for your help.

      I'm interested to solve this problem for knowledge reason, not for production... so I'm not in any hurry.

        Can I see the attribute definition for serverLocation? Or better yet, the entire class.

        -stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://900171]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-09-21 22:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls