mld has asked for the wisdom of the Perl Monks concerning the following question:

I created a script with following code and executed

use Tk;
$mwin = MainWindow->new();
#$mwin->title("Hello")

The following errors are displayed
Subroutine Cwd::fastcwd redefined at C:/Perl/lib/XSLoader.pm line 91.
Subroutine Cwd::cwd redefined at C:/Perl/lib/Cwd.pm line 547.
Subroutine Cwd::getcwd redefined at C:/Perl/lib/Cwd.pm line 548.
Subroutine Cwd::fastcwd redefined at C:/Perl/lib/Cwd.pm line 549.
Subroutine Cwd::fastgetcwd redefined at C:/Perl/lib/Cwd.pm line 550.
Subroutine Cwd::abs_path redefined at C:/Perl/lib/Cwd.pm line 551.
Prototype mismatch: sub Cwd::abs_path (;$) vs none at C:/Perl/lib/Cwd.pm line 551.
Subroutine Cwd::realpath redefined at C:/Perl/lib/Cwd.pm line 552.
Prototype mismatch: sub Cwd::realpath (;$) vs none at C:/Perl/lib/Cwd.pm line 552.
False [] range "\s-" in regex; marked by <-- HERE in m/\bkoi8\s- <-- HERE _*(ru)$/ at C:/Perl/lib/Encode/Alias.pm line 196.

Help me in resolving the same

Replies are listed 'Best First'.
Re: Subroutine redefined Error
by Narveson (Chaplain) on Mar 27, 2009 at 10:27 UTC

    Something appears to be wrong with your installation of Tk. See if you get the same errors with just

    use Tk;
Re: Subroutine redefined Error
by GrandFather (Saint) on Mar 27, 2009 at 10:28 UTC

    Unless you have a very broken Perl installation, the code that you show can not generate the errors that you list. Tell us about how you installed Perl, its version, and how you install modules.

    On a more general note, and unrelated (probably) to your immediate problem, always use strictures (use strict; use warnings;).


    True laziness is hard work

      I installed ActivePerl-5.8.4.810-MSWin32-x86 into my system. Then I trie to install Tk, the error is thrown it is already installed.But whereas when I tru to run the above said error message uis displayed.

      After ur reply I tried uninstalling perl and reinstalled and once again repeated the above scenario. The same error message appeared.

        I installed ActivePerl-5.8.4.810-MSWin32-x86 into my system.
        Why? Thats from 17-Jun-2004
        There is something wrong in your installation. I dunno what, but I've used Tk with ActiveState 5.6, 5.8 and 5.10.

        I recommend to start over and USE THE ActiveState installer, their ppm (Perl Package Manager) program to get Tk. If a module is available on the ActiveState site, using their installation program is the easiest way to go. I tested this code on my machine and it works fine.

        #!/usr/bin/perl -w use strict; use Tk; my $mwin = MainWindow->new(); $mwin->title("Hello"); MainLoop(); ###oh, this is important to start ###the GUI!!!!!

        Try uninstalling 5.8.4 and install 5.8.8 instead. Note that last time I checked Tk wasn't available as a ppm from ActiveState or from the other repositories I generally use for 5.10.


        True laziness is hard work