delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/22/03:57:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3FBF24CB.5070708@ThePierianSpring.org>
Date: Sat, 22 Nov 2003 03:56:43 -0500
From: "Randy W. Sims" <RandyS AT ThePierianSpring DOT org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6a) Gecko/20031028
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Nick Ing-Simmons <nick AT ing-simmons DOT net>
CC: module-build-general AT lists DOT sourceforge DOT net, cygwin AT cygwin DOT com,
perl5-porters AT perl DOT org
Subject: Re: Cwd::cwd() bug??? on Cygwin
References: <3FAF853D DOT 4000202 AT urth DOT org> <3FB00F47 DOT 10400 AT ThePierianSpring DOT org> < 3FB0ACC8 DOT 6030402 AT urth DOT org> <3FB30BB3 DOT 10405 AT ThePierianSpring DOT org> < 3FB50640 DOT 2010908 AT urth DOT org> <3FB55A73 DOT 5060806 AT ThePierianSpring DOT org> < 3FB64CB5 DOT 4060802 AT ThePierianSpring DOT org> <3FBD695A.9020307@ ThePierianSpring .org> <20031121110334 DOT 3098 DOT 7 AT llama DOT elixent DOT com> <20031121210304 DOT 2796 DOT 3 AT llama DOT ing-simmons DOT net>
In-Reply-To: <20031121210304.2796.3@llama.ing-simmons.net>

On 11/21/2003 4:03 PM, Nick Ing-Simmons wrote:
> Nick Ing-Simmons <nick DOT ing-simmons AT elixent DOT 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.
> 

Ok, both of these work. I see now where I was flawed in understanding 
this one.

Many thanks to Nick, Adi, and Yitzchak (May I ask how to pronounce your 
name?) for the explanations and solutions.

BTW, strictly speaknig, wouldn't this still be considered a bug, since 
the behaviour difers depending on platform.

-- 
A little learning is a dang'rous thing;
Drink deep, or taste not the Pierian spring;
There shallow draughts intoxicate the brain;
And drinking largely sobers us again.
                 - Alexander Pope


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019