Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

OOP: How to (not) lose Encapsulation

by Arunbear (Prior)
on May 12, 2015 at 12:25 UTC ( [id://1126415]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package Set;
    use Moo;
    ...
    }
    
    1;
    
  2. or download this
    % reply
    0> use Set
    ...
    
    4> $s->has(42)
    $res[3] = 1
    
  3. or download this
    package BobUtil;
    
    ...
    }
    
    1;
    
  4. or download this
    % reply
    0> use Set
    ...
    
    5> BobUtil::set_max($s)
    $res[3] = 5
    
  5. or download this
    package BobSet;
    
    ...
    }
    
    1;
    
  6. or download this
    % reply
    0> use BobSet
    ...
    
    4> $s->numeric_max
    $res[3] = 5
    
  7. or download this
    package Set;
    use Moo;
    ...
    }
    
    1;
    
  8. or download this
    % reply
    0> use BobSet
    ...
    
    3> $s->numeric_min
    Not an ARRAY reference at BobSet.pm line 11.
    
  9. or download this
    % reply
    0> use Set
    ...
    
    4> BobUtil::set_min($s)
    Not an ARRAY reference at BobUtil.pm line 8.
    
  10. or download this
    package Set;
    use Moo;
    ...
    }
    
    1;
    
  11. or download this
    % reply
    0> use BobSet
    ...
    
    4> $s->numeric_max
    $res[3] = '5'
    
  12. or download this
    % reply
    0> use Set
    ...
    
    2> $s->add(5)
    Not a HASH reference at Set.pm line 15.
    
  13. or download this
    package Set;
    use Moo;
    ...
    }
    
    1;
    
  14. or download this
    % reply
    0> use Set
    ...
    
    3> $s->has(3)
    $res[2] = 1
    
  15. or download this
    % reply
    0> use RememberingSet
    ...
    
    6> $s->seen(2)
    $res[4] = 0
    
  16. or download this
    package RememberingSet;
    
    ...
    }
    
    1;
    
  17. or download this
    % reply
    0> use RememberingSet
    ...
    
    4> $s->seen(1)
    $res[3] = 3
    
  18. or download this
    package RememberingSet;
    
    ...
    }
    
    1;
    
  19. or download this
    package RememberingSet;
    
    ...
    }
    
    1;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1126415]
Approved by Corion
Front-paged by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-28 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found