in reply to Re^2: Undefined subroutine - newbie problem
in thread Undefined subroutine - newbie problem

Regarding point #2, there is a major difference between:

package modules::gts;

And:

package gts;

It's important that the package name on that package line, and the package name you call import on match exactly (and case-sensitively!)

If you've still not gotten it working, please post the exact and complete source code of all three files, including their file names and paths.

If you keep only providing partial information about your problem, the best we can do is guess.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^4: Undefined subroutine - newbie problem
by blackhat (Novice) on Aug 14, 2012 at 13:24 UTC
    WONDERFUL! You have found the point ;)
    first of all by using "require" I need to use "import" as well, secondly I need to be more accurate and stop messing modules urls ;)

    One last thing - is there "prettier" way to write that code:
    require modules::gts; #generate_throws_simple require modules::pts; #print_throws_simple require modules::sts; #save_thorows_simple require modules::rt; #read_throws require modules::ss; #statistics_simple import modules::gts; #generate_throws_simple import modules::pts; #print_throws_simple import modules::sts; #save_thorows_simple import modules::rt; #read_throws import modules::ss; #statistics_simple

      Errr... yes, use!

      Or you could do something like this:

      use UNIVERSAL::require; for (qw(gts pts sts rt ss)) { my $mod = "modules::$_"; $mod->require and $mod->import; }

      Though I wouldn't especially recommend it.

      You do know, don't you, that a single module can export more than one sub?

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'