Fey/Literal/Number.pm

filter: Statementstmt 100% 31 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 4 / 4 totaltotal 100% 46 / 46 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Fey/Literal/Null.pm ↑ Summary Fey/Literal/String.pm »
1 package Fey::Literal::Number;
2  
3 27 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 27 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 27 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 27 our $VERSION = '0.42';
8  
9 27 ▶use Fey::Types qw( Num );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 27 ▶use Moose 0.90;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 27 ▶use MooseX::SemiAffordanceAccessor 0.03;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 27 ▶use MooseX::StrictConstructor 0.07;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 27 with 'Fey::Role::Comparable', 'Fey::Role::Selectable', 'Fey::Role::IsLiteral';
16  
17 27 has 'number' => (
18 is => 'ro',
19 isa => Num,
20 required => 1,
21 );
22  
23 sub BUILDARGS {
24 148 ▶ my $class = shift;
Subroutine BUILDARGS: called CC=1 SCAR=0.0
Pod documented
25  
26 148 return { number => shift };
27 }
28  
29 106 ▶sub sql { $_[0]->number() }
Subroutine sql: called CC=1 SCAR=0.0
Pod documented
30  
31 55 ▶sub sql_with_alias { goto &sql }
Subroutine sql_with_alias: called CC=1 SCAR=0.0
Pod documented
32  
33 40 ▶sub sql_or_alias { goto &sql }
Subroutine sql_or_alias: called CC=1 SCAR=0.0
Pod documented
34  
35 27 __PACKAGE__->meta()->make_immutable();
36  
37 27 1;
38  
39 # ABSTRACT: Represents a literal number in a SQL statement
40  
41 __END__
42  
43 =pod
44  
45 =head1 NAME
46  
47 Fey::Literal::Number - Represents a literal number in a SQL statement
48  
49 =head1 VERSION
50  
51 version 0.42
52  
53 =head1 SYNOPSIS
54  
55 my $number = Fey::Literal::Number->new($number)
56  
57 =head1 DESCRIPTION
58  
59 This class represents a literal number in a SQL statement, either an
60 integer or float.
61  
62 =head1 INHERITANCE
63  
64 This module is a subclass of C<Fey::Literal>.
65  
66 =head1 METHODS
67  
68 This class provides the following methods:
69  
70 =head2 Fey::Literal::Number->new($number)
71  
72 This method creates a new C<Fey::Literal::Number> object representing
73 the number passed to the constructor.
74  
75 =head2 $number->number()
76  
77 Returns the number as passed to the constructor.
78  
79 =head2 $number->id()
80  
81 The id for a number is always just the number itself.
82  
83 =head2 $number->sql()
84  
85 =head2 $number->sql_with_alias()
86  
87 =head2 $number->sql_or_alias()
88  
89 Returns the appropriate SQL snippet.
90  
91 =head1 ROLES
92  
93 This class does the C<Fey::Role::Selectable> and
94 C<Fey::Role::Comparable> roles.
95  
96 =head1 BUGS
97  
98 See L<Fey> for details on how to report bugs.
99  
100 =head1 AUTHOR
101  
102 Dave Rolsky <autarch@urth.org>
103  
104 =head1 COPYRIGHT AND LICENSE
105  
106 This software is Copyright (c) 2011 - 2015 by Dave Rolsky.
107  
108 This is free software, licensed under:
109  
110 The Artistic License 2.0 (GPL Compatible)
111  
112 =cut
« Fey/Literal/Null.pm ↑ Summary Fey/Literal/String.pm »