WebMake
WebMake Documentation (version 2.2)

HTML::WebMake::Content


NAME

Content - a content item.


SYNOPSIS

  <{perl
                                  

    $cont = get_content_object ("foo.txt");
    [... etc.]
                                  

  }>
                                  

DESCRIPTION

This object allows manipulation of WebMake content items directly.


METHODS

$text = $cont->get_name();

Return the content item's name.

$text = $cont->as_string();

A textual description of the object for debugging purposes; currently it's name.

$fname = $cont->get_filename();

Get the filename or datasource location that this content was loaded from. Datasource locations look like this: proto:protocol-specific-location-data, e.g. file:blah/foo.txt or http://webmake.taint.org/index.html.

@filenames = $cont->get_deps();

Return an array of filenames and locations that this content depends on, i.e. the filenames or locations that it contains variable references to.

$flag = $cont->is_generated_content();

Whether or not a content item was generated from Perl code, or is metadata. Generated content items cannot themselves hold metadata.

$val = $cont->expand()

Expand a content item, as if in a curly-bracket content reference. If the content item has not been expanded before, the current output file will be noted as the content item's ''main'' URL.

$val = $cont->expand_no_ref()

Expand a content item, as if in a curly-bracket content reference. The current output file will not be used as the content item's ''main'' URL.

$val = $cont->get_metadata($metaname);

Get an item of this object's metadata, e.g.

        $score = $cont->get_metadata("score");
                                                        

The metadatum is converted to its native type, e.g. score is return as an integer, title as a string, etc. If the metadatum is not provided, the default value for that item, defined in HTML::WebMake::Metadata, is used.

$score = $cont->get_score();

Return a content item's score.

$title = $cont->get_title();

Return a content item's title.

$modtime = $cont->get_modtime();

Return a content item's modification date, in UNIX time_t format, ie. seconds since Jan 1 1970.

$order = $cont->get_declared();

Returns the content item's declaration order. This is a number representing when the content item was first encountered in the WebMake file; earlier content items have a lower declaration order. Useful for sorting.

@kidobjs = $cont->get_kids ($sortstring);

Get the child content items for this item. The ''child'' content items are items that use this content as their up metadatum.

Returns a list of content objects in unsorted order.

@kidobjs = $cont->get_sorted_kids ($sortstring);

Get the child content items for this item. The ''child'' content items are items that use this content as their up metadatum.

Returns a list of content objects sorted by the provided sort string.

$text = $cont->get_url();

Get a content item's URL. The URL is defined as the first page listed in the WebMake file's out tags which refers to that item of content.

Note that, in some cases, the content item may not have been referred to yet by the time it's get_url() method is called. In this case, WebMake will insert a symbolic tag, hold the file in memory, and defer writing the file in question until all other output files have been processed and the URL has been found.

WebMake Documentation (version 2.2)
Built With WebMake