|
PerlCodeLibrary - a selection of functions for use by perl code embedded in a WebMake file. |
PerlCodeLibrary - a selection of functions for use by perl code embedded in a WebMake file.
<{perl
$foo = get_content ($bar);
[... etc.]
# or:
$foo = $self->get_content ($bar);
[... etc.]
}>
These functions allow code embedded in a <{perl}> or <{perlout}> section of a WebMake file to be used to script the generation of content.
Each of these functions is defined both as a standalone function, or as a
function on the PerlCode object. Code in one of the <{perl*}> sections can
access this PerlCode object as the $self variable. If you plan to use
WebMake from mod_perl or in a threaded environment, be sure to call them as
methods on $self.
$pattern. If
$pattern begins with the prefix RE:, it is treated as a regular
expression. The list of items returned is not in any logical order.
HTML::WebMake::Content.
HTML::WebMake::Content.
HTML::WebMake::Content, convert to
the corresponding list of content name strings.
$sortstring.
See ''sorting.html'' in the WebMake documentation for details on
sort strings.
$pattern. The
list of items returned is ordered according to the sort string $sortstring.
If $pattern begins with the prefix RE:, it is treated as a regular
expression.
See ''sorting.html'' in the WebMake documentation for details on sort strings.
This, by the way, is essentially implemented as follows:
my @list = $self->content_matching ($pattern);
@list = $self->content_names_to_objects (@list);
@list = $self->sort_content_objects ($sortstring, @list);
return $self->content_objects_to_names (@list);
$name. Equivalent to a $ {content_reference}.
Returns the content object created.
Returns the content object created.
$upname should be the name of it's
parent content item. This item must not be metadata, or other
dynamically-generated content; only first-class mapped content can be used.
Returns the content object created.
$pattern. The names of the URLs, not the URLs themselves, are
returned. If $pattern begins with the prefix RE:, it is treated as a
regular expression.
@namelist, setting the content item
item to the current name, and interpreting the content chunk named
$itemname. This content chunk should refer to ${item} appropriately.
Each resulting block of content is appended to a $listtext, which is finally returned.
See the news_site.wmk sample site for an example of this in use.
Handler functions are called as fcllows:
handler ($tagname, $attrs, $text, $perlcode);
Where $tagname is the name of the tag, $attrs is a reference to a hash containing the attribute names and the values used in the tag, and $text is the text between the start and end tags.
$perlcode is the PerlCode object, allowing you to write proper object-oriented code that can be run in a threaded environment or from mod_perl. This can be ignored if you like.
This function returns an empty string.
The handler in this case is called with an empty string for the $text argument.
Aside from operating on the WebMake file instead of inside content items, this is otherwise identical to define_tag above,
Aside from operating on the WebMake file instead of inside content items, this is otherwise identical to define_tag above,
map attribute set to ``true''.
Note that this API should only be called from a deferred content reference; otherwise the ''main'' content item may not have been referenced by the time this API is called.
undef is returned if no main content item has been referenced.
HTML::WebMake::Main
object. Virtually all of WebMake's functionality and internals can be accessed
through this.
|
PerlCodeLibrary - a selection of functions for use by perl code embedded in a WebMake file. |