Rose::HTML::Form::FielRdUo:ss:eeTr:i:mCHeoT:nM:tLSr:pi:lbFiuottr:em:d:H:oPFueirreMllidnD:uo:tcTeuiSmmeeecn:ot:naSdtp(il3oi)nt::HourMinuteSecond(3)



NNAAMMEE
       Rose::HTML::Form::Field::Time::Split::HourMinuteSecond - Compound field
       for times with separate text fields for hour, minute, and second, and a
       pop-up menu for selecting AM or PM.

SSYYNNOOPPSSIISS
           $field =
             Rose::HTML::Form::Field::Time::Split::HourMinuteSecond->new(
               label   => 'Time',
               name    => 'time',
               default => '8am');

           print $field->field('hour')->internal_value; # "08"

           $field->input_value('13:00:00 PM');

           # "AM/PM only valid with hours less than 12"
           $field->validate or warn $field->error;

           $field->input_value('blah');

           # "Invalid time"
           $field->validate or warn $field->error;

           $field->input_value('6:30 a.m.');

           print $field->internal_value; # "06:30:00 AM"

           print $field->html;
           ...

DDEESSCCRRIIPPTTIIOONN
       Rose::HTML::Form::Field::Time::Split::HourMinuteSecond is a compound
       field for times with separate text fields for hour, minute, and second,
       and a pop-up menu for selecting AM or PM.

       This class inherits (indirectly) from both
       Rose::HTML::Form::Field::Time and Rose::HTML::Form::Field::Compound.
       This doesn't quite work out as expected without a bit of tweaking.
       We'd like _i_n_f_l_a_t_e___v_a_l_u_e_(_) and _v_a_l_i_d_a_t_e_(_) methods to be inherited from
       Rose::HTML::Form::Field::Time, but everything else to be inherited from
       Rose::HTML::Form::Field::Compound.

       To solve this problem, there's an intermediate class that imports the
       correct set of methods.  This class then inherits from the intermediate
       class.  To solve this problem, there's an intermediate class that
       imports the correct set of methods.  This class then inherits from the
       intermediate class.  This works, and isolates the tricky bits to a
       single intermediate class, but it also demonstrates the problems that
       can crop up when multiple inheritance is combined with a strong
       aversion to code duplication.

       A simpler example of a compound field can be found in
       Rose::HTML::Form::Field::PhoneNumber::US::Split.  It too uses multiple
       inheritance, but its family tree is more conveniently built, saving it
       from selective method importing shenanigans.

       This field also overrides the
       "is_full()|Rose::HTML::Form::Field::Compound/is_full" method.  A valid
       time can be extracted from the field as long as both the hour and AM/PM
       subfields are not empty.  All other empty fields will be treated as if
       they contained zeros (00).

       It is important that this class (indirectly) inherits from
       Rose::HTML::Form::Field::Compound. See the
       Rose::HTML::Form::Field::Compound documentation for more information.

AAUUTTHHOORR
       John C. Siracusa (siracusa@gmail.com)

LLIICCEENNSSEE
       Copyright (c) 2009 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.



perl v5.16.3         Rose::HTML::F2o0r0m9:-:1F1i-e0l9d::Time::Split::HourMinuteSecond(3)
