Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: How to pass an argument to a Module?

by tobyink (Abbot)
on Sep 09, 2012 at 21:29 UTC ( #992629=note: print w/replies, xml ) Need Help??


in reply to Re^4: How to pass an argument to a Module?
in thread How to pass an argument to a Module?

Despite the Perl6::Export::Attrs pod, IMPORT should just be a plain old sub.

sub IMPORT { ... }

Here's a full example:

use 5.010; use strict; { package Local::MyTest; no thanks; use Perl6::Export::Attrs; sub foobar :Export(:DEFAULT) { return 1; } sub IMPORT { say "in the IMPORT block! Got: @_"; } } use Local::MyTest qw(1 2 3 :DEFAULT); say "YEAH!" if foobar();
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
Node Status?
node history
Node Type: note [id://992629]
help
Chatterbox?
[choroba]: Yes, tried now. Login didn't show the login window at all, timed out, but worked for the second time instantly.
[choroba]: Trying the daemon log...
[choroba]: It seems very slow. But the internet is weird here in Vietnam...
[choroba]: again, stopping it and trying for the second time fixed the problem
[marto]: good morning all

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2017-02-22 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (325 votes). Check out past polls.