Moonshine::Element - Build some more html.
Version 0.05
use Moonshine::Element; my $base = Moonshine::Element->new( tag => 'div' ); my $child = $base->add_child({ tag => 'p' }); $child->add_before_element({ tag => 'span' }); $child->add_after_element({ tag => 'span' }); $base->render .......
OUTPUT: <div><span></span><p></p><span></span></div>
$base->$attribute($p_tag);
$base->$attribute; $base->{$attribute}
$base->has_$attribute;
$base->clear_$attribute;
html tag
Array, that holds the elements content, use text to join
elements can have children
Used when the element doesn't have a parent.
List containing all valid attributes (could change per element)
Unique Identifier
TODO actually apply some validation.
List of types the server accepts, typically a file type.
Valid Elements: form, input
List of supportsed charsets
Valid Elements: form
Defines a keyboard shortcut to activate or add focus to the element
Global
The URI of a program that processes the information submitted via the form
Specifies the horizontal alignment of the element
Valid Elements: applet caption col colgroup hr iframe img table tbody td tfoot th thead tr
Alternative text in case an image can't be displayed
Valid Elements: applet area img input
Indicates that the script should be executed asynchronously
Valid Elements: script
The element should be automatically focused after the page is loaded
Valid Elements: button input keygen select textarea
The audio or video should play as soon as possible
Valid Elements: audio video
Previous values should persist dropdowns of selectable values across page loads.
Valid Elements: input
Background color of the element, Note: This is a legacy attribute. Please use CSS background-color.
Valid Elements: body col colgroup marquee table tbody tfoot td th tr
The Border width. Note: This is a legacy attribute. Please use the CSS border property instead.
Valid Elements: img object table
Contains the time range of already buggered media
A challenge string that is submitted along with the public key
Valid Elements: keygen
Declares the character encoding of the page or script
Valid Elements: meta script
Indicates whether the element should be checked on page load
Valid Elements: command input
Contains a URI which points to the source of the quote or change
Valid Elements: blockquote
Specifies the URL of the applet's class file to be loaded and executed
Valid Elements: applet
This attribute gives the absolute or relative URL of the directory where applets' .class files referenced by the code attribute are stored.
This attribute sets the text color using either a named color or a color specified in the hexadecimal #RRGGBB format. Note: This is a legacy attribute. Please use the CSS color property instead.
Valid Elements: basefont font hr
Defines the number of columns in a textarea.
Valid Elements: textarea
The colspan attribute defines the number of columns a cell should span.
Valid Elements: td, th
A value associated with http-equiv or name depending on the context.
Valid Elements: meta
Indicates whether the element's content is editable."
Valid Elements: 'Global attribute'
Defines the ID of a <menu> element which will serve as the element's context menu.
Indicates whether the browser should show playback controls to the user.
Valid Elements: audio, video
A set of values specifying the coordinates of the hot-spot region.
Valid Elements: area
Indicates the date and time associated with the element.
Valid Elements: del ins time
Indicates that the track should be enabled unless the user's preferences indicate something different.
Valid Elements: track
Indicates that the script should be executed after the page has been parsed.
Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
Valid Elements: input, textarea
Indicates whether the user can interact with the element.
Valid Elements: button, command, fieldset, input, keygen, optgroup, option, select, textarea'
Indicates that the hyperlink is to be used for downloading a resource.
Valid Elements: a, area
Defines whether the element can be dragged.
Indicates that the element accept the dropping of content on it.
Defines the content type of the form date when the method is POST.
Describes elements which belongs to this one.
Valid Elements: label, output
Indicates the form that is the owner of the element.
Valid Elements: button, fieldset, input, keygen, label, meter, object, output, progress, select, textarea'
Indicates the action of the element, overriding the action defined in the form'
Valid Elements: input, button
IDs of the th elements which applies to this element.
Specifies the height of elements listed here. For all other elements, use the CSS height property. Note: In some instances, such as div, this is a legacy attribute, in which case the CSS height property should be used instead.
Valid Elements: canvas, embed, iframe, img, input, object>, video
Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
Indicates the lower bound of the upper range.
Valid Elements: meter
The URL of a linked resource.
Valid Elements: a, area, base, link
Specifies the language of the linked resource.
Valid Elements: a, area, link
Specifies a picture which represents the command.
Valid Elements: command
Often used with CSS to style a specific element. The value of this attribute must be unique.
Security Feature that allows browsers to verify what they fetch.A MDN Link
Valid Elements: link, script
Indicates that the image is part of a server-side image map.
Valid Elements: img
Specifies the type of key generated.
Valid Elements: 'keygen'
Specifies the kind of text track.
Specifies a user-readable title of the text track.
Defines the language used in the element.
Defines the script language used in the element.
Identifies a list of pre-defined options to suggest to the user.
Indicates whether the media should start playing from the start when it's finished.
Valid Elements: audio, bgsound, marquee, video
Indicates the upper bound of the lower range.
Specifies the URL of the document's cache manifest.
Valid Elements: html
Indicates the maximum value allowed.
Valid Elements: input, meter, progress
Defines the maximum number of characters allowed in the element.
Specifies a hint of the media for which the linked resource was designed.
Valid Elements: a, area, link, source, style
Defines which HTTP method to use when submitting the form. Can be GET (default) or POST .
Indicates the minimum value allowed.
Valid Elements: input, meter
Indicates whether multiple values can be entered in an input of the type email or file.
Valid Elements: input, select
Indicates whether the audio will be initially silenced on page load.
Valid Elements: video
Name of the element. For example used by the server to identify the fields in form submits.
Valid Elements: button, form, fieldset, iframe, input, keygen, object, output, select, textarea, map, meta, param
This attribute indicates that the form shouldn't be validated when submitted.
Indicates whether the details will be shown on page load.
Valid Elements: details
Indicates the optimal numeric value.
Defines a regular expression which the element's value will be validated against.
Provides a hint to the user of what can be entered in the field.
A URL indicating a poster frame to show until the user plays or seeks.
Indicates whether the whole resource, parts of it or nothing should be preloaded.
Indicates whether the element can be edited.
Specifies the relationship of the target object to the link object.
Indicates whether this element is required to fill out or not.
Valid Elements: input, select, textarea
Indicates whether the list should be displayed in a descending order instead of a ascending.
Valid Elements: ol
Defines the number of rows in a text area.
Valid Elements: 'textarea'
Defines the number of rows a table cell should span over.
Valid Elements: iframe
Valid Elements: th
Valid Elements: style
Defines a value which will be selected on page load.
Valid Elements: option
Defines the width of the element (in pixels). If the element's type attribute is text or password then it's the number of characters.
Valid Elements: link, img, source
Valid Elements: col, colgroup
Indicates whether spell checking is allowed for the element.
Valid Elements: Global attribute
The URL of the embeddable content.
Valid Elements: audio, embed, iframe, img, input, script, source, track, video
Defines the first number if other than 1.
Valid input
Defines CSS styles which will override styles previously set.
Valid Elements: table
Overrides the browser's default tab order and follows the one specified instead.
Valid Elements: a, area, base, form
Text to be displayed in a tooltip when hovering over the element.
Defines the type of the element.
Valid Elements: button, input, command, embed, object, script, source, style, menu
Valid Elements: img, input, object
Defines a default value which will be displayed in the element on page load.
Valid Elements: button, option, input, li, meter, progress, param
For the elements listed here, this establishes the element's width. Note: For all other instances, such as <div> , this is a legacy attribute, in which case the CSS width a property should be used instead.
Valid Elements: canvas, embed, iframe, img, input, object, video'
Indicates whether the text should be wrapped.
Accepts a Hash reference that is used to build a new Moonshine::Element which is pushed into that elements children attribute.
$base->add_child( { tag => 'div' .... } );
Accepts a Hash reference that is used to build a new Moonshine::Element, if the current element has a parent, we slice in the new element before the current. If no parent exists the new element is pushed in the before_element attribute.
$base->add_before_element( { tag => 'div', .... } );
Accepts a Hash reference that is used to build a new Moonshine::Element, if the current element has a parent, we slice in the new element after the current. If no parent exists the new element is pushed in the after_element attribute.
$base->add_after_element( { tag => 'div', .... } );
Render the Element as html.
$base->render;
All attributes set on an 'Element' will be rendered. There is currently no Attribute to Element validation.
Html attributes can be HashRef's (keys sorted and values joined), ArrayRef's(joined), or just Scalars.
Robert Acock <ThisUsedToBeAnEmail@gmail.com>
Copyright 2016 Robert Acock.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install Moonshine::Element, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moonshine::Element
CPAN shell
perl -MCPAN -e shell install Moonshine::Element
For more information on module installation, please visit the detailed CPAN module installation guide.