1
package Class::Meta::Types::String;
3
# $Id: String.pm 2405 2005-12-17 03:41:09Z theory $
7
Class::Meta::Types::String - String data types
11
package MyApp::Thingy;
14
use Class::Meta::Types::String;
16
# use Class::Meta::Types::String 'affordance';
18
# use Class::Meta::Types::String 'semi-affordance';
21
# Create a Class::Meta object for this class.
22
my $cm = Class::Meta->new( key => 'thingy' );
24
# Add a string attribute.
25
$cm->add_attribute( name => 'name',
32
This module provides a string data type for use with Class::Meta attributes.
33
Simply load it, then pass "string" to the C<add_attribute()> method of a
34
Class::Meta object to create an attribute of the string data type. See
35
L<Class::Meta::Type|Class::Meta::Type> for more information on using and
41
use Class::Meta::Type;
42
our $VERSION = "0.52";
45
my ($pkg, $builder) = @_;
46
$builder ||= 'default';
47
return if eval "Class::Meta::Type->new('string')";
49
Class::Meta::Type->add(
55
return unless defined $_[0] && ref $_[0];
56
$_[2]->class->handle_error("Value '$_[0]' is not a valid string");
66
Please send bug reports to <bug-class-meta@rt.cpan.org> or report them via the
67
CPAN Request Tracker at L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Meta>.
71
David Wheeler <david@kineticode.com>
75
Other classes of interest within the Class::Meta distribution include:
79
=item L<Class::Meta|Class::Meta>
81
This class contains most of the documentation you need to get started with
84
=item L<Class::Meta::Type|Class::Meta::Type>
86
This class manages the creation of data types.
88
=item L<Class::Meta::Attribute|Class::Meta::Attribute>
90
This class manages Class::Meta class attributes, all of which are based on
95
Other data type modules:
99
=item L<Class::Meta::Types::Perl|Class::Meta::Types::Perl>
101
=item L<Class::Meta::Types::Boolean|Class::Meta::Types::Boolean>
103
=item L<Class::Meta::Types::Numeric|Class::Meta::Types::Numeric>
107
=head1 COPYRIGHT AND LICENSE
109
Copyright (c) 2002-2005, David Wheeler. All Rights Reserved.
111
This module is free software; you can redistribute it and/or modify it under
112
the same terms as Perl itself.