You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/12/14 03:20:30 UTC

[lucy-commits] svn commit: r1214035 - in /incubator/lucy/trunk/clownfish/perl: lib/Clownfish.pm lib/Clownfish.xs t/100-type.t t/101-primitive_type.t t/402-parcel.t

Author: marvin
Date: Wed Dec 14 02:20:30 2011
New Revision: 1214035

URL: http://svn.apache.org/viewvc?rev=1214035&view=rev
Log:
Remove subclassing ability from CFC Perl bindings.

Modified:
    incubator/lucy/trunk/clownfish/perl/lib/Clownfish.pm
    incubator/lucy/trunk/clownfish/perl/lib/Clownfish.xs
    incubator/lucy/trunk/clownfish/perl/t/100-type.t
    incubator/lucy/trunk/clownfish/perl/t/101-primitive_type.t
    incubator/lucy/trunk/clownfish/perl/t/402-parcel.t

Modified: incubator/lucy/trunk/clownfish/perl/lib/Clownfish.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/lib/Clownfish.pm?rev=1214035&r1=1214034&r2=1214035&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/lib/Clownfish.pm (original)
+++ incubator/lucy/trunk/clownfish/perl/lib/Clownfish.pm Wed Dec 14 02:20:30 2011
@@ -87,10 +87,11 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_PARAMS, %args ) or confess $@;
         confess("Missing required param 'contents'")
             unless defined $args{contents};
-        return $either->_new( $args{contents} );
+        return _new( $args{contents} );
     }
 }
 
@@ -140,11 +141,10 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub create {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%create_PARAMS, %args ) or confess $@;
         $args{parcel} = Clownfish::Parcel->acquire( $args{parcel} );
-        my $package = ref($either) || $either;
         return _create(
-            $package,
             @args{
                 qw( parcel exposure class_name cnick micro_sym
                     docucomment source_class parent_class_name final inert )
@@ -161,12 +161,6 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 {
     package Clownfish::Dumpable;
     BEGIN { push our @ISA, 'Clownfish::Base' }
-
-    sub new {
-        my $either = shift;
-        my $package = ref($either) || $either;
-        return $either->_new();
-    }
 }
 
 {
@@ -179,9 +173,9 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_PARAMS, %args ) or confess $@;
-        my $package = ref($either) || $either;
-        return $either->_new( $args{source_class} );
+        return _new( $args{source_class} );
     }
 }
 
@@ -205,11 +199,11 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_PARAMS, %args ) or confess $@;
         $args{inline} ||= 0;
         $args{parcel} = Clownfish::Parcel->acquire( $args{parcel} );
-        my $package = ref($either) || $either;
-        return $package->_new(
+        return _new(
             @args{
                 qw( parcel exposure class_name class_cnick micro_sym
                     return_type param_list docucomment inline )
@@ -231,10 +225,10 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_PARAMS, %args ) or confess $@;
-        my $package = ref($either) || $either;
         my $parser = Clownfish::Parser->new;
-        return $package->_new( @args{qw( source dest )}, $parser );
+        return _new( @args{qw( source dest )}, $parser );
     }
 
     sub _do_parse_file {
@@ -266,11 +260,11 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
     sub new {
         my ( $either, %args ) = @_;
         verify_args( \%new_PARAMS, %args ) or confess $@;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         $args{abstract} ||= 0;
         $args{parcel} = Clownfish::Parcel->acquire( $args{parcel} );
         $args{final} ||= 0;
-        my $package = ref($either) || $either;
-        return $package->_new(
+        return _new(
             @args{
                 qw( parcel exposure class_name class_cnick macro_sym
                     return_type param_list docucomment final abstract )
@@ -290,9 +284,9 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
     sub new {
         my ( $either, %args ) = @_;
         verify_args( \%new_PARAMS, %args ) or confess $@;
-        my $class_name = ref($either)           || $either;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         my $variadic   = delete $args{variadic} || 0;
-        return $class_name->_new($variadic);
+        return _new($variadic);
     }
 }
 
@@ -315,8 +309,8 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
     sub singleton {
         my ( $either, %args ) = @_;
         verify_args( \%singleton_PARAMS, %args ) or confess $@;
-        my $package = ref($either) || $either;
-        return $package->_singleton( @args{qw( name cnick )} );
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
+        return _singleton( @args{qw( name cnick )} );
     }
 
     sub acquire {
@@ -352,9 +346,9 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
     sub new {
         my ( $either, %args ) = @_;
         verify_args( \%new_PARAMS, %args ) or confess $@;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         $args{parcel} = Clownfish::Parcel->acquire( $args{parcel} );
-        my $class_class = ref($either) || $either;
-        return $class_class->_new(
+        return _new(
             @args{qw( parcel exposure class_name class_cnick micro_sym )} );
     }
 }
@@ -386,6 +380,7 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
     sub new {
         my ( $either, %args ) = @_;
         my $package = ref($either) || $either;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_PARAMS, %args ) or confess $@;
 
         my $flags = 0;
@@ -410,8 +405,7 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
         my $specifier   = $args{specifier}   || '';
         my $c_string    = $args{c_string}    || '';
 
-        return $package->_new( $flags, $parcel, $specifier, $indirection,
-            $c_string );
+        return _new( $flags, $parcel, $specifier, $indirection, $c_string );
     }
 
     our %new_integer_PARAMS = (
@@ -421,11 +415,11 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new_integer {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_integer_PARAMS, %args ) or confess $@;
         my $flags = 0;
         $flags |= CONST if $args{const};
-        my $package = ref($either) || $either;
-        return $package->_new_integer( $flags, $args{specifier} );
+        return _new_integer( $flags, $args{specifier} );
     }
 
     our %new_float_PARAMS = (
@@ -435,11 +429,11 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new_float {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_float_PARAMS, %args ) or confess $@;
         my $flags = 0;
         $flags |= CONST if $args{const};
-        my $package = ref($either) || $either;
-        return $package->_new_float( $flags, $args{specifier} );
+        return _new_float( $flags, $args{specifier} );
     }
 
     our %new_object_PARAMS = (
@@ -454,6 +448,7 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new_object {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_object_PARAMS, %args ) or confess $@;
         my $flags = 0;
         $flags |= INCREMENTED if $args{incremented};
@@ -465,7 +460,7 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
         my $package = ref($either) || $either;
         confess("Missing required param 'specifier'")
             unless defined $args{specifier};
-        return $package->_new_object( $flags, $parcel, $args{specifier},
+        return _new_object( $flags, $parcel, $args{specifier},
             $args{indirection} );
     }
 
@@ -478,30 +473,29 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new_composite {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_composite_PARAMS, %args ) or confess $@;
         my $flags = 0;
         $flags |= NULLABLE if $args{nullable};
         my $indirection = $args{indirection} || 0;
         my $array = defined $args{array} ? $args{array} : "";
-        my $package = ref($either) || $either;
-        return $package->_new_composite( $flags, $args{child}, $indirection,
-            $array );
+        return _new_composite( $flags, $args{child}, $indirection, $array );
     }
 
     our %new_void_PARAMS = ( const => undef, );
 
     sub new_void {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_void_PARAMS, %args ) or confess $@;
-        my $package = ref($either) || $either;
-        return $package->_new_void( !!$args{const} );
+        return _new_void( !!$args{const} );
     }
 
     sub new_va_list {
         my $either = shift;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( {}, @_ ) or confess $@;
-        my $package = ref($either) || $either;
-        return $either->_new_va_list();
+        return _new_va_list();
     }
 
     our %new_arbitrary_PARAMS = (
@@ -511,10 +505,10 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new_arbitrary {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_arbitrary_PARAMS, %args ) or confess $@;
-        my $package = ref($either) || $either;
         my $parcel = Clownfish::Parcel->acquire( $args{parcel} );
-        return $package->_new_arbitrary( $parcel, $args{specifier} );
+        return _new_arbitrary( $parcel, $args{specifier} );
     }
 }
 
@@ -536,11 +530,11 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
 
     sub new {
         my ( $either, %args ) = @_;
+        confess "no subclassing allowed" unless $either eq __PACKAGE__;
         verify_args( \%new_PARAMS, %args ) or confess $@;
         $args{exposure} ||= 'local';
         $args{parcel} = Clownfish::Parcel->acquire( $args{parcel} );
-        my $package = ref($either) || $either;
-        return $package->_new(
+        return _new(
             @args{
                 qw( parcel exposure class_name class_cnick micro_sym type inert )
                 }
@@ -705,20 +699,6 @@ BEGIN { XSLoader::load( 'Clownfish', '0.
     use Carp;
     use Clownfish::Util qw( verify_args );
 
-    our %new_PARAMS = (
-        param_list         => undef,
-        alias              => undef,
-        class_name         => undef,
-        use_labeled_params => undef,
-    );
-
-    sub new {
-        my ( $either, %args ) = @_;
-        verify_args( \%new_PARAMS, %args ) or confess $@;
-        return _new( ref($either) || $either,
-            @args{qw( param_list class_name alias use_labeled_params )} );
-    }
-
     sub xsub_def { confess "Abstract method" }
 }
 

Modified: incubator/lucy/trunk/clownfish/perl/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/lib/Clownfish.xs?rev=1214035&r1=1214034&r2=1214035&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/lib/Clownfish.xs (original)
+++ incubator/lucy/trunk/clownfish/perl/lib/Clownfish.xs Wed Dec 14 02:20:30 2011
@@ -88,8 +88,7 @@ S_sv_eat_c_string(char *string) {
 MODULE = Clownfish    PACKAGE = Clownfish::CBlock
 
 SV*
-_new(klass, contents)
-    const char *klass;
+_new(contents)
     const char *contents;
 CODE:
     CFCCBlock *self = CFCCBlock_new(contents);
@@ -122,8 +121,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Class
 
 SV*
-_create(klass, parcel, exposure_sv, class_name_sv, cnick_sv, micro_sym_sv, docucomment, source_class_sv, parent_class_name_sv, is_final, is_inert)
-    const char *klass;
+_create(parcel, exposure_sv, class_name_sv, cnick_sv, micro_sym_sv, docucomment, source_class_sv, parent_class_name_sv, is_final, is_inert)
     CFCParcel *parcel;
     SV *exposure_sv;
     SV *class_name_sv;
@@ -430,6 +428,9 @@ parse(klass, text)
     const char *klass;
     const char *text;
 CODE:
+    if (strcmp(klass, "Clownfish::DocuComment")) {
+        croak("No subclassing allowed");
+    }
     CFCDocuComment *self = CFCDocuComment_parse(text);
     RETVAL = S_cfcbase_to_perlref(self);
     CFCBase_decref((CFCBase*)self);
@@ -504,9 +505,12 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Dumpable
 
 SV*
-_new(klass)
+new(klass)
     const char *klass;
 CODE:
+    if (strcmp(klass, "Clownfish::Dumpable")) {
+        croak("No subclassing allowed");
+    }
     CFCDumpable *self = CFCDumpable_new();
     RETVAL = S_cfcbase_to_perlref(self);
     CFCBase_decref((CFCBase*)self);
@@ -529,8 +533,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::File
 
 SV*
-_new(klass, source_class)
-    const char *klass;
+_new(source_class)
     const char *source_class;
 CODE:
     CFCFile *self = CFCFile_new(source_class);
@@ -637,8 +640,7 @@ OUTPUT: RETVAL
 MODULE = Clownfish    PACKAGE = Clownfish::Function
 
 SV*
-_new(klass, parcel, exposure_sv, class_name_sv, class_cnick_sv, micro_sym_sv, return_type, param_list, docucomment, is_inline)
-    const char *klass;
+_new(parcel, exposure_sv, class_name_sv, class_cnick_sv, micro_sym_sv, return_type, param_list, docucomment, is_inline)
     CFCParcel *parcel;
     SV *exposure_sv;
     SV *class_name_sv;
@@ -722,8 +724,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Hierarchy
 
 SV*
-_new(klass, source, dest, parser)
-    const char *klass;
+_new(source, dest, parser)
     const char *source;
     const char *dest;
     CFCParser *parser;
@@ -791,8 +792,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Method
 
 SV*
-_new(klass, parcel, exposure_sv, class_name_sv, class_cnick_sv, macro_sym, return_type, param_list, docucomment, is_final, is_abstract)
-    const char *klass;
+_new(parcel, exposure_sv, class_name_sv, class_cnick_sv, macro_sym, return_type, param_list, docucomment, is_final, is_abstract)
     CFCParcel *parcel;
     SV *exposure_sv;
     SV *class_name_sv;
@@ -950,7 +950,6 @@ MODULE = Clownfish    PACKAGE = Clownfis
 
 SV*
 _new(klass, variadic)
-    const char *klass;
     int variadic;
 CODE:
     CFCParamList *self = CFCParamList_new(variadic);
@@ -1040,8 +1039,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Parcel
 
 SV*
-_singleton(klass, name_sv, cnick_sv)
-    const char *klass;
+_singleton(name_sv, cnick_sv)
     SV *name_sv;
     SV *cnick_sv;
 CODE:
@@ -1121,8 +1119,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Symbol
 
 SV*
-_new(klass, parcel, exposure, class_name_sv, class_cnick_sv, micro_sym_sv)
-    const char *klass;
+_new(parcel, exposure, class_name_sv, class_cnick_sv, micro_sym_sv)
     CFCParcel *parcel;
     const char *exposure;
     SV *class_name_sv;
@@ -1140,8 +1137,8 @@ CODE:
                               : NULL;
     CFCSymbol *self = CFCSymbol_new(parcel, exposure, class_name, class_cnick,
                                     micro_sym);
-    RETVAL = newSV(0);
-    sv_setref_pv(RETVAL, klass, (void*)self);
+    RETVAL = S_cfcbase_to_perlref(self);
+    CFCBase_decref((CFCBase*)self);
 OUTPUT: RETVAL
 
 int
@@ -1252,8 +1249,7 @@ PPCODE:
 MODULE = Clownfish    PACKAGE = Clownfish::Type
 
 SV*
-_new(klass, flags, parcel, specifier, indirection, c_string)
-    const char *klass;
+_new(flags, parcel, specifier, indirection, c_string)
     int flags;
     CFCParcel *parcel;
     const char *specifier;
@@ -1267,8 +1263,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_integer(klass, flags, specifier)
-    const char *klass;
+_new_integer(flags, specifier)
     int flags;
     const char *specifier;
 CODE:
@@ -1278,8 +1273,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_float(klass, flags, specifier)
-    const char *klass;
+_new_float(flags, specifier)
     int flags;
     const char *specifier;
 CODE:
@@ -1289,8 +1283,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_object(klass, flags, parcel, specifier, indirection)
-    const char *klass;
+_new_object(flags, parcel, specifier, indirection)
     int flags;
     CFCParcel *parcel;
     const char *specifier;
@@ -1302,8 +1295,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_composite(klass, flags, child_sv, indirection, array)
-    const char *klass;
+_new_composite(flags, child_sv, indirection, array)
     int flags;
     SV *child_sv;
     int indirection;
@@ -1323,8 +1315,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_void(klass, is_const)
-    const char *klass;
+_new_void(is_const)
     int is_const;
 CODE:
     CFCType *self = CFCType_new_void(is_const);
@@ -1333,8 +1324,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_va_list(klass)
-    const char *klass;
+_new_va_list()
 CODE:
     CFCType *self = CFCType_new_va_list();
     RETVAL = S_cfcbase_to_perlref(self);
@@ -1342,8 +1332,7 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-_new_arbitrary(klass, parcel, specifier)
-    const char *klass;
+_new_arbitrary(parcel, specifier)
     CFCParcel *parcel;
     const char *specifier;
 CODE:
@@ -1624,8 +1613,7 @@ OUTPUT: RETVAL
 MODULE = Clownfish   PACKAGE = Clownfish::Variable
 
 SV*
-_new(klass, parcel, exposure, class_name_sv, class_cnick_sv, micro_sym_sv, type_sv, inert_sv)
-    const char *klass;
+_new(parcel, exposure, class_name_sv, class_cnick_sv, micro_sym_sv, type_sv, inert_sv)
     CFCParcel *parcel;
     const char *exposure;
     SV *class_name_sv;
@@ -1853,20 +1841,6 @@ PPCODE:
 
 MODULE = Clownfish   PACKAGE = Clownfish::Binding::Perl::Subroutine
 
-SV*
-_new(klass, param_list, class_name, alias, use_labeled_params)
-    const char *klass;
-    CFCParamList *param_list;
-    const char *class_name;
-    const char *alias;
-    int use_labeled_params;
-CODE:
-    CFCPerlSub *self = CFCPerlSub_new(klass, param_list, class_name,
-                                      alias, use_labeled_params);
-    RETVAL = S_cfcbase_to_perlref(self);
-    CFCBase_decref((CFCBase*)self);
-OUTPUT: RETVAL
-
 void
 DESTROY(self)
     CFCPerlSub *self;
@@ -2209,6 +2183,9 @@ SV*
 new(klass)
     const char *klass;
 CODE:
+    if (strcmp(klass, "Clownfish::Parser")) {
+        croak("No subclassing allowed");
+    }
     CFCParser *self = CFCParser_new();
     RETVAL = S_cfcbase_to_perlref(self);
     CFCBase_decref((CFCBase*)self);

Modified: incubator/lucy/trunk/clownfish/perl/t/100-type.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/t/100-type.t?rev=1214035&r1=1214034&r2=1214035&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/t/100-type.t (original)
+++ incubator/lucy/trunk/clownfish/perl/t/100-type.t Wed Dec 14 02:20:30 2011
@@ -16,16 +16,12 @@
 use strict;
 use warnings;
 
-package MyType;
-use base qw( Clownfish::Type );
-
-package main;
 use Test::More tests => 11;
 use Clownfish::Parcel;
 
 my $neato_parcel = Clownfish::Parcel->singleton( name => 'Neato' );
 
-my $type = MyType->new( parcel => 'Neato', specifier => 'mytype_t' );
+my $type = Clownfish::Type->new( parcel => 'Neato', specifier => 'mytype_t' );
 is( $type->get_parcel, $neato_parcel,
     "constructor changes parcel name to Parcel singleton" );
 

Modified: incubator/lucy/trunk/clownfish/perl/t/101-primitive_type.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/t/101-primitive_type.t?rev=1214035&r1=1214034&r2=1214035&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/t/101-primitive_type.t (original)
+++ incubator/lucy/trunk/clownfish/perl/t/101-primitive_type.t Wed Dec 14 02:20:30 2011
@@ -15,27 +15,22 @@
 
 use strict;
 use warnings;
-
-package MyPrimitiveType;
-use base qw( Clownfish::Type );
-
-sub new {
-    my $either = shift;
-    return $either->SUPER::new( @_, primitive => 1, );
-}
-
-package main;
 use Test::More tests => 4;
+use Clownfish;
 
-my $type = MyPrimitiveType->new( specifier => 'hump_t' );
+my $type = new_primitive_type( specifier => 'hump_t' );
 ok( $type->is_primitive, "is_primitive" );
 
-my $other = MyPrimitiveType->new( specifier => 'hump_t' );
+my $other = new_primitive_type( specifier => 'hump_t' );
 ok( $type->equals($other), "equals()" );
 
-$other = MyPrimitiveType->new( specifier => 'dump_t' );
+$other = new_primitive_type( specifier => 'dump_t' );
 ok( !$type->equals($other), "equals() spoiled by specifier" );
 
-$other = MyPrimitiveType->new( specifier => 'hump_t', const => 1 );
+$other = new_primitive_type( specifier => 'hump_t', const => 1 );
 ok( !$type->equals($other), "equals() spoiled by const" );
 
+sub new_primitive_type {
+    return Clownfish::Type->new( @_, primitive => 1 );
+}
+

Modified: incubator/lucy/trunk/clownfish/perl/t/402-parcel.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/t/402-parcel.t?rev=1214035&r1=1214034&r2=1214035&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/t/402-parcel.t (original)
+++ incubator/lucy/trunk/clownfish/perl/t/402-parcel.t Wed Dec 14 02:20:30 2011
@@ -20,24 +20,22 @@ use Test::More tests => 7;
 
 BEGIN { use_ok('Clownfish::Parcel') }
 
-package ClownfishyThing;
-use base qw( Clownfish::Symbol );
-
-sub new {
-    return shift->SUPER::new( micro_sym => 'sym', exposure => 'parcel', @_ );
-}
-
-package main;
-
 # Register singleton.
 Clownfish::Parcel->singleton( name => 'Crustacean', cnick => 'Crust', );
 
-my $thing = ClownfishyThing->new;
+my $thing = Clownfish::Symbol->new(
+    micro_sym => 'sym',
+    exposure  => 'parcel',
+);
 is( $thing->get_prefix, '', 'get_prefix with no parcel' );
 is( $thing->get_Prefix, '', 'get_Prefix with no parcel' );
 is( $thing->get_PREFIX, '', 'get_PREFIx with no parcel' );
 
-$thing = ClownfishyThing->new( parcel => 'Crustacean' );
+$thing = Clownfish::Symbol->new(
+    micro_sym => 'sym',
+    parcel    => 'Crustacean',
+    exposure  => 'parcel'
+);
 is( $thing->get_prefix, 'crust_', 'get_prefix with parcel' );
 is( $thing->get_Prefix, 'Crust_', 'get_Prefix with parcel' );
 is( $thing->get_PREFIX, 'CRUST_', 'get_PREFIx with parcel' );