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

NAME

CGI::AppBuilder::Frame - Configuration initializer

SYNOPSIS

  use CGI::AppBuilder::Frame;

  my $ab = CGI::AppBuilder::Frame->new(
     'ifn', 'my_init.cfg', 'opt', 'vhS:a:');
  my ($q, $ar, $ar_log) = $ab->start_app($0, \%ARGV);
  print $ab->disp_form($q, $ar); 

DESCRIPTION

This class provides methods for reading and parsing configuration files.

new (ifn => 'file.cfg', opt => 'hvS:')

This is a inherited method from CGI::AppBuilder. See the same method in CGI::AppBuilder for more details.

frame_set ($q, $fr, $pr)

Input variables:

  $fr - frame set definiton array reference. The $fr contains two
        elements [$hr, $ar]: 
        $hr - a hash ref containing the frame set attributes
        $ar - a array ref containing hash references defining each
              frames in the frame set.
  $pr  - tag attribute array ref. It contains three elements:
    class - CSS class name
    attr  - attribute string such as 'width=5 onChange=js_func'
    hr    - hash ref with key and value pairs. This will be obtained
            from $fr for each frame set and frame.
    pretty - whether to add line breaks 

Variables used or methods called:

  CGI::AppBuilder::Table
    html_tag - generate HTML tags
  CGI::AppBuilder::Message
    echo_msg - display message

How to use:

The following shows how to define the frame array ($fr):

  +-+----+    The following defines the left layout:
  | | T  |    
  | +----+    [{cols=>"150,*"},[     
  | |    |       {src=>"left.htm",name=>"L"},  
  |L| C  |      [{rows=>"100,*,50"},[           
  | |    |         {src=>"top.htm",name=>"T"},   
  | |----|         {src=>"main.htm",name=>"C"},
  | | B  |         {src=>"bottom.htm",name=>"B"}]]]
  +-+----+    ]

In YAML, here is how it looks like:

  ---
  cols: 150,\*
    - src: left.htm
      name: L
    - rows: 100,\*,50
      - src: top.htm
        name: T
      - src: main.htm
        name: C
      - src: bottom.htm
        name: B
  ...

  +-+------+  The following defines the left layout:
  | |  T   |  
  | +----+-+  [{cols=>"150,*"},[     
  | |    | |     {src=>"left.htm",name=>"L"},  
  |L| C  |R|     [{rows=>"100,*,50"},[           
  | |    | |       {src=>"top.htm",name=>"T"},   
  | |    | |       [{cols=>"*,100"},[
  | |----+-+         {src=>"main.htm",name=>"C"},
  | |      |         {src=>"right.htm",name=>"R"}] ] ],
  | |   B  |       {src=>"bottom.htm",name=>"B"}]]
  +-+----+-+  ]

In YAML, here is how it looks like:

  ---
  cols: 150,\*
    - src: left.htm
      name: L
    - rows: 100,\*,50
      - src: top.htm
        name: T
      - cols: \*,100
        - src: main.htm
          name: C
        - src: right.htm
          name: R
      - src: bottom.htm
        name: B
  ...

Here is the testing codes:

  my $fr = [{cols=>"150,*"},[
            {src=>"left.htm",name=>"L"},
           [{rows=>"100,*,50"},[
               {src=>"top.htm",name=>"T"},
               {src=>"main.htm",name=>"C"},
               {src=>"bottom.htm",name=>"B"}]
           ]]
         ];
  my $pr = {pretty=>1};
  print $obj->frame_set($fr,$pr);
  # the following is the result:

  <FRAMESET cols='150,*'>
    <FRAME src='left.htm' name='L'>
    <FRAMESET rows='100,*,50'>
      <FRAME src='top.htm' name='T'>
      <FRAME src='main.htm' name='C'>
      <FRAME src='bottom.htm' name='B'>
    </FRAMESET>
  </FRAMESET>

  $pr->{_frameset_count} = 0;  # reset frame set counter
  my $f2 = [ {cols=>"150,*"},[
             {src=>"left.htm",name=>"L"},
            [{rows=>"100,*,50"},[
               {src=>"top.htm",name=>"T"},
              [{cols=>"*,100"},[
                 {src=>"main.htm",name=>"C"},
                 {src=>"right.htm",name=>"R"}]
              ],
               {src=>"bottom.htm",name=>"B"}]
            ]]
     ];
  print $obj->frame_set($f2,$pr);
  # the following is the result:

  <FRAMESET cols='150,*'>
    <FRAME src='left.htm' name='L'>
    <FRAMESET rows='100,*,50'>
      <FRAME src='top.htm' name='T'>
      <FRAMESET cols='*,100'>
        <FRAME src='main.htm' name='C'>
        <FRAME src='right.htm' name='R'>
      </FRAMESET>
      <FRAME src='bottom.htm' name='B'>
    </FRAMESET>
  </FRAMESET>

Return: HTML codes.

This method generates HTML codes based on the information provided. This method is also called <I>frameset</I>.

HISTORY

  • Version 0.10

    This version includes the frame_set method.

  • Version 0.20

SEE ALSO (some of docs that I check often)

Oracle::Loader, Oracle::Trigger, CGI::Getopt, File::Xcopy, CGI::AppBuilder, CGI::AppBuilder::Message, CGI::AppBuilder::Log, CGI::AppBuilder::Config, etc.

AUTHOR

Copyright (c) 2005 Hanming Tu. All rights reserved.

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 252:

You forgot a '=back' before '=head1'