~ubuntu-branches/ubuntu/wily/libdata-perl-perl/wily

« back to all changes in this revision

Viewing changes to .pc/pod-syntax.patch/lib/Data/Perl/Role/Number.pm

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2014-06-26 19:50:36 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140626195036-ha01k824iwswsi5d
Tags: 0.002008-1
* Team upload.
* New upstream release.
* Don't install README.mkdn, just a text version of the POD.
* Update years of upstream copyright.
* Set debhelper compatibility level to 8.
* Update short description.
* Add patch to fix POD syntax errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package Data::Perl::Role::Number;
 
2
$Data::Perl::Role::Number::VERSION = '0.002008';
 
3
# ABSTRACT: Wrapping class for Perl scalar numbers.
 
4
 
 
5
use strictures 1;
 
6
 
 
7
use Role::Tiny;
 
8
 
 
9
sub new { bless \(my $n = $_[1]), $_[0] }
 
10
 
 
11
sub add { ${$_[0]} = ${$_[0]} + $_[1] }
 
12
 
 
13
sub sub { ${$_[0]} = ${$_[0]} - $_[1] }
 
14
 
 
15
sub mul { ${$_[0]} = ${$_[0]} * $_[1] }
 
16
 
 
17
sub div { ${$_[0]} = ${$_[0]} / $_[1] }
 
18
 
 
19
sub mod { ${$_[0]} = ${$_[0]} % $_[1] }
 
20
 
 
21
sub abs { ${$_[0]} = abs(${$_[0]}) }
 
22
 
 
23
1;
 
24
 
 
25
=pod
 
26
 
 
27
=encoding UTF-8
 
28
 
 
29
=head1 NAME
 
30
 
 
31
Data::Perl::Role::Number - Wrapping class for Perl scalar numbers.
 
32
 
 
33
=head1 VERSION
 
34
 
 
35
version 0.002008
 
36
 
 
37
=head1 SYNOPSIS
 
38
 
 
39
  use Data::Perl qw/number/;
 
40
 
 
41
  my $num = number(123);
 
42
 
 
43
  $num->add(5); # $num == 128
 
44
 
 
45
  $num->div(2); # $num == 64
 
46
 
 
47
=head1 DESCRIPTION
 
48
 
 
49
This class provides a wrapper and methods for interacting with scalar strings.
 
50
 
 
51
=head1 PROVIDED METHODS
 
52
 
 
53
All of these methods modify the attribute's value in place. All methods return
 
54
the new value.
 
55
 
 
56
=over 4
 
57
 
 
58
=item B<new($value)>
 
59
 
 
60
Constructs a new Data::Perl::Collection::Number object initialized with the passed
 
61
in value, and returns it.
 
62
 
 
63
=item * B<add($value)>
 
64
 
 
65
Adds the current value of the attribute to C<$value>.
 
66
 
 
67
=item * B<sub($value)>
 
68
 
 
69
Subtracts C<$value> from the current value of the attribute.
 
70
 
 
71
=item * B<mul($value)>
 
72
 
 
73
Multiplies the current value of the attribute by C<$value>.
 
74
 
 
75
=item * B<div($value)>
 
76
 
 
77
Divides the current value of the attribute by C<$value>.
 
78
 
 
79
=item * B<mod($value)>
 
80
 
 
81
Returns the current value of the attribute modulo C<$value>.
 
82
 
 
83
=item * B<abs>
 
84
 
 
85
Sets the current value of the attribute to its absolute value.
 
86
 
 
87
=back
 
88
 
 
89
=head1 SEE ALSO
 
90
 
 
91
=over 4
 
92
 
 
93
=item * L<Data::Perl>
 
94
 
 
95
=item * L<MooX::HandlesVia>
 
96
 
 
97
=back
 
98
 
 
99
=head1 AUTHOR
 
100
 
 
101
Matthew Phillips <mattp@cpan.org>
 
102
 
 
103
=head1 COPYRIGHT AND LICENSE
 
104
 
 
105
This software is copyright (c) 2014 by Matthew Phillips <mattp@cpan.org>.
 
106
 
 
107
This is free software; you can redistribute it and/or modify it under
 
108
the same terms as the Perl 5 programming language system itself.
 
109
 
 
110
=cut
 
111
 
 
112
__END__
 
113
==pod
 
114