summaryrefslogtreecommitdiff
path: root/lib/Class/Struct.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Class/Struct.pm')
-rw-r--r--lib/Class/Struct.pm1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Class/Struct.pm b/lib/Class/Struct.pm
index d8327bc7ab..3e08e801d0 100644
--- a/lib/Class/Struct.pm
+++ b/lib/Class/Struct.pm
@@ -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;