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

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

Replies are listed 'Best First'.
Re^5: Undefined subroutine - newbie problem
by tobyink (Canon) on Aug 14, 2012 at 13:43 UTC

    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'