Paul Johnson wrote:
Astute readers may recognise the rules I am attempting to use.
Damian Conway's Perl best Practices, *everyone* should own this book :)
Mr. Johnson just got a few more points in my book ;p
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMA
On Fri, Jun 09, 2006 at 09:18:22AM -0700, Lawrence Statton wrote:
> Our local style guide bans the
> use of for without an explicit index variable
Every style guide should have a rule that says "break these rules if you
consider it sensible to do so, but be
Shawn wrote:
> > > > I would prefer it to return the old value:
> > > >
> > > > sub foo {
> > > > my $self = shift;
> > > > my $old_foo = $self->{'foo'};
> > > > $self->{'foo'} = shift if @_ > 0;
> > > > return $old_foo;
> > > > }
> > > >
> > > >
Someone asked: (Sorry, I've lost the attr
On 6/8/06, Lawrence Statton <[EMAIL PROTECTED]> wrote:
> > I would prefer it to return the old value:
> >
> > sub foo {
I see...I i've been more or less looking at the current state
$curr = $foo->bar();
$old = $curr;
$curr = $foo->bar('new value');
--
Anthony Ettinger
Signature: http://cho
> > I would prefer it to return the old value:
> >
> > sub foo {
> > my $self = shift;
> > my $old_foo = $self->{'foo'};
> > $self->{'foo'} = shift if @_ > 0;
> > return $old_foo;
> > }
> >
> >
>
> If you set a new value, why would you want your client to still be
> using the old value?
B
On 6/8/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
On Thu, 2006-08-06 at 10:56 -0700, Anthony Ettinger wrote:
> i prefer the return once method:
>
> sub foo
> {
> my $self = shift;
> if (@_ == 1) { $self->{'foo'} = shift; }
>
> return $self->{'foo'};
> }
I would prefer it to re
On Thu, 2006-08-06 at 10:56 -0700, Anthony Ettinger wrote:
> i prefer the return once method:
>
> sub foo
> {
> my $self = shift;
> if (@_ == 1) { $self->{'foo'} = shift; }
>
> return $self->{'foo'};
> }
I would prefer it to return the old value:
sub foo {
my $self = shift;
my $
On 6/8/06, Ricardo SIGNES <[EMAIL PROTECTED]> wrote:
* Graeme McLaren <[EMAIL PROTECTED]> [2006-06-08T05:44:05]
> Hi all, I've just been reading a bit about accessor get/set methods. I
> have a method:
>
> sub even{
>my $self = shift;
>my $even = shift;
>
>$self->{_even} = $even if
* Graeme McLaren <[EMAIL PROTECTED]> [2006-06-08T05:44:05]
> Hi all, I've just been reading a bit about accessor get/set methods. I
> have a method:
>
> sub even{
>my $self = shift;
>my $even = shift;
>
>$self->{_even} = $even if defined($even);
>return $self->{_even};
> }
>
Hi all, I've just been reading a bit about accessor get/set methods. I have
a method:
sub even{
my $self = shift;
my $even = shift;
$self->{_even} = $even if defined($even);
return $self->{_even};
}
This basically does what a get and set method would do. So why would I need
a
10 matches
Mail list logo