Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: Undefined subroutine - newbie problem

by blackhat (Novice)
on Aug 14, 2012 at 13:24 UTC ( [id://987354]=note: print w/replies, xml ) Need Help??


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'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://987354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found