Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

No '_p4client_ptr' member found in P4 object

by vaibhav07 (Acolyte)
on Oct 16, 2012 at 13:41 UTC ( #999333=perlquestion: print w/replies, xml ) Need Help??
vaibhav07 has asked for the wisdom of the Perl Monks concerning the following question:

package p4_cache::p4; use strict; use warnings; use base qw(P4); use Params::Validate qw( validate_with SCALAR OBJECT BOOLEAN UNDEF ARR +AYREF HASHREF); use Data::Dumper; use Class::MethodMaker [ new => [ '-hash', '-init', 'new'], scalar => 'clientname' ]; sub init { my $self = shift; my %opts = validate_with( params => \@_, spec => { 'clientname' => { type => SCALAR }, 'port' => { type => SCALAR, optional => 1 } }, ); my $port = $opts{'port'}; if (!defined($port)) { my @p4_client = split /:/, $opts{'clientname'}; $port = "p4mynet-p4p-".lc($p4_client[1]).":188"; } # Connect to p4 $self->SUPER::new(); print Dumper($self); $self->SetClient($opts{'clientname'}); $self->SetPort($port); $self->Connect() || die 'Unable to connect to p4 server'; return $self; } ## end of sub init When I am trying to execute this code through Call present in pl my $obj = p4_cache::p4->new(clientname => 'keys:SITE:dev2'); I am getting a following error : $VAR1 = bless( { 'clientname' => 'keys:SITE:dev2' }, 'p4_cache::p4' ); No '_p4client_ptr' member found in P4 object! at p4_cache/ line 3 +2. No '_p4client_ptr' member found in P4 object! at p4_cache/ line 3 +3. No '_p4client_ptr' member found in P4 object! at p4_cache/ line 3 +4. Unable to connect to p4 server at p4_cache/ line 34. No '_p4client_ptr' member found in P4 object!. Looking forward for some help on this. Thanks in advance.

Replies are listed 'Best First'.
Re: No '_p4client_ptr' member found in P4 object
by Tanktalus (Canon) on Oct 16, 2012 at 23:02 UTC

    Where does this error message come from? It doesn't look like an error message from perl, so I'm guessing it's a message coming from P4, the base class. Have you looked at that code to see why it's throwing an error?

    By the way, $self->SUPER::new() isn't going to do what you think it is. I'm not sure what the right answer is, but if you're using the same design point as in P4, then you might mean $self->SUPER::init(@_); instead. Again, I'd have to see P4 ... and I'd also have to learn Class::MethodMaker.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://999333]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2017-02-27 16:22 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (388 votes). Check out past polls.