in reply to perl reports fastcwd 'redefined' when using Cwd and -W

On Linux, it also seems to depend on the Perl version. Just tried it: with v5.8.4, I can reproduce the error, but not with v5.8.8.

So, if upgrading is an option, that's probably the easiest route...

Update: no warnings 'redefine', as mentioned below, doesn't seem to help - i.e. I do get the same error with v5.8.4

Replies are listed 'Best First'.
Re^2: perl reports fastcwd 'redefined' when using Cwd and -W
by Khen1950fx (Canon) on Jan 19, 2007 at 21:29 UTC
    I ran it on FC6. It worked fine. You might try this:

    #!/usr/bin/perl use Cwd; use strict; use warnings; no warnings 'redefine'; my $cwd = getcwd(); print "You're in '", getcwd(), "'\n";

      That won't work for two reasons.

      • no warnings 'redefine'; won't affect Cwd, just the block in which it appears. It's lexically scoped.
      • The -W used by the OP overrides no warnings.