GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ROSE::HTML::OBJECT::MESSAGES (3)

.ds Aq ’

NAME

Rose::HTML::Object::Messages - Message ids and named constants for use with HTML objects.

CONTENTS

SYNOPSIS



  package My::HTML::Object::Messages;

  use strict;

  # Import the standard set of message ids
  use Rose::HTML::Object::Messages qw(:all);
  use base qw(Rose::HTML::Object::Messages);

  ##
  ## Define your new message ids below
  ##

  # Message ids from 0 to 29,999 are reserved for built-in messages.
  # Negative message ids are reserved for internal use.  Please use
  # message ids 30,000 or higher for your messages.  Suggested message
  # id ranges and naming conventions for various message types are
  # shown below.

  # Field labels

  use constant FIELD_LABEL_LOGIN_NAME         => 100_000;
  use constant FIELD_LABEL_PASSWORD           => 100_001;
  ...

  # Field error messages

  use constant FIELD_ERROR_PASSWORD_TOO_SHORT => 101_000;
  use constant FIELD_ERROR_USERNAME_INVALID   => 101_001;
  ...

  # Generic messages

  use constant LOGIN_NO_SUCH_USER             => 200_000;
  use constant LOGIN_USER_EXISTS_ERROR        => 200_001;
  ...

  # This line must be below all the "use constant ..." declarations
  BEGIN { __PACKAGE__->add_messages }

  1;



DESCRIPTION

Rose::HTML::Object::Messages stores message ids and names. The message ids are defined as Perl constants with integer values. The constants themselves as well as the mapping between the symbolic constant names and their values are stored as class data.

If you merely want to import one of the standard message id constants, you may use this module as-is (see the EXPORTS section for details). If you want to define your own messages, you must subclass this module exactly as shown in the synopsis. The order of the statements is important!

When adding your own messages, you are free to choose any integer message id values, subject to the following constraints:
o Message ids from 0 to 29,999 are reserved for built-in messages.
o Negative message ids are reserved for internal use.
Please use ids 30,000 or higher for your messages. Constant names may contain only the characters [A-Z0-9_] and must be unique among all message constant names.

EXPORTS

Rose::HTML::Object::Messages does not export any symbols by default.

The ’all’ tag:



    use Rose::HTML::Object::Messages qw(:all);



will cause all message name constant to be imported.

The following tags will cause all messages whose names match the regular expression to the right of the tag name to be imported.



    TAG       NAME REGEX
    -----     -----------------
    field     ^FIELD_
    form      ^FORM_
    date      ^DATE_|_(?:YEAR|MONTH|DAY)$
    time      ^TIME_|_(?:HOUR|MINUTE|SECOND)$
    email     ^EMAIL_
    phone     ^PHONE_
    number    ^NUM_
    set       ^SET_
    string    ^STRING_



For example, this will import all the message constants whose names begin with FIELD_



    use Rose::HTML::Object::Messages qw(:field);



Finally, you can import individual message constant names as well:



    use Rose::HTML::Object::Messages qw(FIELD_LABEL_YEAR TIME_INVALID);



A complete listing of the default set of message constant names appears in the next section.

BUILT-IN MESSAGES

The list of built-in messages constant names appears below. You should not rely on the actual numeric values of these constants. Import and refer to them only by their symbolic names.



    FIELD_LABEL
    FIELD_DESCRIPTION
    FIELD_REQUIRED_GENERIC
    FIELD_REQUIRED_LABELLED
    FIELD_REQUIRED_SUBFIELD
    FIELD_REQUIRED_SUBFIELDS
    FIELD_PARTIAL_VALUE
    FIELD_INVALID_GENERIC
    FIELD_INVALID_LABELLED

    FIELD_LABEL_YEAR
    FIELD_LABEL_MONTH
    FIELD_LABEL_DAY
    FIELD_LABEL_HOUR
    FIELD_LABEL_MINUTE
    FIELD_LABEL_SECOND

    FIELD_ERROR_LABEL_YEAR
    FIELD_ERROR_LABEL_MONTH
    FIELD_ERROR_LABEL_DAY
    FIELD_ERROR_LABEL_HOUR
    FIELD_ERROR_LABEL_MINUTE
    FIELD_ERROR_LABEL_SECOND

    FIELD_ERROR_LABEL_MINIMUM_DATE
    FIELD_ERROR_LABEL_MAXIMUM_DATE

    FORM_HAS_ERRORS

    NUM_INVALID_INTEGER
    NUM_INVALID_INTEGER_POSITIVE
    NUM_NOT_POSITIVE_INTEGER
    NUM_BELOW_MIN
    NUM_ABOVE_MAX
    NUM_INVALID_NUMBER
    NUM_INVALID_NUMBER_POSITIVE
    NUM_NOT_POSITIVE_NUMBER

    STRING_OVERFLOW

    DATE_INVALID
    DATE_MIN_GREATER_THAN_MAX

    TIME_INVALID
    TIME_INVALID_HOUR
    TIME_INVALID_MINUTE
    TIME_INVALID_SECONDS
    TIME_INVALID_AMPM

    EMAIL_INVALID

    PHONE_INVALID

    SET_INVALID_QUOTED_STRING
    SET_PARSE_ERROR



CLASS METHODS

<B>add_message NAME, IDB> Add a new message constant with NAME and an integer ID value. Message ids from 0 to 29,999 are reserved for built-in messages. Negative message ids are reserved for internal use. Please use message ids 30,000 or higher for your messages. Constant names may contain only the characters [A-Z0-9_] and must be unique among all message names.
<B>add_messages [NAME1, NAME2, ...]B> If called with no arguments, this method adds all message constants defined in the calling class. Example:



    __PACKAGE__->add_messages;



If called with a list of constant names, add each named constant to the list of messages. These constants must already exist in the calling class. Example:



    use constant MY_MESSAGE1 => 123456;
    use constant MY_MESSAGE2 => 123457;
    ...
    __PACKAGE__->add_messages(MY_MESSAGE1, MY_MESSAGE2);



<B>get_message_id NAMEB> Returns the integer message id corresponding to the symbolic constant NAME, or undef if no such name exists.
<B>get_message_name IDB> Returns the symbolic message constant name corresponding to the integer message ID, or undef if no such message ID exists.
<B>message_id_exists IDB> Return true if the integer message ID exists, false otherwise.
<B>message_name_exists NAMEB> Return true if the symbolic message constant NAME exists, false otherwise.
<B>message_idsB> Returns a list (in list context) or reference to an array (in scalar context) of integer message ids.
<B>message_namesB> Returns a list (in list context) or reference to an array (in scalar context) of message names.

AUTHOR

John C. Siracusa (siracusa@gmail.com)

LICENSE

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ROSE::HTML::OBJECT::MESSAGES (3) 2015-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.