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

I before I had a larger program with many subrutines. Now I have taken them out and created a module out of them. When I try to run the program for each subrutine in the module I get the error(?) message:


Subrutine xxx redefined at C:/... program line ..

Do you perhaps know why this message appears?

Replies are listed 'Best First'.
Re: Message while using modlues
by japhy (Canon) on May 02, 2006 at 13:26 UTC
    You seem to be loading a file more than once that defines functions. That shouldn't really happen. Are you doing do "somefile.pl" to load the function definitions? If so, you shouldn't be. You should be using require "somefile.pl" instead. But then again, you haven't shown any code at all, so I could be entirely wrong.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
      Hmm.. now I know that you for your help.
Re: Message while using modlues
by mda2 (Hermit) on May 02, 2006 at 17:09 UTC
    You can use diagnostics module to understand many warnings and errors...

    Using this code:

    use warnings; use strict; sub a{ 1 }; sub a{ 2 };

    Diagnostics says:

    $ perl -Mdiagnostics x Subroutine a redefined at x line 6 (#1) (W redefine) You redefined a subroutine. To suppress this warning +, say { no warnings 'redefine'; eval "sub name { ... }"; }

    .............

    --
    Marco Antonio
    Rio-PM