]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
19fa2483c75aabd564c650ff355dd67ed3a82daa
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patrick@patshaping.de>
9 # Last modified: 2004-12-17
22 use base
qw(Exporter);
24 @EXPORT = qw(error_template
32 # Set the path to the template file used for error messages
35 # Params: Template file
44 # Format an error message
46 # Params: 1. Error message
47 # 2. Display a link to this path at the bottom of the page (optional)
48 # 3. Hash reference: Template variables (optional)
50 # Return: Formatted message (Scalar Reference)
54 my ($message,$path,$vars) = @_;
56 my $tpl = new Template
;
57 $tpl->read_file($tpl_error);
59 $tpl->fillin("ERROR",$message);
60 $tpl->fillin("BACK",$path);
61 $tpl->fillin("SCRIPT",encode_entities
($ENV{'SCRIPT_NAME'}));
63 $tpl->parse_if_block("dir",defined $path);
65 if(ref($vars) eq "HASH")
67 while(my ($key,$value) = each(%$vars))
69 $tpl->fillin($key,$value);
73 my $output = header
(-type
=> "text/html");
74 $output .= $tpl->get_template;
81 # Print an error message and exit script
84 # Params: 1. Error message
85 # 2. Display a link to this path at the bottom of the page (optional)
86 # 3. Hash reference: Template variables (optional)
90 my $output = error
(shift,shift,shift);
patrick-canterino.de