This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
compatibility tweak for Class::Struct
authorGurusamy Sarathy <gsar@cpan.org>
Mon, 5 Jul 1999 01:20:58 +0000 (01:20 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Mon, 5 Jul 1999 01:20:58 +0000 (01:20 +0000)
p4raw-id: //depot/perl@3579

lib/Class/Struct.pm

index d8327bc..3e08e80 100644 (file)
@@ -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;