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

Re: packages (Classes) and file names

by BillKSmith (Monsignor)
on Mar 03, 2023 at 14:05 UTC ( [id://11150713] : note . print w/replies, xml ) Need Help??


in reply to packages (Classes) and file names

I think that you confusion has more to do with "Object Oriented Programming" than with perl's implementation of it. Under "Structured Programming", it would make sense to call different subroutines, depending on configuration. Your scheme would be a reasonable implementation. Under "Object Oriented", objects that behave differently are not members of the same class. You can use subclass to model objects that are almost alike. NERDVANA has outlined a perl implementation of your problem under this scheme.
Bill

Replies are listed 'Best First'.
Re^2: packages (Classes) and file names
by karlgoethebier (Abbot) on Mar 03, 2023 at 19:07 UTC
    «…objects that behave differently are not members of the same class»

    Not necessarily:

    use Monk; use Role::Tiny; … $karl = Monk->new; $bill = Monk->new; Role::Tiny->apply_roles_to_object($karl, qw(Nose)); Role::Tiny->apply_roles_to_object($bill, qw(Cuke)); …

    It is safe to assume that we behave differently. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      In the original post, I recognized my own confusion with anything "Object Oriented". I am not surprised that my explanation is not quite right. I hope that I have motivated shmem to look in the right place for the explanation of his problem.
      Bill