changes-to-this
[gitmo/Class-MOP.git] / examples / ClassEncapsulatedAttributes.pod
index 9b6d9bf..ff486ad 100644 (file)
@@ -5,7 +5,7 @@ package # hide the package from PAUSE
 use strict;
 use warnings;
 
-our $VERSION = '0.02';
+our $VERSION = '0.03';
 
 use base 'Class::MOP::Class';
 
@@ -22,12 +22,12 @@ sub construct_instance {
     foreach my $current_class ($class->class_precedence_list()) {
         $instance->{$current_class} = {} 
             unless exists $instance->{$current_class};
-        my $meta = $class->initialize($current_class);
+        my $meta = $current_class->meta;
         foreach my $attr_name ($meta->get_attribute_list()) {
             my $attr = $meta->get_attribute($attr_name);
             # if the attr has an init_arg, use that, otherwise,
             # use the attributes name itself as the init_arg
-            my $init_arg = $attr->has_init_arg() ? $attr->init_arg() : $attr->name;
+            my $init_arg = $attr->init_arg();
             # try to fetch the init arg from the %params ...
             my $val;        
             $val = $params{$current_class}->{$init_arg} 
@@ -111,7 +111,7 @@ ClassEncapsulatedAttributes - A set of example metaclasses with class encapsulat
   
   sub new  {
       my $class = shift;
-      bless $class->meta->construct_instance(@_) => $class;
+      $class->meta->new_object(@_);
   }
   
   package Bar;