develooper Front page | perl.perl6.users | Postings from September 2017

Re: :: question

Thread Previous | Thread Next
From:
Brandon Allbery
Date:
September 14, 2017 05:57
Subject:
Re: :: question
Message ID:
CAKFCL4V0--eYwuCZmGZC-_QQnZHhyv1aEQOVb8VMHwzo+ff+Ng@mail.gmail.com
On Thu, Sep 14, 2017 at 1:48 AM, Brandon Allbery <allbery.b@gmail.com>
wrote:

> If you want to use the other way, the CheckSystemDependency module MUST
> define Which as: our sub Which ...
> If it is not explicitly declared "our", then it is declared "my" and the
> only way the name can be seen outside the CheckSystemDependency module is
> for it to be exported and for your module to import it.
>
> You cannot simply call any sub you see in a different module. If it is not
> explicitly declared "our" then you cannot access it; it is declared locally
> to that module and cannot be seen anywhere else.
>

If this is still not clear, let's try an example:

  pyanfar Z$ 6 'module Foo { sub a { say "nope" }; our sub b { say "yep" }
}; Foo::b();'
  yep
  pyanfar Z$ 6 'module Foo { sub a { say "nope" }; our sub b { say "yep" }
}; Foo::a();'
  Could not find symbol '&a'
    in block <unit> at -e line 1


-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About