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

Re^2: Understanding a OOP Code: Package declared within a Package

by sachinz2 (Acolyte)
on Oct 06, 2016 at 12:29 UTC ( [id://1173401]=note: print w/replies, xml ) Need Help??


in reply to Re: Understanding a OOP Code: Package declared within a Package
in thread Understanding a OOP Code: Package declared within a Package

Hi

No Not like that, What I have is like this,

Package A::B::C;

1;

Package A::B::D;

sub abc {..... ... }

sub xyz { ......... }

Package A::B::E

sub new{ ..... }

Package A::B::F

use base (A::B::E);

Packge A::B::G

use base (A::B::E);

  • Comment on Re^2: Understanding a OOP Code: Package declared within a Package

Replies are listed 'Best First'.
Re^3: Understanding a OOP Code: Package declared within a Package
by BrowserUk (Patriarch) on Oct 06, 2016 at 12:37 UTC

    The same basics apply.

    The number of elements in the name doesn't matter, it is still just a name.

    Any 'relationship' between packages with the same prefix is implied -- for human consumption only -- they are entirely independent as far as Perl is concerned.

    Those packages with the statement use Base (X::Y::Z) at the top, are subclasses of the named package, which does define an OO relationship between them, such that the subclassing package (those with use Base ...), inherit (or overide) all the code (functions/methods) from the named base package.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: Understanding a OOP Code: Package declared within a Package
by Phenomanan (Monk) on Oct 06, 2016 at 13:10 UTC

    This looks like it might just be done for organization or structural purposes, or perhaps to save memory if A::B would be a huge module to load. It should be possible to just have a "Package A::B" at the top without having to specify ::C-F, I might be wrong though.

    Check out this page, specifically the "Naming of modules" section.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found