The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

YUI::MenuBar::Markup::YAML - Provides the menu content from a YAML file

DESCRIPTION

It reads a YAML file, gets the content and returns it so that YUI::MenuBar::Markup can use it for building YUI menu.

It uses YAML::Syck for reading the YAML file.

An example of a YAML file can be:

    menu:
        -
            name: Searchers
            menu:
                -
                    name: Yahoo!
                    link: http://search.yahoo.com
                -
                    name: Google
                    link: http://www.google.com
                -
                    name: Altavista
                    link: http://www.altavista.com
        -
            name: Mail
            menu:
                -
                    name: Yahoo Mail!
                    link: http://mail.yahoo.com
                -
                    name: Gmail
                    link: http://gmail.com
                -

And so on, for any additional sub-menu you should just declare a new menu: and then list the items of it.

Valid items or any menu item are:

  • name: The name (text) of the item.

  • link: The link where the item will be pointing

  • menu: In case the item will have sub-items

Attributes

filename

YAML path filename

Methods

get_data()

Opens the YAML file (see filename) and looks for the first menu item, once its found then all of its items are returned.

The method is called by YUI::MenuBar::Markup.

AUTHOR

Pablo Fischer (pablo@pablo.com.mx).

COPYRIGHT

Copyright (C) 2010 by Pablo Fischer.

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