1 package SQL::Translator::Generator::Role::Quote;
7 SQL::Translator::Generator::Role::Quote - Role for dealing with identifier
12 I<documentation volunteers needed>
16 requires qw(quote_chars name_sep);
19 my ($self, $label) = @_;
21 return '' unless defined $label;
22 return $$label if ref($label) eq 'SCALAR';
24 my @quote_chars = @{$self->quote_chars};
25 return $label unless scalar @quote_chars;
28 if (@quote_chars == 1) {
29 ($l, $r) = (@quote_chars) x 2;
30 } elsif (@quote_chars == 2) {
31 ($l, $r) = @quote_chars;
33 die 'too many quote chars!';
36 my $sep = $self->name_sep || '';
37 # parts containing * are naturally unquoted
38 join $sep, map "$l$_$r", ( $sep ? split (/\Q$sep\E/, $label ) : $label )
45 See the included AUTHORS file:
46 L<http://search.cpan.org/dist/SQL-Translator/AUTHORS>
50 Copyright (c) 2012 the SQL::Translator L</AUTHORS> as listed above.
54 This code is free software and may be distributed under the same terms as Perl