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 my.pl
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/p4.pm line 3
+2.
No '_p4client_ptr' member found in P4 object! at p4_cache/p4.pm line 3
+3.
No '_p4client_ptr' member found in P4 object! at p4_cache/p4.pm line 3
+4.
Unable to connect to p4 server at p4_cache/p4.pm line 34.
No '_p4client_ptr' member found in P4 object!.
Looking forward for some help on this. Thanks in advance.