cramdorgi has asked for the wisdom of the Perl Monks concerning the following question:
I try to fix a problem in a CPAN module: ClearCase::Argv.
This module should share a co-process running a cleartool executable, to service requests.
At least in so-called ipc mode.
But in my understanding, it doesn't.
ClearCase::Argv is a specialization of Argv.
My tentative changes involve adding a constructor, where there was none: the base constructor was enough—I assume.
So, here are my changes (I introduce a reference count of the objects using the same co-process. Using the same process may mean using the one set up at class level in the ipc member function, or the one used in an existing object, if performing a copy-construction. The DESTROY member also calls ipc but with a 0 argument, thus resulting in a decrement, and optional cleanup):
When running make test, I get now:ClearCase-Argv> ct diff -diff -pred Argv.pm 18c18 < --- > my %pidcount; 425d424 < # Send an explicit "exit" command and close up shop. 426a426 > return 0 if --$pidcount{$self->{IPC}->{PID}}; 426a427 > # Send an explicit "exit" command and close up shop. 440c441,444 < --- > if (($self ne $class) and $class->{IPC}) { > ++$ipccount{$class->{IPC}}; > return 0; > } 616a621,634 > > # Constructor, and copy constructor as clone, with $proto > sub new { > my $proto = shift; > my $self = $proto->SUPER::new(@_); > if (ref($proto)) { > # Correct the effect of the base cloning on globs > my $down = $proto->{IPC}->{DOWN}; > $self->{IPC}->{DOWN} = $down; > my $back = $proto->{IPC}->{BACK}; > $self->{IPC}->{BACK} = $back; > ++$ipccount{$proto->{IPC}}; > } > }
Line 50 in test.pl is:... Can't call method "qx" without a package or object reference at test.p +l line 50.
...the first use of an object created with my new constructor... Note that this construction involved arguments.49: my $wdv = ClearCase::Argv->new("pwv -wdview -s"); 50: my $view = $wdv->qx;
Any clue what's so wrong with my construction?
Thanks,
Marc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Constructor in derived class
by FunkyMonk (Bishop) on Mar 30, 2008 at 23:06 UTC | |
by cramdorgi (Acolyte) on Mar 31, 2008 at 08:53 UTC | |
by cramdorgi (Acolyte) on Mar 31, 2008 at 09:25 UTC |