]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patshaping@gmx.net>
9 # Last modified: 2004-03-04
24 use base
qw(Exporter);
26 @EXPORT = qw(error_template
35 # Set the path to the template file used for error messages
38 # Params: Template file
47 # Format an error message
49 # Params: 1. Error message
50 # 2. Virtual path to which a link should be displayed (optional)
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("DIR",$path);
64 $tpl->fillin("SCRIPT",encode_entities
($ENV{'SCRIPT_NAME'}));
66 $tpl->parse_if_block("dir",defined $path);
68 if(ref($vars) eq "HASH")
70 while(my ($key,$value) = each(%$vars))
72 $tpl->fillin($key,$value);
76 my $output = header
(-type
=> "text/html");
77 $output .= $tpl->get_template;
84 # Print an error message and exit script
87 # Params: 1. Error message
88 # 2. Hash reference: Template variables (optional)
92 my $output = error
(shift,undef,shift);
patrick-canterino.de