View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Ryan Alan Dietrich > Ravenel > Ravenel::Block



Annotate this POD


New  1
Open  0
View/Report Bugs

Ravenel::Block content within a tag ^

  <r:example_tag color="blue" length="25">
    <p>Default content {color} {length}</p>
    <block id="lucky_day"/>
    <p>It's your lucky day! {color} {length} {color}</p>

Quick overview..

This object is what is passed to a rendering routine that encompasses all of the various parsings that the engine has made to get you to this point. All of the methods of this object will let you retrieve different portions of a block, and provide an interface to manipulating them. The one thing you need to be aware of is the special tag "block" that allows you to create a boundary (similar to one that you would use in a checkout line in a grocery story). This block tag is totally non html compliant. There is no open or close of a block tag. I just made it a singleton. Sorry. The content that occurs up to the first block tag is the "default" block. Any method called with no arguments will simply call the default one (keep the simple stuff simple).

Methods ^


This will return the text that your function will deal with. In the example above....

    "<p>Default content {color} {length}</p>" = $block_obj->get_block();


    "<p>It's your lucky day! {color} {length} {color}</p>" = $block_obj->get_block('lucky_day');


These are the arguments passed in to Ravenel::Document. Keep in mind that altering this structure is a change that will carry forth for the rest of the document. This adds a fun new angle to the "depth" attribute I talked about back at the beginning (muahah). For a really trivial example of this check out test24_static.


These are the arguments to the tag itself, in our example's case...

  { 'color' => 'blue', 'length' => 25 } = $block_obj->get_tag_arguments();


So, let's get a new example first

  <r:example_tag color="blue" length="25" format>
    <p>Default content {color} {length}</p>
    <block id="lucky_day"/>
    <p>It's your lucky day! {color} {length} {color}</p>

Format will do all your replacements within a block. For now, things to be replaced are outlined with curly braces. In the future I might make this user definable. Here we go.

      '<p>Default content blue 25</p>'           = $block_obj->format( $block_obj->get_tag_arguments() );
      '<p>It's your lucky day! blue 25 blue</p>' = $block_obj->format( $block_obj->get_tag_arguments(), 'lucky_day' );

get_format_arguments (this is an internal function, that format calls, but I thought I'd mention it)

A tag with "format" as a tag argument will modify the block and generate "format arguments". It takes an argument, like getting a block.

  [ 'color', 'length' ] = $block_obj->get_format_arguments();

  [ 'color', 'length', 'color' ] = $block_obj->get_format_arguments('lucky_day');
syntax highlighting: