M
Marc Girod
Hello,
I consider making a change to a module, which will significantly alter
its client interface.
Until now, client functions could exit, die, or exec: no further
action was meant to take place.
Alternatively, they could return 0, and a generic behaviour would
follow.
I want now to introduce a loop, i.e. to retain control.
I control one such client, and am not sure whether there are actually
more than one other.
My problem is however to maintain a branch of the module and its known
clients, at least in order to investigate it and possibly to get
feedback. This could take a year or so. Or more.
What I did in the main loop, is:
< my $rc = &$cmd(@ARGV);
< # ... and exit unless it returned zero.
< exit $rc if $rc;
---
The change in the client code is thus ( a couple of examples out of
many):
< exit $?;
---
or
etc.
What are my best options to handle this?
I could sketch a few overrides such as e.g. for 'exit':
$legacy? exit $_ : return($_, 'done');
....but this ought to be a macro, not a function, for 'return' to
return to the right context.
What should I look for in CPAN or in the FAQ?
How to make my question shorter so that it fits in such a query?
If you are curious (you are fully entitled to), the modules are (on
CPAN):
ClearCase::Wrapper (the base module)
ClearCase::Wrapper::MGi (my own client)
ClearCase::Wrapper:SB (the other known client)
Thanks,
Marc
I consider making a change to a module, which will significantly alter
its client interface.
Until now, client functions could exit, die, or exec: no further
action was meant to take place.
Alternatively, they could return 0, and a generic behaviour would
follow.
I want now to introduce a loop, i.e. to retain control.
I control one such client, and am not sure whether there are actually
more than one other.
My problem is however to maintain a branch of the module and its known
clients, at least in order to investigate it and possibly to get
feedback. This could take a year or so. Or more.
What I did in the main loop, is:
< my $rc = &$cmd(@ARGV);
< # ... and exit unless it returned zero.
< exit $rc if $rc;
---
my ($rc, $done) = &$cmd(@ARGV);
# ... and return unless it returned zero and not done.
return $rc if $done || $rc;
The change in the client code is thus ( a couple of examples out of
many):
< exit $?;
---
return($?, 'done');
or
return($lsp->system, 'done');
etc.
What are my best options to handle this?
I could sketch a few overrides such as e.g. for 'exit':
$legacy? exit $_ : return($_, 'done');
....but this ought to be a macro, not a function, for 'return' to
return to the right context.
What should I look for in CPAN or in the FAQ?
How to make my question shorter so that it fits in such a query?
If you are curious (you are fully entitled to), the modules are (on
CPAN):
ClearCase::Wrapper (the base module)
ClearCase::Wrapper::MGi (my own client)
ClearCase::Wrapper:SB (the other known client)
Thanks,
Marc