p4raw-id: //depot/perl@7926
sub import {
my $self = shift;
- if ( @_ % 2 == 0 ) {
- &struct;
- } else {
+ if ( @_ == 0 ) {
$self->export_to_level( 1, $self, @EXPORT );
+ } elsif ( @_ == 1 ) {
+ # This is admittedly a little bit silly:
+ # do we ever export anything else than 'struct'...?
+ $self->export_to_level( 1, $self, @_ );
+ } else {
+ &struct;
}
}
package MyObj;
-use Class::Struct 'struct';
+use Class::Struct;
+use Class::Struct 'struct'; # test out both forms
use Class::Struct SomeClass => { SomeElem => '$' };