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  -  MOOSEX::ATTRIBUTEHELPERS (3)

.ds Aq ’

NAME

MooseX::AttributeHelpers - (DEPRECATED) Extend your attribute interfaces

CONTENTS

VERSION

version 0.25

SYNOPSIS



  package MyClass;
  use Moose;
  use MooseX::AttributeHelpers;

  has mapping => (
      metaclass => Collection::Hash,
      is        => rw,
      isa       => HashRef[Str],
      default   => sub { {} },
      provides  => {
          exists    => exists_in_mapping,
          keys      => ids_in_mapping,
          get       => get_mapping,
          set       => set_mapping,
      },
      curries  => {
          set       => { set_quantity => [ quantity ] }
      }
  );


  # ...

  my $obj = MyClass->new;
  $obj->set_quantity(10);      # quantity => 10
  $obj->set_mapping(4, foo); # 4 => foo
  $obj->set_mapping(5, bar); # 5 => bar
  $obj->set_mapping(6, baz); # 6 => baz


  # prints bar
  print $obj->get_mapping(5) if $obj->exists_in_mapping(5);

  # prints 4, 5, 6
  print join , , $obj->ids_in_mapping;



DESCRIPTION

<B>This distribution is deprecated. The features it provides have been added to the Moose core code as Moose::Meta::Attribute::Native. This distribution should not be used by any new code.B>

While Moose attributes provide you with a way to name your accessors, readers, writers, clearers and predicates, this library provides commonly used attribute helper methods for more specific types of data.

As seen in the SYNOPSIS, you specify the extension via the metaclass parameter. Available meta classes are:

PARAMETERS

    provides

This points to a hashref that uses provider for the keys and method for the values. The method will be added to the object itself and do what you want.

    curries

This points to a hashref that uses provider for the keys and has two choices for the value:

You can supply {method => [ @args ]} for the values. The method will be added to the object itself (always using @args as the beginning arguments).

Another approach to curry a method provider is to supply a coderef instead of an arrayref. The code ref takes $self, $body, and any additional arguments passed to the final method.



  # ...

  curries => {
      grep => {
          times_with_day => sub {
              my ($self, $body, $datetime) = @_;
              $body->($self, sub { $_->ymd eq $datetime->ymd });
          }
      }
  }

  # ...

  $obj->times_with_day(DateTime->now); # takes datetime argument, checks day



METHOD PROVIDERS

Number Common numerical operations.
String Common methods for string operations.
Counter Methods for incrementing and decrementing a counter attribute.
Bool Common methods for boolean values.
Collection::Hash Common methods for hash references.
Collection::ImmutableHash Common methods for inspecting hash references.
Collection::Array Common methods for array references.
Collection::List Common list methods for array references.

DEPRECATION NOTICE

The functionality in this family of modules is now implemented in the Moose core as Moose::Meta::Attribute::Native. No more development is being done on MooseX::AttributeHelpers, so we encourage you to switch to native attribute traits.

SUPPORT

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-AttributeHelpers> (or bug-MooseX-AttributeHelpers@rt.cpan.org <mailto:bug-MooseX-AttributeHelpers@rt.cpan.org>).

There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/moose.html>.

There is also an irc channel available for users of this distribution, at #moose on irc.perl.org <irc://irc.perl.org/#moose>.

AUTHOR

Stevan Little <stevan@iinteractive.com>

CONTRIBUTORS

o Shawn M Moore <sartak@gmail.com>
o Stevan Little <stevan.little@iinteractive.com>
o Dave Rolsky <autarch@urth.org>
o Florian Ragwitz <rafl@debian.org>
o Yuval Kogman <nothingmuch@woobling.org>
o Jason May <jason.a.may@gmail.com>
o Karen Etheridge <ether@cpan.org>
o Cory G Watson <gphat@onemogin.com>
o Jesse Luehrs <doy@tozt.net>
o Robert Boone <robo4288@gmail.com>
o Bruno Vecchi <vecchi.b@gmail.com>
o Johannes Plunien <plu@pqpq.de>
o Mike Whitaker <mike@altrion.org>
o Hans Dieter Pearcey <hdp@weftsoar.net>
o Paul Driver <frodwith@gmail.com>
o Robert ’phaylon’ Sedlacek <rs@474.at>
o Evan Carroll <me@evancarroll.com>
o Dagfinn Ilmari Mannsaaker <ilmari@ilmari.org>
o Chris Prather <cprather@hdpublishing.com>
o Tom Lanyon <tom@netspot.com.au>
o Chris Prather <chris@prather.org>
o nperez <nperez@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2007 by Stevan Little and Infinity Interactive, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MOOSEX::ATTRIBUTEHELPERS (3) 2016-02-16

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