develooper Front page | perl.perl6.language | Postings from August 2001

Temp properties

Thread Next
From:
John Siracusa
Date:
August 14, 2001 11:48
Subject:
Temp properties
Message ID:
B79EEAB3.1D623%siracusa@mindspring.com
(I figured it'd take me longer to track this information down myself than it
would to get a response from the list.  Laziness... :)

Can properties be temp()orarily masked?  For example:

    foreach my $array (@arrays)
    {
      temp $array.sep = ', '; # assuming this is a real property
      print "$array\n";       # prints "item1, item2, item3, ..."
    }

versus an (annoying) explicit save and restore:

    foreach my $array (@arrays)
    {
      my $old_sep =  $array.sep;

      $array.sep = ', ';
      print "$array\n";

      $array.sep = $old_sep;
    }

If it's not possible, I think it should be :)

-John


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About