This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Cwd::cwd() bug??? on Cygwin
- From: Nick Ing-Simmons <nick at ing-simmons dot net>
- To: nick dot ing-simmons at elixent dot com
- Cc: module-build-general at lists dot sourceforge dot net, cygwin at cygwin dot com, RandyS at ThePierianSpring dot org, perl5-porters at perl dot org
- Date: Fri, 21 Nov 2003 21:03:04 +0000
- Subject: Re: Cwd::cwd() bug??? on Cygwin
- References: <3FAF853D.4000202@urth.org> <3FB00F47.10400@ThePierianSpring.org> < 3FB0ACC8.6030402@urth.org> <3FB30BB3.10405@ThePierianSpring.org> < 3FB50640.2010908@urth.org> <3FB55A73.5060806@ThePierianSpring.org> < 3FB64CB5.4060802@ThePierianSpring.org> <3FBD695A.9020307@ThePierianSpring .org> <20031121110334.3098.7@llama.elixent.com>
- Reply-to: Nick Ing-Simmons <nick at ing-simmons dot net>
Nick Ing-Simmons <nick.ing-simmons@elixent.com> writes:
>>> package MyModule;
>>> use Module;
>>> use base 'Module';
>>> use Cwd;
>
>If you moved that above the use Module line then when Module.pm
>was compiled it would know Cwd::cwd was a function.
Sorry I could not see wood for the trees!
What is happening is that in MyModule you 'use Cwd',
which EXPORTS 'cwd' by default - so now there is a MyModule::cwd
which is a legitimate over-ride of base class's version so...
You call MyModule->new which inherits from Module->new - so far so good.
But then Module::new calls MyModule->cwd which is the imported one.
So fix is:
package MyModule;
use Module;
use base 'Module';
use Cwd (); # No imports!
Alternatively Module's new could do
sub new {
my $p = shift;
Module->cwd; # ignore override by derived class.
}
But that rather spoils it as a base class.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/