HTML::SiteTear::Item(3)

NAME
HTML::SiteTear::Item - treat javascript files, image files and so on.

SYMPOSIS
 use HTML::SiteTear::Item;

 $item = HTML::SiteTear::Item->new($parent, $source_path, $kind);
 $item->linkpath($path); # usually called from the mothod "change_path"
                         # of the parent object.
 $item->copy_to_linkpath;
 $item->copy_liked_files;

DESCRIPTION
This module is to treat general files liked from web pages. It's also a super class of HTML::SiteTear::Page, HTML::SiteTear::CSS. Internal use only.

METHODS

  new
    $item = HTML::SiteTear::Item->new('parent' => $parent,
                                      'source_path' => $source_path,
                                      'kind' => $kind);

Make an instance of this moduel. $parent must be an instance of HTML::SiteTear::Root or HTML::SiteTear::Page. This method is called from $parent.

  copy_to_linkpath
    $item->copy_to_linkpath;

Copy $source_path into new linked path from $parent.

  add_to_linked_files
    $item->add_to_linked_files($linked_obj)

Add $linked_obj into the internal list. in $linked_obj is an instance of HTML::SiteTear::Item or subclass of HTML::SiteTear::Item for linked files from $source_path.

  change_path
    $new_linkpath = $item->change_path($linkpath, $folder_name, $kind)

make a new link path from a link path($linkpath) in $source_path. $folder_name is folder name to store, if $linkpath is not under $source_path.

  copy_linked_files
    $item->copy_linked_files();

Call method "copy_to_linkpath()" of every object added by "addToLikedFiles($linked_obj)".

  add_to_copyied_files
    $item->add_to_copyied_files($source_path);

Add a file path already copied to the copiedFiles table of the root object of the parent chain.

  exists_in_copied_files
    $item->exists_in_copied_files($source_path);

Check existance of $source_path in the copiedFiles entry.

  add_to_filemap
    $item->add_to_filemap($source_path, $target_path);

Add a relation between $source_path and $target_path to the internal table of the root object of the parent chain.

  exists_in_filemap
    $bool = $item->exists_in_filemap($source_path);

Check existance of $source_path in the internal table the root object of parent chain.

  source_root_path
    $source_root_path = $item->source_root_path;

Get the root source path which is an argument of HTML::SiteTear::CopyTo.

  rel_for_mappedfile
    $relativePath = $item->rel_for_mappedfile($source_path, $base_uri);

Get a relative link of the target path corresponding to $source_path based from $base_uri.

  source_path
    $item->source_path;
    $item->source_path($path);

Get and set the source path of this objcet.

  target_path
    $item->taget_path;
    $item->target_path($path);

Get and set the target path which is the copy destination of $source_path. This method is called from "copy_to_linkpath()". Before calling this method, $path must be exists.

  linkpath
    $item->linkpath;
    $item->linkpath($path);

Get and set the new link path from $parent. Usually called from the method "change_path" of the parent object.

  page_folder_name
    $item->page_folder_name;
    $item->page_folder_name('pages');

Get and set name of a folder to store HTML files linked from $source_path. If $item does not have the name, $parent give the name.

  resource_folder_name
    $item->resource_folder_name;
    $item->resource_folder_name('assets');

Get and set name of a folder to store not HTML files(javascript, image, CSS) linked from $source_path. If $item does not have the name, $parent gives the name.

SEE ALSO
HTML::SiteTear, HTML::SiteTear::Page, HTML::SiteTear::CSS, HTML::SiteTear::Root

AUTHOR
Tetsuro KURITA <tkurita@mac.com>