| 1 | package Rose::HTML::Object::Errors; | ||
| 2 | |||
| 3 | 45 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 45 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 45 | ▶ | use base 'Rose::HTML::Object::Messages'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 45 | our $VERSION = '0.600'; | |
| 10 | |||
| 11 | BEGIN | ||
| 12 | 45 | ▶ | { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 45 | __PACKAGE__->message_names([]); | |
| 14 | 45 | __PACKAGE__->message_id_to_name_map({}); | |
| 15 | 45 | __PACKAGE__->message_name_to_id_map({}); | |
| 16 | } | ||
| 17 | |||
| 18 | BEGIN | ||
| 19 | 45 | ▶ | { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 45 | *error_ids = \&Rose::HTML::Object::Messages::message_ids; | |
| 21 | 45 | *error_id_exists = \&Rose::HTML::Object::Messages::message_id_exists; | |
| 22 | 45 | *error_name_exists = \&Rose::HTML::Object::Messages::message_name_exists; | |
| 23 | |||
| 24 | 45 | *get_error_id = \&Rose::HTML::Object::Messages::get_message_id; | |
| 25 | 45 | *get_error_name = \&Rose::HTML::Object::Messages::get_message_name; | |
| 26 | |||
| 27 | 45 | *add_error = \&Rose::HTML::Object::Messages::add_message; | |
| 28 | 45 | *add_errors = \&Rose::HTML::Object::Messages::add_messages; | |
| 29 | 45 | *get_error_id = \&Rose::HTML::Object::Messages::get_message_id; | |
| 30 | |||
| 31 | 45 | *add_error = \&Rose::HTML::Object::Messages::add_message; | |
| 32 | 45 | *add_errors = \&Rose::HTML::Object::Messages::add_messages; | |
| 33 | |||
| 34 | 45 | *error_names = \&Rose::HTML::Object::Messages::message_names; | |
| 35 | } | ||
| 36 | |||
| 37 | sub init_export_tags | ||
| 38 | 193 | ▶ | { |
|
Subroutine
init_export_tags: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 39 | 193 | my($class) = shift; | |
| 40 | |||
| 41 | 193 | my $list = $class->error_names; | |
| 42 | |||
| 43 | $class->export_tags | ||
| 44 | ( | ||
| 45 | all => $list, | ||
| 46 | 4847 | field => [ grep { /^FIELD_/ } @$list ], | |
| 47 | 4847 | form => [ grep { /^FORM_/ } @$list ], | |
| 48 | 4847 | date => [ grep { /^DATE_/ } @$list ], | |
| 49 | 4847 | time => [ grep { /^TIME_/ } @$list ], | |
| 50 | 4847 | email => [ grep { /^EMAIL_/ } @$list ], | |
| 51 | 4847 | phone => [ grep { /^PHONE_/ } @$list ], | |
| 52 | 4847 | number => [ grep { /^NUM_/ } @$list ], | |
| 53 | 4847 | set => [ grep { /^SET_/ } @$list ], | |
| 54 | 193 | string => [ grep { /^STRING_/ } @$list ], | |
| 55 | ); | ||
| 56 | } | ||
| 57 | |||
| 58 | # | ||
| 59 | # Errors | ||
| 60 | # | ||
| 61 | |||
| 62 | 45 | ▶ | use constant CUSTOM_ERROR => -1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 63 | |||
| 64 | # Field errors | ||
| 65 | 45 | ▶ | use constant FIELD_REQUIRED => 3; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 66 | 45 | ▶ | use constant FIELD_PARTIAL_VALUE => 8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 67 | 45 | ▶ | use constant FIELD_INVALID => 9; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 68 | |||
| 69 | # Form errors | ||
| 70 | 45 | ▶ | use constant FORM_HAS_ERRORS => 100; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 71 | |||
| 72 | # Numerical errors | ||
| 73 | 45 | ▶ | use constant NUM_INVALID_INTEGER => 1300; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 74 | 45 | ▶ | use constant NUM_INVALID_INTEGER_POSITIVE => 1301; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 75 | 45 | ▶ | use constant NUM_NOT_POSITIVE_INTEGER => 1302; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 76 | 45 | ▶ | use constant NUM_BELOW_MIN => 1303; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 77 | 45 | ▶ | use constant NUM_ABOVE_MAX => 1304; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 78 | 45 | ▶ | use constant NUM_INVALID_NUMBER => 1305; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 79 | 45 | ▶ | use constant NUM_INVALID_NUMBER_POSITIVE => 1306; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 80 | 45 | ▶ | use constant NUM_NOT_POSITIVE_NUMBER => 1307; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 81 | |||
| 82 | |||
| 83 | # String errors | ||
| 84 | 45 | ▶ | use constant STRING_OVERFLOW => 1400; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 85 | |||
| 86 | # Date errors | ||
| 87 | 45 | ▶ | use constant DATE_INVALID => 1500; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 88 | 45 | ▶ | use constant DATE_MIN_GREATER_THAN_MAX => 1501; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 89 | |||
| 90 | # Time errors | ||
| 91 | 45 | ▶ | use constant TIME_INVALID => 1550; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 92 | 45 | ▶ | use constant TIME_INVALID_HOUR => 1551; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 93 | 45 | ▶ | use constant TIME_INVALID_MINUTE => 1552; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 94 | 45 | ▶ | use constant TIME_INVALID_SECONDS => 1553; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 95 | 45 | ▶ | use constant TIME_INVALID_AMPM => 1554; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 96 | |||
| 97 | # Email errors | ||
| 98 | 45 | ▶ | use constant EMAIL_INVALID => 1600; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 99 | |||
| 100 | # Phone errors | ||
| 101 | 45 | ▶ | use constant PHONE_INVALID => 1650; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 102 | |||
| 103 | # Set errors | ||
| 104 | 45 | ▶ | use constant SET_INVALID_QUOTED_STRING => 1700; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 105 | 45 | ▶ | use constant SET_PARSE_ERROR => 1701; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 106 | |||
| 107 | 45 | ▶ | BEGIN { __PACKAGE__->add_errors } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 108 | |||
| 109 | 45 | 1; | |
| 110 | |||
| 111 | __END__ | ||