CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Moose - readonly attr. can change

 



waltz
Novice

Jun 8, 2011, 2:10 AM

Post #1 of 1 (318 views)
Moose - readonly attr. can change Can't Post

Hello,

see at code:


Code
package Obj; 
use Moose;

has "num" => (
is => "ro",
isa => "Int",
default => 10
);

package Main;

my $o1 = Obj->new();

$o1->{num} = 20;

print $o1->num; # return 20, but "num" atrtribute is read-only ??, ..


..how it is possible that i can change read-only attribute "num" ?? :o

Thank for explain...

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives