]>
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-12
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. Virtual path to which a link should be displayed (optional)
50 # 3. Hash reference: Template variables (optional)
52 # Return: Formatted message (Scalar Reference)
56 my ($message,$path,$vars) = @_;
58 my $tpl = new Template
;
59 $tpl->read_file($tpl_error);
61 $tpl->fillin("ERROR",$message);
62 $tpl->fillin("DIR",$path);
63 $tpl->fillin("SCRIPT",encode_entities
($ENV{'SCRIPT_NAME'}));
65 $tpl->parse_if_block("dir",defined $path);
67 if(ref($vars) eq "HASH")
69 while(my ($key,$value) = each(%$vars))
71 $tpl->fillin($key,$value);
75 my $output = header
(-type
=> "text/html");
76 $output .= $tpl->get_template;
83 # Print an error message and exit script
86 # Params: 1. Error message
87 # 2. Hash reference: Template variables (optional)
91 my $output = error
(shift,undef,shift);
patrick-canterino.de