CLASS-1.00/0000755000076500007650000000000010512572230012212 5ustar schwernschwernCLASS-1.00/Changes0000644000076500007650000000141610512571716013517 0ustar schwernschwern1.00 Mon Oct 9 18:10:58 PDT 2006 - Add a LICENSE notice - This is 1.00, why not - Remove the really, really old Test::More bundled with this and just depend on it instead. 0.91 Tue May 20 01:23:08 PDT 2003 - CLASS is now a real constant (thanks Juerd) 0.90 Fri Nov 29 14:26:09 PST 2002 * Colm figured out a way to add $CLASS * Cut out using any other modules so load time is now negligible. - This pretty much makes the module Feature Complete so jacking up to 0.90 as a beta release. 0.03 Tue Aug 28 01:32:07 EDT 2001 - Eliminated nearly ALL the code! - Explicitly tested all the way back to 5.004 0.02 Fri Aug 24 23:34:51 EDT 2001 * Added CLASS keyword 0.01 Thu Jun 28 13:14:31 EDT 2001 - First working version. CLASS-1.00/lib/0000755000076500007650000000000010512572216012764 5ustar schwernschwernCLASS-1.00/lib/CLASS.pm0000644000076500007650000000270010512571716014172 0ustar schwernschwernpackage CLASS; use 5.004; $VERSION = '1.00'; BEGIN { # Faster than 'use constant'. Load time critical. # Must eval to make $] constant. *PERL_VERSION = eval qq{ sub () { $] } }; } sub import { my $caller = caller; *{$caller.'::CLASS'} = \$caller; # This logic is compiled out. if( PERL_VERSION >= 5.008 ) { # 5.8.x smart enough to make this a constant. *{$caller.'::CLASS'} = sub () { $caller }; } else { # Make CLASS a constant. *{$caller.'::CLASS'} = eval qq{ sub () { q{$caller} } }; } } =head1 NAME CLASS - Alias for __PACKAGE__ =head1 SYNOPSIS package Foo; use CLASS; print CLASS; # Foo print "My class is $CLASS\n"; # My class is Foo sub bar { 23 } print CLASS->bar; # 23 print $CLASS->bar; # 23 =head1 DESCRIPTION CLASS and $CLASS are both synonyms for __PACKAGE__. Easier to type. $CLASS has the additional benefit of working in strings. =head1 NOTES CLASS is a constant, not a subroutine call. $CLASS is a plain variable, it is not tied. There is no performance loss for using CLASS over __PACKAGE__ except the loading of the module. (Thanks Juerd) =head1 AUTHOR Michael G Schwern =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L =head1 SEE ALSO L =cut 1; CLASS-1.00/Makefile.PL0000644000076500007650000000207110512572160014166 0ustar schwernschwern# A template for Makefile.PL used by Arena Networks. # - Set the $PACKAGE variable to the name of your module. # - Set $LAST_API_CHANGE to reflect the last version you changed the API # of your module. # - Fill in your dependencies in PREREQ_PM # Alternatively, you can say the hell with this and use h2xs. use 5.004; use ExtUtils::MakeMaker; $PACKAGE = 'CLASS'; ($PACKAGE_FILE = $PACKAGE) =~ s|::|/|g; $LAST_API_CHANGE = 0; eval "require $PACKAGE"; unless ($@) { # Make sure we did find the module. print <<"CHANGE_WARN" if ${$PACKAGE.'::VERSION'} < $LAST_API_CHANGE; NOTE: There have been API changes between this version and any older than version $LAST_API_CHANGE! Please read the Changes file if you are upgrading from a version older than $LAST_API_CHANGE. CHANGE_WARN } WriteMakefile( NAME => $PACKAGE, VERSION_FROM => "lib/$PACKAGE_FILE.pm", # finds $VERSION ABSTRACT_FROM => "lib/$PACKAGE_FILE.pm", PREREQ_PM => { Test::More => 0.07 }, $ExtUtils::MakeMaker::VERSION >= 6.31 ? (LICENSE => 'perl') : () ); CLASS-1.00/MANIFEST0000644000076500007650000000032610512572216013350 0ustar schwernschwernChanges MANIFEST Makefile.PL lib/CLASS.pm t/CLASS.t META.yml Module meta-data (added by MakeMaker) SIGNATURE Public-key signature (added by MakeMaker) CLASS-1.00/META.yml0000664000076500007650000000056210512572216013474 0ustar schwernschwern--- #YAML:1.0 name: CLASS version: 1.00 abstract: Alias for __PACKAGE__ license: perl generated_by: ExtUtils::MakeMaker version 6.31 distribution_type: module requires: Test::More: 0.07 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 CLASS-1.00/SIGNATURE0000664000076500007650000000204110512572230013475 0ustar schwernschwernThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.55. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 b8ba9c799722a08c6cef0155fc4c3a965fcc0867 Changes SHA1 c51815d9a4fe047a704263c2620d661e5ecc436a MANIFEST SHA1 6c38201dffc8cd299ffea8f8593399cd2d1ff525 META.yml SHA1 87babfcf4e52547d81a18cd633fbaa94ed585a95 Makefile.PL SHA1 21da58e9d12fab889ca5ea316fb6afb6da8bef47 lib/CLASS.pm SHA1 dcc1fb792f2a3838362583d9d70e019d35b1aa01 t/CLASS.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFFKvSYWMohlhD1QycRAj9XAJ9fxEF29ZrRO6GH/wposuId3Y9p4ACbBNaU DYb1cIxTMzkZikqbjha4CNY= =YsdZ -----END PGP SIGNATURE----- CLASS-1.00/t/0000755000076500007650000000000010512572216012461 5ustar schwernschwernCLASS-1.00/t/CLASS.t0000644000076500007650000000436710512571716013531 0ustar schwernschwern#!/usr/bin/perl -w use 5.004; use Test::More tests => 22; BEGIN { use_ok('CLASS'); } package Foo; use CLASS; ::is( CLASS, __PACKAGE__, 'CLASS is right' ); ::is( $CLASS, __PACKAGE__, '$CLASS is right' ); sub bar { 23 } sub check_caller { caller } ::is( CLASS->bar, 23, 'CLASS->meth' ); ::is( $CLASS->bar, 23, '$CLASS->meth' ); #line 42 eval { CLASS->i_dont_exist }; my $CLASS_death = $@; #line 42 eval { $CLASS->i_dont_exist }; my $CLASS_scalar_death = $@; #line 42 eval { __PACKAGE__->i_dont_exist }; my $Foo_death = $@; ::is( $CLASS_death, $Foo_death, '__PACKAGE__ and CLASS die the same' ); ::is( $CLASS_scalar_death, $Foo_death, '__PACKAGE__ and $CLASS die the same' ); #line 29 my $CLASS_caller = CLASS->check_caller; my $CLASS_scalar_caller = $CLASS->check_caller; my $Foo_caller = __PACKAGE__->check_caller; ::is($CLASS_caller, $Foo_caller, 'caller preserved' ); ::is($CLASS_scalar_caller, $Foo_caller, 'caller preserved' ); sub foo { return join ':', @_ } ::is( CLASS->foo, 'Foo', 'Right CLASS to class method call' ); ::is( $CLASS->foo, 'Foo', 'Right $CLASS to class method call' ); ::is( CLASS->foo('bar'), 'Foo:bar', 'CLASS: Arguments preserved' ); ::is( $CLASS->foo('bar'), 'Foo:bar', '$CLASS: Arguments preserved' ); { package Bar; use CLASS; sub Yarrow::Func { my($passed_class, $passed_class_scalar) = @_; ::is( CLASS, __PACKAGE__, 'CLASS works in tricky subroutine' ); ::is( $CLASS, __PACKAGE__, '$CLASS works in tricky subroutine' ); ::is( $passed_class, 'Foo', 'CLASS as sub argument' ); ::is( $passed_class_scalar, 'Foo', '$CLASS as sub argument' ); ::is( $_[0], 'Foo', 'CLASS in @_' ); ::is( $_[1], 'Foo', '$CLASS in @_' ); } } Yarrow::Func(CLASS, $CLASS); # Make sure AUTOLOAD is preserved. package Bar; sub AUTOLOAD { return "Autoloader" } ::is( CLASS->i_dont_exist, 'Autoloader', 'CLASS: AUTOLOAD preserved' ); ::is( $CLASS->i_dont_exist, 'Autoloader', '$CLASS: AUTOLOAD preserved' ); package main; eval q{ CLASS(42); }; like( $@, '/^Too many arguments for main::CLASS/', 'CLASS properly prototyped' );