a number of changes;
[gitmo/Class-MOP.git] / examples / LazyClass.pod
index e015512..cb678b1 100644 (file)
@@ -1,19 +1,18 @@
 
-package LazyClass;
+package # hide the package from PAUSE
+    LazyClass;
 
 use strict;
 use warnings;
 
-use Class::MOP 'meta';
-
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use base 'Class::MOP::Class';
 
 sub construct_instance {
     my ($class, %params) = @_;
     my $instance = {};
-    foreach my $attr (map { $_->{attribute} } $class->compute_all_applicable_attributes()) {
+    foreach my $attr ($class->compute_all_applicable_attributes()) {
         # 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;
@@ -27,14 +26,13 @@ sub construct_instance {
     return $instance;    
 }
 
-package LazyClass::Attribute;
+package # hide the package from PAUSE
+    LazyClass::Attribute;
 
 use strict;
 use warnings;
 
-use Class::MOP 'meta';
-
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use base 'Class::MOP::Attribute';
 
@@ -79,11 +77,9 @@ LazyClass - An example metaclass with lazy initialization
 
   package BinaryTree;
   
-  sub meta {
-      LazyClass->initialize($_[0] => (
-          ':attribute_metaclass' => 'LazyClass::Attribute'
-      ));
-  }
+  use metaclass 'LazyClass' => (
+      ':attribute_metaclass' => 'LazyClass::Attribute'
+  );
   
   BinaryTree->meta->add_attribute('$:node' => (
       accessor => 'node',