| 1 | package Fey::Literal::String; | ||
| 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.43'; | |
| 8 | |||
| 9 | 27 | ▶ | use Fey::Types qw( Str ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 27 | ▶ | use Moose 2.1200; |
|
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.13; |
|
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 'string' => ( | |
| 18 | is => 'ro', | ||
| 19 | isa => Str, | ||
| 20 | required => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | sub BUILDARGS { | ||
| 24 | 81 | ▶ | my $class = shift; |
|
Subroutine
BUILDARGS: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | |||
| 26 | 81 | return { string => shift }; | |
| 27 | } | ||
| 28 | |||
| 29 | 33 | ▶ | sub sql { $_[1]->quote( $_[0]->string() ) } |
|
Subroutine
sql: called CC=1 SCAR=0.0
Pod
documented
| |||
| 30 | |||
| 31 | 2 | ▶ | sub sql_with_alias { goto &sql } |
|
Subroutine
sql_with_alias: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | |||
| 33 | 17 | ▶ | 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 string in a SQL statement | ||
| 40 | |||
| 41 | __END__ | ||
| 42 | |||
| 43 | =pod | ||
| 44 | |||
| 45 | =head1 NAME | ||
| 46 | |||
| 47 | Fey::Literal::String - Represents a literal string in a SQL statement | ||
| 48 | |||
| 49 | =head1 VERSION | ||
| 50 | |||
| 51 | version 0.43 | ||
| 52 | |||
| 53 | =head1 SYNOPSIS | ||
| 54 | |||
| 55 | my $string = Fey::Literal::String->new($string) | ||
| 56 | |||
| 57 | =head1 DESCRIPTION | ||
| 58 | |||
| 59 | This class represents a literal string in a SQL statement. | ||
| 60 | |||
| 61 | =head1 INHERITANCE | ||
| 62 | |||
| 63 | This module is a subclass of C<Fey::Literal>. | ||
| 64 | |||
| 65 | =head1 METHODS | ||
| 66 | |||
| 67 | This class provides the following methods: | ||
| 68 | |||
| 69 | =head2 Fey::Literal::String->new($string) | ||
| 70 | |||
| 71 | This method creates a new C<Fey::Literal::String> object representing | ||
| 72 | the string passed to the constructor. | ||
| 73 | |||
| 74 | =head2 $string->string() | ||
| 75 | |||
| 76 | Returns the string as passed to the constructor. | ||
| 77 | |||
| 78 | =head2 $string->id() | ||
| 79 | |||
| 80 | The id for a string is always just the string itself. | ||
| 81 | |||
| 82 | =head2 $string->sql() | ||
| 83 | |||
| 84 | =head2 $string->sql_with_alias() | ||
| 85 | |||
| 86 | =head2 $string->sql_or_alias() | ||
| 87 | |||
| 88 | Returns the appropriate SQL snippet. | ||
| 89 | |||
| 90 | =head1 ROLES | ||
| 91 | |||
| 92 | This class does the C<Fey::Role::Selectable> and | ||
| 93 | C<Fey::Role::Comparable> roles. | ||
| 94 | |||
| 95 | =head1 BUGS | ||
| 96 | |||
| 97 | See L<Fey> for details on how to report bugs. | ||
| 98 | |||
| 99 | =head1 AUTHOR | ||
| 100 | |||
| 101 | Dave Rolsky <autarch@urth.org> | ||
| 102 | |||
| 103 | =head1 COPYRIGHT AND LICENSE | ||
| 104 | |||
| 105 | This software is Copyright (c) 2011 - 2015 by Dave Rolsky. | ||
| 106 | |||
| 107 | This is free software, licensed under: | ||
| 108 | |||
| 109 | The Artistic License 2.0 (GPL Compatible) | ||
| 110 | |||
| 111 | =cut | ||