Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

michal-josef-spacek/Data-HTML-Form

Repository files navigation

NAME
    Data::HTML::Form - Data object for HTML form.

SYNOPSIS
     use Data::HTML::Form;

     my $obj = Data::HTML::Form->new(%params);
     my $action = $obj->action;
     my $css_class = $obj->css_class;
     my $enctype = $obj->enctype;
     my $id = $obj->id;
     my $label = $obj->label;
     my $method = $obj->method;

METHODS
  "new"
     my $obj = Data::HTML::Form->new(%params);

    Constructor.

    *       "action"

            Form action.

            Default value is undef.

    *       "css_class"

            Form CSS class.

            Default value is undef.

    *       "enctype"

            Form enctype, attribute which specifies how the form-data should
            be encoded when submitting it to the server.

            Possible values are:

            *   (undefined - same as application/x-www-form-urlencoded)

            *   application/x-www-form-urlencoded

            *   multipart/form-data

            *   text/plain

            Default value is undef.

    *       "id"

            Form identifier.

            Default value is undef.

    *       "label"

            Form label.

            Default value is undef.

    *       "method"

            Form method.

            Default value is 'get'.

            Possible methods are: get and post

    Returns instance of object.

  "action"
     my $action = $obj->action;

    Get form action.

    Returns string.

  "css_class"
     my $css_class = $obj->css_class;

    Get CSS class for form.

    Returns string.

  "enctype"
     my $enctype = $obj->enctype;

    Get enctype, attribute which specifies how the form-data should be
    encoded when submitting it to the server.

    Returns string.

  "id"
     my $id = $obj->id;

    Get form identifier.

    Returns string.

  "label"
     my $label = $obj->label;

    Get form label.

    Returns string.

  "method"
     my $method = $obj->method;

    Get form method.

    Returns string.

ERRORS
     new():
             Parameter 'enctype' has bad value.
                     Value: %s
             Parameter 'method' has bad value.
                     Value: %s

EXAMPLE1
     use strict;
     use warnings;

     use Data::HTML::Form;

     my $obj = Data::HTML::Form->new;

     # Print out.
     print 'Method: '.$obj->method."\n";

     # Output:
     # Method: get

EXAMPLE2
     use strict;
     use warnings;

     use Data::HTML::Form;

     my $obj = Data::HTML::Form->new(
            'action' => '/action.pl',
            'css_class' => 'form',
            'enctype' => 'multipart/form-data',
            'id' => 'form-id',
            'label' => 'Form label',
            'method' => 'post',
     );

     # Print out.
     print 'Action: '.$obj->action."\n";
     print 'CSS class: '.$obj->css_class."\n";
     print 'Enctype: '.$obj->enctype."\n";
     print 'Id: '.$obj->id."\n";
     print 'Label: '.$obj->label."\n";
     print 'Method: '.$obj->method."\n";

     # Output:
     # Action: /action.pl
     # CSS class: form
     # Enctype: multipart/form-data
     # Id: form-id
     # Label: Form label
     # Method: post

DEPENDENCIES
    Error::Pure, List::Util, Mo, Readonly.

REPOSITORY
    <https://github.com/michal-josef-spacek/Data-HTML-Form>

AUTHOR
    Michal Josef Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    © 2022-2023 Michal Josef Špaček

    BSD 2-Clause License

VERSION
    0.08

About

Unmaintained, please use Data::HTML::Element::Form

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages