Commit | Line | Data |
6cf5bcf2 |
1 | package Moose::Autobox::String; |
2 | use Moose::Role; |
3 | |
f3e571b2 |
4 | our $VERSION = '0.12'; |
6cf5bcf2 |
5 | |
31d40d73 |
6 | with 'Moose::Autobox::Value'; |
7 | |
6cf5bcf2 |
8 | # perl built-ins |
9 | |
10 | sub lc { CORE::lc $_[0] } |
11 | sub lcfirst { CORE::lcfirst $_[0] } |
12 | sub uc { CORE::uc $_[0] } |
13 | sub ucfirst { CORE::ucfirst $_[0] } |
14 | sub chomp { CORE::chomp $_[0] } |
15 | sub chop { CORE::chop $_[0] } |
16 | sub reverse { CORE::reverse $_[0] } |
17 | sub length { CORE::length $_[0] } |
bf868259 |
18 | sub lines { [ CORE::split '\n', $_[0] ] } |
19 | sub words { [ CORE::split ' ', $_[0] ] } |
680d0745 |
20 | sub index { |
21 | return CORE::index($_[0], $_[1]) if scalar @_ == 2; |
22 | return CORE::index($_[0], $_[1], $_[2]); |
23 | } |
dae37220 |
24 | sub rindex { |
25 | return CORE::rindex($_[0], $_[1]) if scalar @_ == 2; |
26 | return CORE::rindex($_[0], $_[1], $_[2]); |
27 | } |
2e99cc07 |
28 | sub split { |
bf868259 |
29 | return [ CORE::split($_[1], $_[0]) ] if scalar @_ == 2; |
30 | return [ CORE::split($_[1], $_[0], $_[2]) ]; |
2e99cc07 |
31 | } |
6cf5bcf2 |
32 | |
31d40d73 |
33 | 1; |
34 | |
35 | __END__ |
36 | |
37 | =pod |
38 | |
39 | =head1 NAME |
40 | |
41 | Moose::Autobox::String - the String role |
42 | |
43 | =head1 SYNOPOSIS |
44 | |
45 | use Moose::Autobox; |
31d40d73 |
46 | |
47 | "Hello World"->uc; # HELLO WORLD |
48 | |
49 | =head1 DESCRIPTION |
50 | |
8937074a |
51 | This is a role to describes a String value. |
52 | |
260cc81f |
53 | =head1 METHODS |
54 | |
55 | =over 4 |
56 | |
260cc81f |
57 | =item B<chomp> |
58 | |
59 | =item B<chop> |
60 | |
61 | =item B<index> |
62 | |
63 | =item B<lc> |
64 | |
65 | =item B<lcfirst> |
66 | |
67 | =item B<length> |
68 | |
69 | =item B<reverse> |
70 | |
dae37220 |
71 | =item B<rindex> |
72 | |
260cc81f |
73 | =item B<uc> |
74 | |
75 | =item B<ucfirst> |
76 | |
c0ab09e3 |
77 | =item B<split> |
78 | |
79 | $string->split($pattern); |
80 | |
81 | =item B<words> |
82 | |
83 | This is equivalent to splitting on space. |
84 | |
85 | =item B<lines> |
86 | |
87 | This is equivalent to splitting on linelines. |
88 | |
260cc81f |
89 | =back |
90 | |
5272f13f |
91 | =over 4 |
92 | |
93 | =item B<meta> |
94 | |
95 | =back |
96 | |
31d40d73 |
97 | =head1 BUGS |
98 | |
99 | All complex software has bugs lurking in it, and this module is no |
100 | exception. If you find a bug please either email me, or add the bug |
101 | to cpan-RT. |
102 | |
103 | =head1 AUTHOR |
104 | |
105 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
106 | |
107 | =head1 COPYRIGHT AND LICENSE |
108 | |
ea4e64bf |
109 | Copyright 2006-2008 by Infinity Interactive, Inc. |
31d40d73 |
110 | |
111 | L<http://www.iinteractive.com> |
112 | |
113 | This library is free software; you can redistribute it and/or modify |
114 | it under the same terms as Perl itself. |
115 | |
dae37220 |
116 | =cut |
117 | |