r32807 - in /branches/upstream/libacme-damn-perl: ./ current/ current/t/
ra28145-guest at users.alioth.debian.org
ra28145-guest at users.alioth.debian.org
Wed Apr 8 20:47:26 UTC 2009
Author: ra28145-guest
Date: Wed Apr 8 20:47:20 2009
New Revision: 32807
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32807
Log:
[svn-inject] Installing original source of libacme-damn-perl
Added:
branches/upstream/libacme-damn-perl/
branches/upstream/libacme-damn-perl/current/
branches/upstream/libacme-damn-perl/current/Changes
branches/upstream/libacme-damn-perl/current/Damn.pm
branches/upstream/libacme-damn-perl/current/Damn.xs
branches/upstream/libacme-damn-perl/current/MANIFEST
branches/upstream/libacme-damn-perl/current/META.yml
branches/upstream/libacme-damn-perl/current/Makefile.PL
branches/upstream/libacme-damn-perl/current/README
branches/upstream/libacme-damn-perl/current/t/
branches/upstream/libacme-damn-perl/current/t/1compile.t
branches/upstream/libacme-damn-perl/current/t/2damn.t
branches/upstream/libacme-damn-perl/current/t/3aliases.t
branches/upstream/libacme-damn-perl/current/t/4name.t
branches/upstream/libacme-damn-perl/current/t/5bad.t
Added: branches/upstream/libacme-damn-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/Changes?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/Changes (added)
+++ branches/upstream/libacme-damn-perl/current/Changes Wed Apr 8 20:47:20 2009
@@ -1,0 +1,12 @@
+Revision history for Perl extension Acme::Damn.
+$Id: Changes,v 1.4 2006-02-05 00:07:57 ian Exp $
+
+0.03 Sat Feb 5 00:09:32 2006
+ - added support for any alias, not just the ones defined in v0.02
+
+0.02 Tue Jun 10 18:13:31 2003
+ - added support for aliases for damn() as suggested by
+ Claes Jacobsson <claes at surfar.nu>
+
+0.01 Sun Jun 8 13:40:03 2003
+ - initial Acme::Damn release
Added: branches/upstream/libacme-damn-perl/current/Damn.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/Damn.pm?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/Damn.pm (added)
+++ branches/upstream/libacme-damn-perl/current/Damn.pm Wed Apr 8 20:47:20 2009
@@ -1,0 +1,166 @@
+# $Id: Damn.pm,v 1.10 2006-02-05 00:03:42 ian Exp $
+package Acme::Damn;
+
+use 5.000;
+use strict;
+
+require Exporter;
+require DynaLoader;
+
+use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
+
+ $VERSION = '0.03';
+ @ISA = qw( Exporter DynaLoader );
+ @EXPORT = qw( damn );
+
+
+sub import
+{
+ my $class = shift;
+
+ # check the unknown symbols to ensure they are 'safe'
+ my @bad = grep { /\W/o } @_;
+ if ( @bad ) {
+ # throw an error message informing the user where the problem is
+ my ( undef, $file , $line ) = caller 0;
+
+ die sprintf( "Bad choice of symbol name%s %s for import at %s line %s\n"
+ , ( @bad == 1 ) ? '' : 's'
+ , join( ', ' , map { qq|'$_'| } @bad ) , $file , $line );
+ }
+
+ # remove duplicates from the list of aliases, as well as those symbol
+ # names listed in @EXPORT
+ my @aliases = do { local %_;
+ @_{ @_ } = undef;
+ delete @_{ @EXPORT };
+ keys %_ };
+
+ # 'import' the symbols into the host package
+ my ( $pkg ) = caller 1;
+ foreach my $alias ( @aliases ) {
+ no strict 'refs';
+
+ *{ $pkg . '::' . $alias } = sub {
+ my $ref = shift;
+ my ( undef , $file , $line ) = caller 1;
+
+ # call damn() with the location of where this method was
+ # originally called
+ &{ __PACKAGE__ . '::damn' }( $ref , $alias , $file , $line );
+
+ # NB: wanted to do something like
+ # goto \&{ __PACKAGE__ . '::damn' };
+ # having set the @_ array appropriately, but this caused a
+ # "Attempt to free unrefernced SV" error that I couldn't solve
+ # - I think it was to do with the @_ array
+ };
+ }
+
+ # add the known symbols to @_
+ splice @_ , 0; push @_ , $class;
+
+ # run the "proper" import() routine
+ goto \&Exporter::import;
+} # import()
+
+
+bootstrap Acme::Damn $VERSION;
+
+1;
+__END__
+=pod
+
+=head1 NAME
+
+Acme::Damn - 'Unbless' Perl objects.
+
+
+=head1 SYNOPSIS
+
+ use Acme::Damn;
+
+ my $ref = ... some reference ...
+ my $obj = bless $ref , 'Some::Class';
+
+ ... do something with your object ...
+
+ $ref = damn $obj; # recover the original reference (unblessed)
+
+ ... neither $ref nor $obj are Some::Class objects ...
+
+
+=head1 DESCRIPTION
+
+B<Acme::Damn> provides a single routine, B<damn()>, which takes a blessed
+reference (a Perl object), and I<unblesses> it, to return the original
+reference. I can't think of any reason why you might want to do this, but
+just because it's of no use doesn't mean that you shouldn't be able to do
+it.
+
+
+=head2 EXPORT
+
+By default, B<Acme::Damn> exports the method B<damn()> into the current
+namespace. Aliases for B<damn()> (see below) may be imported upon request.
+
+=head2 Methods
+
+=over 4
+
+=item B<damn> I<object>
+
+B<damn()> accepts a single blessed reference as its argument, and returns
+that reference unblessed. If I<object> is not a blessed reference, then
+B<damn()> will C<die> with an error.
+
+=back
+
+
+=head2 Method Aliases
+
+Not everyone likes to damn the same way or in the same language, so
+B<Acme::Damn> offers the ability to specify any alias on import, provided
+that alias is a valid Perl subroutine name (i.e. all characters match C<\w>).
+
+ use Acme::Damn qw( unbless );
+ use Acme::Damn qw( foo );
+ use Acme::Damn qw( unblessthyself );
+ use Acme::Damn qw( recant );
+
+Version 0.02 supported a defined list of aliases, and this has been replaced
+in v0.03 by the ability to import any alias for C<damn()>.
+
+
+=head1 WARNING
+
+Just as C<bless> doesn't call an object's initialisation code, C<damn> doesn't
+invoke an object's C<DESTROY> method. For objects that need to be C<DESTROY>ed,
+either don't C<damn> them, or call C<DESTROY> before judgement is passed.
+
+
+=head1 ACKNOWLEDGEMENTS
+
+Thanks to Claes Jacobsson E<lt>claes at surfar.nuE<gt> for suggesting the use of
+aliases.
+
+
+=head1 SEE ALSO
+
+L<bless|perlfunc/bless>, L<perlboot>, L<perltoot>, L<perltooc>, L<perlbot>,
+L<perlobj>.
+
+
+=head1 AUTHOR
+
+Ian Brayshaw, E<lt>ian at onemore.orgE<gt>
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2003-2006 Ian Brayshaw
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Added: branches/upstream/libacme-damn-perl/current/Damn.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/Damn.xs?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/Damn.xs (added)
+++ branches/upstream/libacme-damn-perl/current/Damn.xs Wed Apr 8 20:47:20 2009
@@ -1,0 +1,87 @@
+/* $Id: Damn.xs,v 1.10 2006-02-05 00:03:42 ian Exp $ */
+
+/*
+** Damn.xs
+**
+** Define the damn() method of Acme::Damn.
+**
+** Author: I. Brayshaw <ian at onemore.org>
+** Revision: $Revision: 1.10 $
+** Last modified: $Date: 2006-02-05 00:03:42 $
+*/
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* for Perl > 5.6, additional magic must be handled */
+#if ( PERL_REVISION == 5 ) && ( PERL_VERSION > 6 )
+/* if there's magic set - Perl extension magic - then unset it */
+# define SvUNMAGIC( sv ) if ( SvSMAGICAL( sv ) ) \
+ if ( mg_find( sv , PERL_MAGIC_ext ) \
+ || mg_find( sv , PERL_MAGIC_uvar ) ) \
+ mg_clear( sv )
+
+#else
+
+/* for Perl <= 5.6 this becomes a no-op */
+# define SvUNMAGIC( sv )
+
+#endif
+
+
+MODULE = Acme::Damn PACKAGE = Acme::Damn
+
+PROTOTYPES: ENABLE
+
+SV *
+damn( rv , ... )
+ SV * rv;
+
+ PROTOTYPE: $;$$$
+
+ PREINIT:
+ SV * sv;
+
+ CODE:
+ /* if we don't have a blessed reference, then raise an error */
+ if ( ! sv_isobject( rv ) ) {
+ /*
+ ** if we have more than one parameter, then pull the name from
+ ** the stack ... otherwise, use the method[] array
+ */
+ if ( items > 1 ) {
+ char *name = (char *)SvPV_nolen( ST(1) );
+ char *file = (char *)SvPV_nolen( ST(2) );
+ int line = (int)SvIV( ST(3) );
+
+ croak( "Expected blessed reference; can only %s the programmer "
+ "now at %s line %d.\n" , name , file , line );
+ } else {
+ croak( "Expected blessed reference; can only damn the programmer now" );
+ }
+ }
+
+ /* need to dereference the RV to get the SV */
+ sv = SvRV( rv );
+
+ /*
+ ** if this is read-only, then we should do the right thing and slap
+ ** the programmer's wrist; who know's what might happen otherwise
+ */
+ if ( SvREADONLY( sv ) )
+ croak( PL_no_modify );
+
+ SvREFCNT_dec( SvSTASH( sv ) ); /* remove the reference to the stash */
+ SvSTASH( sv ) = NULL;
+ SvOBJECT_off( sv ); /* unset the object flag */
+ if ( SvTYPE( sv ) != SVt_PVIO ) /* if we don't have an IO stream, we */
+ PL_sv_objcount--; /* should decrement the object count */
+
+ /* we need to clear the magic flag on the given RV */
+ SvAMAGIC_off( rv );
+ /* as of Perl 5.8.0 we need to clear more magic */
+ SvUNMAGIC( sv );
+
+ OUTPUT:
+ rv
Added: branches/upstream/libacme-damn-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/MANIFEST?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/MANIFEST (added)
+++ branches/upstream/libacme-damn-perl/current/MANIFEST Wed Apr 8 20:47:20 2009
@@ -1,0 +1,12 @@
+Changes
+Damn.pm
+Damn.xs
+Makefile.PL
+MANIFEST
+README
+t/1compile.t
+t/2damn.t
+t/3aliases.t
+t/4name.t
+t/5bad.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libacme-damn-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/META.yml?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/META.yml (added)
+++ branches/upstream/libacme-damn-perl/current/META.yml Wed Apr 8 20:47:20 2009
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Acme-Damn
+version: 0.03
+version_from: Damn.pm
+installdirs: site
+requires:
+ Test::Exception: 0
+ Test::More: 0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: branches/upstream/libacme-damn-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/Makefile.PL?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/Makefile.PL (added)
+++ branches/upstream/libacme-damn-perl/current/Makefile.PL Wed Apr 8 20:47:20 2009
@@ -1,0 +1,22 @@
+# $Id: Makefile.PL,v 1.3 2003-06-08 13:20:59 ian Exp $
+
+# Makefile.PL for Acme::Damn
+#
+# Author: I. Brayshaw <ian>onemore.org>
+# Revision: $Revision: 1.3 $
+# Last modified: $Date: 2003-06-08 13:20:59 $
+
+use 5.000;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ 'NAME' => 'Acme::Damn' ,
+ 'VERSION_FROM' => 'Damn.pm' ,
+ 'PREREQ_PM' => { 'Test::More' => 0 ,
+ 'Test::Exception' => 0 } ,
+ ($] >= 5.005 ?
+ ( AUTHOR => 'Ian Brayshaw <ian at onemore.org>') : ()) ,
+ 'LIBS' => [''] ,
+ 'DEFINE' => '' ,
+ 'INC' => '-I.'
+);
Added: branches/upstream/libacme-damn-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/README?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/README (added)
+++ branches/upstream/libacme-damn-perl/current/README Wed Apr 8 20:47:20 2009
@@ -1,0 +1,83 @@
+$Id: README,v 1.6 2006-02-05 00:11:42 ian Exp $
+
+NAME
+ Acme::Damn - 'Unbless' Perl objects.
+
+SYNOPSIS
+ use Acme::Damn;
+
+ my $ref = ... some reference ...
+ my $obj = bless $ref , 'Some::Class';
+
+ ... do something with your object ...
+
+ $ref = damn $obj; # recover the original reference (unblessed)
+
+ ... neither $ref nor $obj are Some::Class objects ...
+
+INSTALLATION
+
+ To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+ Acme::Damn uses XS to access the internals of Perl for it's magic, and
+ therefore must be compiled to be installed. Also, for testing,
+ Acme::Damn relies on Test::More and Test::Exception.
+
+DESCRIPTION
+ Acme::Damn provides a single routine, damn(), which takes a blessed
+ reference (a Perl object), and *unblesses* it, to return the original
+ reference. I can't think of any reason why you might want to do this,
+ but just because it's of no use doesn't mean that you shouldn't be able
+ to do it.
+
+ EXPORT
+ By default, Acme::Damn exports the method damn() into the current
+ namespace. Aliases for damn() (see below) may be imported upon request.
+
+ Methods
+ damn *object*
+ damn() accepts a single blessed reference as its argument, and
+ returns that reference unblessed. If *object* is not a blessed
+ reference, then damn() will "die" with an error.
+
+ Method Aliases
+ Not everyone likes to damn the same way or in the same language, so
+ Acme::Damn offers the ability to specify any alias on import, provided
+ that alias is a valid Perl subroutine name (i.e. all characters match
+ "\w").
+
+ use Acme::Damn qw( unbless );
+ use Acme::Damn qw( foo );
+ use Acme::Damn qw( unblessthyself );
+ use Acme::Damn qw( recant );
+
+ Version 0.02 supported a defined list of aliases, and this has been
+ replaced in v0.03 by the ability to import any alias for "damn()".
+
+WARNING
+ Just as "bless" doesn't call an object's initialisation code, "damn"
+ doesn't invoke an object's "DESTROY" method. For objects that need to be
+ "DESTROY"ed, either don't "damn" them, or call "DESTROY" before
+ judgement is passed.
+
+ACKNOWLEDGEMENTS
+ Thanks to Claes Jacobsson <claes at surfar.nu> for suggesting the use of
+ aliases.
+
+SEE ALSO
+ bless, perlboot, perltoot, perltooc, perlbot, perlobj.
+
+AUTHOR
+ Ian Brayshaw, <ian at onemore.org>
+
+COPYRIGHT AND LICENSE
+ Copyright 2003-2006 Ian Brayshaw
+
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
Added: branches/upstream/libacme-damn-perl/current/t/1compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/t/1compile.t?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/t/1compile.t (added)
+++ branches/upstream/libacme-damn-perl/current/t/1compile.t Wed Apr 8 20:47:20 2009
@@ -1,0 +1,19 @@
+#!/usr/bin/perl -w
+# $Id: 1compile.t,v 1.1 2003-06-08 13:20:13 ian Exp $
+
+# compile.t
+#
+# Ensure the module compiles.
+
+use strict;
+use Test::More tests => 2;
+
+# make sure the module compiles
+BEGIN { use_ok( 'Acme::Damn' ) }
+
+# make sure damn() is in the current namespace
+{
+ no strict 'refs';
+
+ ok( ref( *{ 'main::damn' }{ CODE } ) eq 'CODE' , "Yep" );
+}
Added: branches/upstream/libacme-damn-perl/current/t/2damn.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/t/2damn.t?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/t/2damn.t (added)
+++ branches/upstream/libacme-damn-perl/current/t/2damn.t Wed Apr 8 20:47:20 2009
@@ -1,0 +1,82 @@
+#!/usr/bin/perl -w
+# $Id: 2damn.t,v 1.1 2003-06-08 13:20:14 ian Exp $
+
+# damn.t
+#
+# Ensure damn "does the right thing"
+
+use strict;
+use Test::More tests => 26;
+use Test::Exception;
+
+# load Acme::Damn
+use Acme::Damn;
+
+#
+# make sure damn dies if not given a blessed reference
+#
+
+# define some argument types for damn
+my @array = ();
+my %hash = ();
+my $scalar = 0;
+
+dies_ok { eval "damn" or die } "damn() dies with no arguments";
+dies_ok { eval "damn()" or die } "damn() dies with no arguments";
+dies_ok { damn 1 } "damn() dies with numerical argument";
+dies_ok { damn '2' } "damn() dies with string argument";
+dies_ok { damn *STDOUT } "damn() dies with glob argument";
+dies_ok { damn \1 } "damn() dies with scalar reference argument";
+dies_ok { damn [] } "damn() dies with array reference argument";
+dies_ok { damn {} } "damn() dies with hash reference argument";
+dies_ok { damn sub {} } "damn() dies with code reference argument";
+dies_ok { damn @array } "damn() dies with array argument";
+dies_ok { damn %hash } "damn() dies with hash argument";
+dies_ok { damn $scalar } "damn() dies with scalar argument";
+dies_ok { damn undef } "damn() dies with undefined argument";
+dies_ok { damn \*STDOUT } "damn() dies with glob reference argument";
+
+#
+# make sure damn lives when passed an object
+#
+
+# define blessed references for testing
+my $number = 1; $number = bless \$number;
+my $string = '2'; $string = bless \$string;
+ @array = (); my $array = bless \@array;
+ %hash = (); my $hash = bless \%hash;
+my $code = sub {}; $code = bless $code;
+my $glob = \*STDOUT; $glob = bless $glob;
+
+lives_ok { damn $number } "damn() lives with numerical object argument";
+lives_ok { damn $string } "damn() lives with string object argument" ;
+lives_ok { damn $array } "damn() lives with array object argument" ;
+lives_ok { damn $hash } "damn() lives with hash object argument" ;
+lives_ok { damn $code } "damn() lives with code object argument" ;
+lives_ok { damn $glob } "damn() lives with glob object argument" ;
+
+#
+# make sure damn unblesses the objects
+#
+
+# define a routine for performing the comparison
+my $cmp = sub {
+ my $ref = shift;
+ my $string = "$ref";
+ damn bless $ref;
+
+ # make sure the stringification is the same
+ return $string eq "$ref";
+ }; # $cmp()
+
+ $number = 1;
+ $string = '2';
+ $code = sub {};
+ $glob = \*STDOUT;
+
+ok( $cmp->( \$number ) , "damned numerical references" );
+ok( $cmp->( \$string ) , "damned string references" );
+ok( $cmp->( \@array ) , "damned array references" );
+ok( $cmp->( \%hash ) , "damned hash references" );
+ok( $cmp->( $code ) , "damned code references" );
+ok( $cmp->( $glob ) , "damned glob references" );
Added: branches/upstream/libacme-damn-perl/current/t/3aliases.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/t/3aliases.t?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/t/3aliases.t (added)
+++ branches/upstream/libacme-damn-perl/current/t/3aliases.t Wed Apr 8 20:47:20 2009
@@ -1,0 +1,38 @@
+#!/usr/bin/perl -w
+# $Id: 3aliases.t,v 1.3 2006-02-05 00:04:59 ian Exp $
+
+# aliase.t
+#
+# Ensure the damn aliases damn-well work ;)
+
+use strict;
+use Test::More tests => 33;
+use Test::Exception;
+
+# load Acme::Damn and the aliases (as defined in v0.02)
+my @aliases;
+BEGIN { @aliases = qw( abjure anathematize condemn curse damn excommunicate
+ expel proscribe recant renounce unbless ); }
+
+# load Acme::Damn
+use Acme::Damn @aliases;
+
+foreach my $alias ( @aliases ) {
+ no strict 'refs';
+
+ # create a reference, and strify it
+ my $ref = [];
+ my $string = "$ref";
+
+ # bless the reference and the "unbless" it
+ bless $ref;
+ lives_ok { $alias->( $ref ) } "$alias executes successfully";
+
+ # make sure the stringification is correct
+ ok( $ref eq $string , "$alias executes correctly" );
+
+ # make sure the error message correctly reports the alias
+ throws_ok { $alias->( $ref ) }
+ "/can only $alias/" ,
+ "$alias exception thrown successfully";
+}
Added: branches/upstream/libacme-damn-perl/current/t/4name.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/t/4name.t?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/t/4name.t (added)
+++ branches/upstream/libacme-damn-perl/current/t/4name.t Wed Apr 8 20:47:20 2009
@@ -1,0 +1,27 @@
+#!/usr/bin/perl -w
+# $Id: 4name.t,v 1.2 2003-06-10 18:08:34 ian Exp $
+
+# name.t
+#
+# Ensure the damn reports the correct alias name in error messages.
+
+use strict;
+use Test::More tests => 11;
+use Test::Exception;
+
+# load Acme::Damn and the aliases
+my @aliases;
+BEGIN { @aliases = qw( abjure anathematize condemn curse damn excommunicate
+ expel proscribe recant renounce unbless ); }
+
+# load Acme::Damn
+use Acme::Damn @aliases;
+
+foreach my $alias ( @aliases ) {
+ no strict 'refs';
+
+ # attempt to unbless a normal reference so that we can test the error
+ # messages
+ throws_ok { $alias->( [] ) } "/can only $alias/" ,
+ "$alias exception thrown successfully";
+}
Added: branches/upstream/libacme-damn-perl/current/t/5bad.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libacme-damn-perl/current/t/5bad.t?rev=32807&op=file
==============================================================================
--- branches/upstream/libacme-damn-perl/current/t/5bad.t (added)
+++ branches/upstream/libacme-damn-perl/current/t/5bad.t Wed Apr 8 20:47:20 2009
@@ -1,0 +1,21 @@
+#!/usr/bin/perl -w
+# $Id: 5bad.t,v 1.2 2006-02-05 00:06:42 ian Exp $
+
+# bad.t
+#
+# Ensure Acme::Damn dies when an invalid alias name is given for import.
+
+use strict;
+use Test::More tests => 3;
+use Test::Exception;
+
+# load Acme::Damn
+use Acme::Damn;
+
+# make sure Acme::Damn::import() dies if the unknown symbol has "bad"
+# characters in it (i.e. non-word characters, such as ':')
+foreach my $name ( qw( foo::bar foo-bar foo.bar ) ) {
+ throws_ok { Acme::Damn->import( $name ) }
+ "/Bad choice of symbol/" ,
+ "$name exception thrown successfully";
+}
More information about the Pkg-perl-cvs-commits
mailing list