]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patrick@patshaping.de>
9 # Last modified: 2005-04-22
24 use base
qw(Exporter);
26 @EXPORT = qw(error_template
34 # Set the path to the template file used for error messages
37 # Params: Template file
46 # Format an error message
48 # Params: 1. Error message
49 # 2. Display a link to this path at the bottom of the page (optional)
50 # Please use the unencoded form of the string!
51 # 3. Hash reference: Template variables (optional)
53 # Return: Formatted message (Scalar Reference)
57 my ($message,$path,$vars) = @_;
59 my $tpl = new Template
;
60 $tpl->read_file($tpl_error);
62 $tpl->fillin('ERROR',$message);
63 $tpl->fillin('BACK',encode_html
($path));
64 $tpl->fillin('BACK_URL',escape
($path));
65 $tpl->fillin('SCRIPT',encode_html
($ENV{'SCRIPT_NAME'}));
67 $tpl->parse_if_block('dir',defined $path);
69 if(ref($vars) eq 'HASH')
71 while(my ($key,$value) = each(%$vars))
73 $tpl->fillin($key,$value);
77 my $output = header
(-type
=> 'text/html');
78 $output .= $tpl->get_template;
85 # Print an error message and exit script
88 # Params: 1. Error message
89 # 2. Display a link to this path at the bottom of the page (optional)
90 # 3. Hash reference: Template variables (optional)
94 my $output = error
(shift,shift,shift);
patrick-canterino.de