Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Creating exception classes

by tobyink (Abbot)
on Feb 05, 2013 at 10:08 UTC ( #1017101=note: print w/ replies, xml ) Need Help??


in reply to Re: Creating exception classes
in thread Creating exception classes

"When you write A::B::C in your program, perl searches all the directories in @INC for a directory named A that has a subdirectory named B, which contains a file called C.pm."

No it doesn't. It only does that search if you write use A::B::C, no A::B::C or require A::B::C. Merely mentioning the A::B::C package (for example, to call a constructor) does not force Perl to attempt to load the module.

The following code does not attempt to load "This/File/Does/No/Exist/On/My/Disk.pm"...

use strict; use warnings; { package This::File::Does::No::Exist::On::My::Disk; require Math::BigInt; our @ISA = 'Math::BigInt'; } my $number = This::File::Does::No::Exist::On::My::Disk->new(7); print $number * 6, "\n";
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re^2: Creating exception classes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-10-21 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (103 votes), past polls