r53800 - in /branches/upstream/libuniversal-exports-perl: ./ current/ current/lib/ current/lib/UNIVERSAL/ current/t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Mar 7 01:39:43 UTC 2010
Author: jawnsy-guest
Date: Sun Mar 7 01:39:32 2010
New Revision: 53800
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53800
Log:
[svn-inject] Installing original source of libuniversal-exports-perl
Added:
branches/upstream/libuniversal-exports-perl/
branches/upstream/libuniversal-exports-perl/current/
branches/upstream/libuniversal-exports-perl/current/Changes
branches/upstream/libuniversal-exports-perl/current/MANIFEST
branches/upstream/libuniversal-exports-perl/current/META.yml
branches/upstream/libuniversal-exports-perl/current/Makefile.PL
branches/upstream/libuniversal-exports-perl/current/lib/
branches/upstream/libuniversal-exports-perl/current/lib/UNIVERSAL/
branches/upstream/libuniversal-exports-perl/current/lib/UNIVERSAL/exports.pm
branches/upstream/libuniversal-exports-perl/current/t/
branches/upstream/libuniversal-exports-perl/current/t/Dummy.pm
branches/upstream/libuniversal-exports-perl/current/t/exports.t
Added: branches/upstream/libuniversal-exports-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/Changes?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/Changes (added)
+++ branches/upstream/libuniversal-exports-perl/current/Changes Sun Mar 7 01:39:32 2010
@@ -1,0 +1,20 @@
+0.05 Sun Sep 3 17:52:06 EDT 2006
+ - Convert tests from ancient ad-hoc to Test::More.
+ - Turn on strictyness.
+
+0.04 Sun Sep 3 17:31:46 EDT 2006
+ - Removed UNIVERSAL::require from distribution. It is now in its own
+ distribution.
+ - Added copyright and license info
+ - Added link to rt.cpan.org for tracking.
+ - Added extended SEE ALSO to other Exporter-like things.
+
+0.03 Sun Dec 16 21:51:58 EST 2001
+ - Moved UNIVERSAL::exports import functionality to Exporter::Lite
+ - Fixed a little nit when "use UNIVERSAL" is involved.
+
+0.02 Mon Jun 25 15:00:19 EDT 2001
+ * -->API CHANGE!<-- require() no longer dies on failure
+
+0.01 Mon Jan 22 11:06:50 EST 2001
+ * First version, adapted from the Perl 6 RFC prototypes 253 and 257.
Added: branches/upstream/libuniversal-exports-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/MANIFEST?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/MANIFEST (added)
+++ branches/upstream/libuniversal-exports-perl/current/MANIFEST Sun Mar 7 01:39:32 2010
@@ -1,0 +1,7 @@
+Changes
+lib/UNIVERSAL/exports.pm
+Makefile.PL
+MANIFEST This list of files
+t/Dummy.pm
+t/exports.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libuniversal-exports-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/META.yml?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/META.yml (added)
+++ branches/upstream/libuniversal-exports-perl/current/META.yml Sun Mar 7 01:39:32 2010
@@ -1,0 +1,14 @@
+--- #YAML:1.0
+name: UNIVERSAL-exports
+version: 0.05
+abstract: ~
+license: unknown
+generated_by: ExtUtils::MakeMaker version 6.30_03
+author: ~
+distribution_type: module
+requires:
+ Exporter::Lite: 0.01
+ Test::More: 0.47
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-new.html
+ version: 1.1
Added: branches/upstream/libuniversal-exports-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/Makefile.PL?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/Makefile.PL (added)
+++ branches/upstream/libuniversal-exports-perl/current/Makefile.PL Sun Mar 7 01:39:32 2010
@@ -1,0 +1,62 @@
+# A template for Makefile.PL.
+# - 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 ExtUtils::MakeMaker;
+
+$PACKAGE = 'UNIVERSAL::exports';
+($PACKAGE_FILE = $PACKAGE) =~ s|::|/|g;
+$LAST_API_CHANGE = 0.02;
+
+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
+ PREREQ_PM => { Exporter::Lite => 0.01,
+ Test::More => 0.47,
+ },
+ 'dist' => { COMPRESS => 'gzip -9',
+ SUFFIX => '.gz',
+ DIST_DEFAULT => 'all tardist',
+ },
+);
+
+
+{
+ package MY;
+
+ sub test_via_harness {
+ my($self, $orig_perl, $tests) = @_;
+
+ my @perls = ($orig_perl);
+ push @perls, qw(bleadperl
+ perl5.6.1
+ perl5.6.0
+ perl5.005_03
+ perl5.004_05
+ perl5.004_04
+ perl5.004)
+ if $ENV{PERL_TEST_ALL};
+
+ my $out;
+ foreach my $perl (@perls) {
+ $out .= $self->SUPER::test_via_harness($perl, $tests);
+ }
+
+ return $out;
+ }
+}
Added: branches/upstream/libuniversal-exports-perl/current/lib/UNIVERSAL/exports.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/lib/UNIVERSAL/exports.pm?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/lib/UNIVERSAL/exports.pm (added)
+++ branches/upstream/libuniversal-exports-perl/current/lib/UNIVERSAL/exports.pm Sun Mar 7 01:39:32 2010
@@ -1,0 +1,134 @@
+package UNIVERSAL::exports;
+$UNIVERSAL::exports::VERSION = '0.05';
+
+
+package UNIVERSAL;
+
+use strict;
+use Exporter::Lite qw(import);
+
+=head1 NAME
+
+UNIVERSAL::exports - Lightweight, universal exporting of variables
+
+=head1 SYNOPSIS
+
+ package Foo;
+ use UNIVERSAL::exports;
+
+ # Just like Exporter.
+ @EXPORT = qw($This &That);
+ @EXPORT_OK = qw(@Left %Right);
+
+
+ # Meanwhile, in another piece of code!
+ package Bar;
+ use Foo; # exports $This and &That.
+
+
+=head1 DESCRIPTION
+
+This is an alternative to Exporter intended to provide a universal,
+lightweight subset of its functionality. It uses Exporter::Lite, so
+look there for details.
+
+Additionally, C<exports()> is provided to find out what symbols a
+module exports.
+
+UNIVERSAL::exports places its methods in the UNIVERSAL namespace, so
+there is no need to subclass from it.
+
+
+=head1 Methods
+
+UNIVERSAL::exports has two public methods, import() derived from
+Exporter::Lite, and exports().
+
+=over 4
+
+=item B<import>
+
+ Some::Module->import;
+ Some::Module->import(@symbols);
+
+This is Exporter::Lite's import() method. Look in L<Exporter::Lite>
+for details.
+
+=item B<exports>
+
+ @exported_symbols = Some::Module->exports;
+ Some::Module->exports($symbol);
+
+Reports what symbols are exported by Some::Module. With no arguments,
+it simply returns a list of all exportable symbols. Otherwise, it
+reports if it will export a given $symbol.
+
+=cut
+
+
+sub exports {
+ my($exporter) = shift;
+
+ my %exports;
+
+ {
+ no strict 'refs';
+ %exports = map { $_ => 1 } @{$exporter.'::EXPORT'},
+ @{$exporter.'::EXPORT_OK'};
+ }
+
+ if( @_ ) {
+ return exists $exports{$_[0]};
+ }
+ else {
+ return keys %exports;
+ }
+}
+
+
+=back
+
+=head1 DIAGNOSTICS
+
+=over 4
+
+=item '"%s" is not exported by the %s module'
+
+Attempted to import a symbol which is not in @EXPORT or @EXPORT_OK.
+
+=item 'Can\'t export symbol: %s'
+
+Attempted to import a symbol of an unknown type (ie. the leading $@% salad
+wasn't recognized).
+
+=back
+
+=head1 AUTHORS
+
+Michael G Schwern <schwern at pobox.com>
+
+=head1 BUGS and ISSUES
+
+Please report bugs and issues via L<http://rt.cpan.org>
+
+=head1 LICENSE and COPYRIGHT
+
+Copyright 2001, 2006 Michael G Schwern
+
+This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=head1 SEE ALSO
+
+Other ways to Export: L<Exporter>, L<Exporter::Lite>,
+L<Sub::Exporter>, L<Exporter::Simple>
+
+The Perl 6 RFC that started it all: L<http://dev.perl.org/rfc/257.pod>
+
+More UNIVERSAL magic: L<UNIVERSAL::require>
+
+=cut
+
+
+007;
Added: branches/upstream/libuniversal-exports-perl/current/t/Dummy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/t/Dummy.pm?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/t/Dummy.pm (added)
+++ branches/upstream/libuniversal-exports-perl/current/t/Dummy.pm Sun Mar 7 01:39:32 2010
@@ -1,0 +1,13 @@
+package Dummy;
+
+ at EXPORT = qw(foo);
+ at EXPORT_OK = qw(bar);
+$VERSION = 0.5;
+
+sub foo { 42 }
+
+sub bar { 23 }
+
+sub car { "yarblockos" }
+
+return 23;
Added: branches/upstream/libuniversal-exports-perl/current/t/exports.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-exports-perl/current/t/exports.t?rev=53800&op=file
==============================================================================
--- branches/upstream/libuniversal-exports-perl/current/t/exports.t (added)
+++ branches/upstream/libuniversal-exports-perl/current/t/exports.t Sun Mar 7 01:39:32 2010
@@ -1,0 +1,60 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Test::More tests => 16;
+
+BEGIN { use_ok 'UNIVERSAL::exports' }
+
+use lib qw(t);
+
+package Test1;
+use Dummy;
+
+::ok( defined &foo );
+::is( foo, 42 );
+
+package YATest1;
+use Dummy qw(foo);
+
+::ok( defined &foo );
+::is( foo, 42 );
+
+
+package Test2;
+
+use Dummy ();
+
+::ok( !defined &foo );
+
+
+package Test3;
+
+eval { Dummy->import('car') };
+::like( $@, '/"car" is not exported by the Dummy module/' );
+
+
+package Test4;
+
+use Dummy qw(bar);
+
+::ok( defined &bar and !defined &foo );
+::is( bar, 23 );
+
+
+# Test UNIVERSAL::exports()
+::is_deeply( [sort Dummy->exports], [sort qw(foo bar)] );
+::ok( Dummy->exports('foo') );
+::ok( Dummy->exports('bar') );
+::ok( !Dummy->exports('car') );
+::ok( !Dummy->exports(007) );
+
+
+package Test5;
+
+use Dummy 0.5;
+::pass; # if we don't explode, we're ok.
+
+
+eval "use Dummy 99";
+::like($@, '/Dummy version 99 required--this is only version/');
More information about the Pkg-perl-cvs-commits
mailing list