~ubuntu-branches/ubuntu/trusty/libclass-meta-perl/trusty

« back to all changes in this revision

Viewing changes to lib/Class/Meta/AccessorBuilder/Affordance.pm

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Krzyżaniak (eloy)
  • Date: 2008-05-15 12:13:58 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080515121358-u85ca6zfzc0wae94
Tags: 0.61-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package Class::Meta::AccessorBuilder::Affordance;
2
2
 
3
 
# $Id: Affordance.pm 3787 2008-05-05 17:58:15Z david $
 
3
# $Id: Affordance.pm 3879 2008-05-13 03:39:45Z david $
4
4
 
5
5
=head1 NAME
6
6
 
14
14
  use Class::Meta::Type;
15
15
  use IO::Socket;
16
16
 
17
 
  my $type = Class::Meta::Type->add( key     => 'io_socket',
18
 
                                     builder => 'affordance',
19
 
                                     desc    => 'IO::Socket object',
20
 
                                     name    => 'IO::Socket Object' );
 
17
  my $type = Class::Meta::Type->add(
 
18
      key     => 'io_socket',
 
19
      builder => 'affordance',
 
20
      desc    => 'IO::Socket object',
 
21
      name    => 'IO::Socket Object'
 
22
  );
21
23
 
22
24
=head1 DESCRIPTION
23
25
 
160
162
=head3 build
161
163
 
162
164
  Class::Meta::AccessorBuilder::Affordance::build(
163
 
    $pkg, $attribute, $create, @checks
 
165
      $pkg, $attribute, $create, @checks
164
166
  );
165
167
 
166
168
This method is called by the C<build()> method of Class::Meta::Type, and does
186
188
=item @checks
187
189
 
188
190
A list of code references that validate the value of an attribute. These will
189
 
be used in the set acccessor (mutator) to validate new attribute values.
 
191
be used in the set accessor (mutator) to validate new attribute values.
190
192
 
191
193
=back
192
194
 
194
196
 
195
197
use strict;
196
198
use Class::Meta;
197
 
our $VERSION = '0.55';
 
199
our $VERSION = '0.61';
198
200
 
199
201
sub build_attr_get {
200
202
    UNIVERSAL::can($_[0]->package, 'get_' . $_[0]->name);
319
321
            };
320
322
        }
321
323
    } elsif ($attr->view == Class::Meta::TRUSTED) {
322
 
        # XXX Should we have an accessor for this?
323
 
        my $trusted = $attr->class->{trusted};
 
324
        my $trusted = $attr->class->trusted;
324
325
        for ($get, $set) {
325
326
            my $real_sub = $_ or next;
326
327
            $_ = sub {
343
344
1;
344
345
__END__
345
346
 
346
 
=head1 BUGS
347
 
 
348
 
Please send bug reports to <bug-class-meta@rt.cpan.org> or report them via the
349
 
CPAN Request Tracker at L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Meta>.
 
347
=head1 SUPPORT
 
348
 
 
349
This module is stored in an open repository at the following address:
 
350
 
 
351
L<https://svn.kineticode.com/Class-Meta/trunk/>
 
352
 
 
353
Patches against Class::Meta are welcome. Please send bug reports to
 
354
<bug-class-meta@rt.cpan.org>.
350
355
 
351
356
=head1 AUTHOR
352
357