Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: perl OO private methods

by merlyn (Sage)
on Nov 14, 2009 at 15:00 UTC ( #807147=note: print w/replies, xml ) Need Help??

in reply to perl OO private methods

package Foo; ## declare inside-out hashes here: my %attr_a; my %attr_b; ## declare private methods here my $private_1 = sub { my $self = shift; # can use $attr_a{$self} here... ... }; my $private_2 = sub { my $self = shift; ... }; ## public methods here sub new { ... } sub public_1 { my $self = shift; # can access attributes here # can call private methods too, with slightly odd syntax: my $result = $self->$private_1(@args); ... } 1;

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Replies are listed 'Best First'.
Re^2: perl OO private methods
by Anonymous Monk on Nov 14, 2009 at 15:28 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://807147]
[marto]: TCIF!
[Discipulus]: hello northern monks!
[Discipulus]: I do not to bother too much, but considerating you 3 are my long time friends here, do you think this thing of signatures must be considered/ affronted/ discussed?
[Eily]: Hello :)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2017-06-23 08:23 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (538 votes). Check out past polls.