Integrate with Sarathy.
[p5sagit/p5-mst-13.2.git] / lib / Class / Struct.pm
index d8327bc..b4f2117 100644 (file)
@@ -2,10 +2,10 @@ package Class::Struct;
 
 ## See POD after __END__
 
-require 5.002;
+use 5.005_64;
 
 use strict;
-use vars qw(@ISA @EXPORT $VERSION);
+our(@ISA, @EXPORT, $VERSION);
 
 use Carp;
 
@@ -101,6 +101,7 @@ sub struct {
 
     $out = "{\n  package $class;\n  use Carp;\n  sub new {\n";
     $out .= "    my (\$class, \%init) = \@_;\n";
+    $out .= "    \$class = __PACKAGE__ unless \@_;\n";
 
     my $cnt = 0;
     my $idx = 0;
@@ -354,7 +355,7 @@ The element is an array, initialized by default to C<()>.
 
 With no argument, the accessor returns a reference to the
 element's whole array (whether or not the element was
-specified as C<'@'> or C<'*@').
+specified as C<'@'> or C<'*@'>).
 
 With one or two arguments, the first argument is an index
 specifying one element of the array; the second argument, if
@@ -369,7 +370,7 @@ The element is a hash, initialized by default to C<()>.
 
 With no argument, the accessor returns a reference to the
 element's whole hash (whether or not the element was
-specified as C<'%'> or C<'*%').
+specified as C<'%'> or C<'*%'>).
 
 With one or two arguments, the first argument is a key specifying
 one element of the hash; the second argument, if present, is
@@ -519,6 +520,7 @@ struct's constructor.
     print "(which was a ", $cat->breed->name, ")\n";
     print "had two kittens: ", join(' and ', @{$cat->kittens}), "\n";
 
+=back
 
 =head1 Author and Modification History