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::ROLE::ARRAY::WITHJUNCTIONS (3)

.ds Aq ’

NAME

List::Objects::WithUtils::Role::Array::WithJunctions - Add junctions

CONTENTS

SYNOPSIS



  ## Via List::Objects::WithUtils::Array ->
  use List::Objects::WithUtils array;

  my $array = array(qw/ a b c /);

  if ( $array->any_items eq b ) {
    ...
  }

  if ( $array->all_items eq a ) {
    ...
  }

  if ( $array->any_items == qr/^b/ ) {
    ...
  }

  ## As a Role ->
  use Role::Tiny::With;
  with List::Objects::WithUtils::Role::Array,
       List::Objects::WithUtils::Role::Array::WithJunctions;



DESCRIPTION

These methods supply overloaded List::Objects::WithUtils::Array::Junction objects that can be compared with values using normal Perl comparison operators.

Regular expressions can be matched by providing a qr// regular expression object to the == or != operators.

There is no support for the ~~ experimental smart-match operator.

The junction objects returned are subclasses of List::Objects::WithUtils::Array, allowing manipulation of junctions (of varying degrees of sanity) — a simple case might be generating a new junction out of an old junction:



  my $list = array(3, 4, 5);
  if ( (my $anyof = $list->any_items) > 2 ) {
    my $incr = $anyof->map(sub { $_[0] + 1 })->all_items;
    if ( $incr > 6 ) {
      # ...
    }
    # Drop junction magic again:
    my $plain = array( $incr->all );
  }



    any_items

Returns the overloaded <B>anyB> object for the current array; a comparison is true if any items in the array satisfy the condition.

    all_items

Returns the overloaded <B>allB> object for the current array; a comparison is true only if all items in the array satisfy the condition.

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::ROLE::ARRAY::WITHJUNCTIONS (3) 2016-01-25

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