NAME

Yukki::Web::Response - the response to the client

VERSION

version 0.991_005

DESCRIPTION

An abstraction around the HTTP response that is astonishingly similar to Plack::Response. Call finalize to get the final PSGI response.

ATTRIBUTES

response

This is the internal Plack::Response object. Do not use.

Use the delegated methods instead:

status headers body header content_type content_length content_encoding
redirect location cookies finalize

page_title

This is the title to give the page in the HTML.

This is the navigation menu to place in the page. This is an array of hashes. Each entry should look like:

{
    label => 'Label',
    href  => '/link/to/somewhere',
    sort  => 50,
}

A sorted list of items is retrieved using "navigation_menu". New items can be added with the "add_navigation_item" and "add_navigation_items" methods.

This is the breadcrumb to display. It is an empty array by default (meaning no breadcrumb). Each element of the breadcrumb is formatted like navigation, except that sort is not used here.

METHODS

my @items = $response->navigation_menu('repository');

Returns a sorted list of navigation items for the named menu.

add_navigation_item

add_navigation_items

$response->add_navigation_item(menu_name => {
    label => 'Link Title',
    url   => '/path/to/some/place',
    sort  => 50,
});

Add one or more items to the named menu. The first argument is always the name or names of the menu. Mutliple names may be given in an array reference. If multiple names are given, the menu items given will be added to each menu named. The remaining arguments are hash references that must have a label and a url. The sort is optional.

"add_navigation_item" is a synonym for "add_navigation_items".

Convenience accessor that returns breadcrumbs as a list.

has_breadcrumb

Returns a true value if breadcrumbs has any items in it.

has_page_title

Returns a true value if page_title is set.

Convenience accessor that returns navigation as a list.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.