Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Moo error message not understood

by ikegami (Pope)
on Jan 17, 2014 at 18:28 UTC ( #1070999=note: print w/ replies, xml ) Need Help??


in reply to Moo error message not understood

use Some::Module;
can be inlined as
BEGIN { ... Contents of Some/Module.pm ... $INC{'Some/Module.pm'} = 1; } use Some::Module;

(There are differences, such as lexical pragmas before the BEGIN block will also affect the BEGIN block, but it's a good starting point.)

So what you want:

use strict; use warnings; use diagnostics; use 5.014; BEGIN { package Lib::Book; use Moo; has isbn => ( is => 'rw', ); $INC{"Lib/Book.pm"} = 1; } use Lib::Book; my $newbook = Lib::Book->new( isbn => 'ISBN', ); say $newbook->isbn;


Comment on Re: Moo error message not understood
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-09-21 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls