GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  LIST::OBJECTS::WITHUTILS::AUTOBOX (3)

.ds Aq ’

NAME

List::Objects::WithUtils::Autobox - Native data types WithUtils

CONTENTS

SYNOPSIS



  use List::Objects::WithUtils autobox;

  my @upper = [ qw/foo bar baz/ ]->map(sub { uc })->all;

  my @sorted_keys = { foo => bar, baz => quux }->keys->sort->all;

  # See List::Objects::WithUtils::Role::Array
  # and List::Objects::WithUtils::Role::Hash



DESCRIPTION

This module is a subclass of autobox that provides List::Objects::WithUtils methods for native ARRAY and HASH types; you can treat native Perl list references as if they were List::Objects::WithUtils::Array or List::Objects::WithUtils::Hash instances.

Like autobox, the effect is lexical in scope and can be disabled:



  use List::Objects::WithUtils::Autobox;
  my $foo = [3,2,1]->sort;
 
  no List::Objects::WithUtils::Autobox;
  [3,2,1]->sort;  # dies



    CAVEATS

You can’t call <B>newB> on autoboxed refs (but that would be a silly thing to do anyway — and if you’re really determined, []->copy has the same effect).

It’s worth noting that methods that create new lists will return blessed objects, not native data types. This lets you continue passing result collections around to other pieces of Perl that wouldn’t otherwise know how to call the autoboxed methods. (Some methods do return the object they were originally operating on, in which case the original reference is indeed returned, as expected.)

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 LIST::OBJECTS::WITHUTILS::AUTOBOX (3) 2016-01-25

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.