| 1 | package oEdtk::AddrField; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | ▶ | use oEdtk::Main qw(oe_uc_sans_accents); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use base 'oEdtk::Field'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 3 | our $VERSION = 2.1129; | |
| 9 | |||
| 10 | 2 | ▶ | sub process { |
|
Subroutine
process: called CC=1 SCAR=0.0
Pod
documented
| |||
| 11 | 2 | my ( $self, $data ) = @_; | |
| 12 | |||
| 13 | 2 | $data =~ s/^\s+//; | |
| 14 | 2 | $data =~ s/\s+$//; | |
| 15 | 2 | oe_uc_sans_accents($data); | |
| 16 | 2 | return uc($data); | |
| 17 | } | ||
| 18 | |||
| 19 | 3 | 1; | |
| 20 | |||
| 21 | =head1 NAME | ||
| 22 | |||
| 23 | oEdtk::AddrField - address field: trim, drop accents, uppercase | ||
| 24 | |||
| 25 | =head1 SYNOPSIS | ||
| 26 | |||
| 27 | use oEdtk::AddrField; | ||
| 28 | |||
| 29 | my $field = oEdtk::AddrField->new('ADDR', 38); | ||
| 30 | print $field->process(' 12 rue de la gare '), "\n"; # '12 RUE DE LA GARE' | ||
| 31 | |||
| 32 | =head1 DESCRIPTION | ||
| 33 | |||
| 34 | An C<oEdtk::Field> subclass for address lines. It trims the leading and | ||
| 35 | trailing whitespace, strips the accents and uppercases the result. The field | ||
| 36 | name and byte length are carried by the inherited constructor. | ||
| 37 | |||
| 38 | =head1 METHODS | ||
| 39 | |||
| 40 | =head2 process | ||
| 41 | |||
| 42 | my $value = $field->process($data); | ||
| 43 | |||
| 44 | Trim C<$data>, drop its accents (via C<oe_uc_sans_accents>, imported from | ||
| 45 | C<oEdtk::Main>) and return it uppercased. | ||
| 46 | |||
| 47 | =head1 AUTHOR | ||
| 48 | |||
| 49 | The oEdtk team. | ||
| 50 | |||
| 51 | =cut | ||