Thanks!
Dumb me.
For my defense, may I claim that it occurred to me during my sleep? In any case, I very much appreciate your fast and effective answer!
I added the two lines, and at least make test passed:
bless $self, $proto;
return $self;
Do I need to add to the derived class a copy of the following, found in the base one:
*clone = \&new;
or may I trust that the calls to clone will be polymorphically translated to ClearCase::Argv::new (i.e. to calls to the derived class constructor)?
Based on my C++ understanding, I add it for now, thinking that there is no way the base class might know which derived to construct...
Are there users of ClearCase::Argv here, who can share my concerns and confirm symptoms I record? With whom I could share code before publishing it to CPAN (or in this case, sending it to the author for him to publish it)? What would be the best way to proceeed?
Thanks!
Marc | [reply] [d/l] [select] |
I test my change and get an error:
ClearCase-Argv> perl -Iblib/lib -Iblib/arch -e 'use ClearCase::Argv;su
+b p{$a=shift;print"--${a}--\n";system(qw(pgrep cleartool))}sub v{$c=s
+hift;$c->argv(q(pwv))->system}ClearCase::Argv->ipc(1);p(1);$c1=ClearC
+ase::Argv->new;p(2);$c2=ClearCase::Argv->new;v($c1);p(3);$c1->clone->
+argv(q(pwv));p(4);v($c1);p(5);v($c1);'
--1--
22003
--2--
22003
Working directory view: emagiro
Set view: emagiro
--3--
22003
Attempt to bless into a reference at blib/lib/ClearCase/Argv.pm line 6
+37, <GEN1> line 3.
This is the line:
bless $self, $proto;
I assume it is wrong to bless the reference I got in the case this was used as a copy constructor.
So, I must test it?
bless $self, ref($proto) ? ref($proto) : $proto;
This makes my test happy...
Marc | [reply] [d/l] [select] |