100 likes | 316 Views
CGI::Panel. “Create sophisticated event-driven web applications from simple panel objects”. CGI::Panel. Different Approach Distribution of Logic Simple ‘driver’ CGI script + panel classes inherited from CGI::Panel Logical way to write an interface. Application Design. How this could look.
E N D
CGI::Panel “Create sophisticated event-driven web applications from simple panel objects”
CGI::Panel • Different Approach • Distribution of Logic • Simple ‘driver’ CGI script + panel classes inherited from CGI::Panel • Logical way to write an interface
How this could look • Could look like this:
Benefits • Clearly defined separation of code into easily manageable chunks • All the benefits of OO programming – inheritance, polymorphism, encapsulation • Reduced development time • Easy restructuring and maintenance • Application design is implicit in panel hierarchy • Panels are reusable
Provided free • Event trigger and distribution mechanism • Parameter distribution mechanism • Lightweight persistence • Access to ‘parent’ panel • Access to main panel
Events • Triggered by special button or link • Handled by the panel that generated the event • Access to localized parameter list
Parameters • Defined similarly to the CGI module • Special ‘get_localised_name’ method returns a name suitable for use in an HTML form • Panel-specific parameter list then obtained using ‘local_params’ method.
Persistence • Handled by Apache::Session • Complete panel hierarchy stored, along with any attached data • Transparent to the programmer (no extra code needed)
Standard CGI loop { Read http headers Process parameters Retrieve/set up state (Lots of ifs, elsifs etc) Output html } CGI::Panel Set up application loop { Respond to event Display each panel } Comparison