Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the autobox-Core CPAN distribution.

Report information
The Basics
Id: 36190
Status: resolved
Priority: 0/
Queue: autobox-Core

People
Owner: Nobody in particular
Requestors: CHOCOLATE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in:
  • 0.1
  • 0.2
  • 0.3
  • 0.4
  • 0.5
Fixed in: (no value)



Subject: remove requirement to "use autobox"
Hi, Scott. I've attached a patch which removes the need for code that uses autobox::Core to also "use autobox". The patch also adds a note that autobox autoboxes @array and %hash invocants as of 2.40. Cheers, chocolateboy.
Subject: autobox-Core-0.5.patch
--- Core.pm 2008-05-23 21:38:41.000000000 +0100 +++ Core.pm 2008-05-26 16:20:22.000000000 +0100 @@ -21,6 +21,19 @@ our $VERSION = '0.5'; +use base qw(autobox); + +# appending the user-supplied arguments allows autobox::Core options to be overridden +# or extended in the same statement e.g. +# +# use autobox::Core UNDEF => 'MyUndef'; # also autobox undef +# use autobox::Core CODE => undef; # don't autobox CODE refs +# use autobox::Core UNIVERSAL => 'Data::Dumper'; # enable a Dumper() method for all types + +sub import { + shift->SUPER::import(DEFAULT => 'autobox::Core::', @_); +} + =pod =head1 NAME @@ -29,7 +42,6 @@ =head1 SYNOPSIS - use autobox; use autobox::Core; "Hello, World\n"->uc()->print(); @@ -111,7 +123,6 @@ Under L<Perl6::Contexts>, you'll often need to write code equivalent to the follow: use Perl6::Contexts; - use autobox; use autobox::Core; my @arr = ( 1 .. 10 ); @@ -349,7 +360,6 @@ This section deals with the last two of these equivalents. These are method calls - use autobox; use autobox::Core; use Perl6::Contexts; @@ -366,7 +376,8 @@ Providing no other arguments to the method calls, however, is not common. F<Perl6::Contexts> recognizes object context as provided by C<< -> >> and -coerces C<%hash> into a reference, suitable for use with F<autobox>. +coerces C<%hash> and C<@array> into references, suitable for use with F<autobox>. +(Note that F<autobox> also does this automatically as of version 2.40.) F<autobox> associates primitive types, such as references of various sorts, with classes. F<autobox::Core> throws into those classes methods wrapping Perl's built-in functions. In the interest of full disclosure, F<Perl6::Contexts> and F<autobox::Core> are my creations. @@ -414,9 +425,9 @@ ->print; # print them all out C<map()> is X<polymorphic>. -The C<map()> method defined in the C<CODE> package takes for its arguments the things +The C<map()> method defined in the C<autobox::Core::CODE> package takes for its arguments the things to map. -The C<map()> method defined in the C<ARRAY> package takes for its argument a code reference +The C<map()> method defined in the C<autobox::Core::ARRAY> package takes for its argument a code reference to apply to each element of the array. I<Here ends the text quoted from the Perl 6 Now manuscript.> @@ -481,7 +492,7 @@ # SCALAR # -package SCALAR; +package autobox::Core::SCALAR; # Functions for SCALARs or strings # "chomp", "chop", "chr", "crypt", "hex", "index", "lc", @@ -593,7 +604,7 @@ # HASH # -package HASH; +package autobox::Core::HASH; # Functions for real %HASHes # "delete", "each", "exists", "keys", "values" @@ -641,7 +652,7 @@ # ARRAY # ############################################################################################## -package ARRAY; +package autobox::Core::ARRAY; # Functions for list data # "grep", "join", "map", "qw/STRING/", "reverse", @@ -752,7 +763,7 @@ # CODE # -package CODE; +package autobox::Core::CODE; sub bless ($$) { CORE::bless $_[0], $_[1] } sub ref ($) { CORE::ref $_[0] }
On Mon May 26 11:24:21 2008, CHOCOLATE wrote: Show quoted text
> Hi, Scott. > > I've attached a patch which removes the need for code that uses > autobox::Core to also "use autobox". The patch also adds a note that > autobox autoboxes @array and %hash invocants as of 2.40. > > Cheers, > chocolateboy.
Fixed in 0.6