]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
5 # Dev-Editor - Module Output
7 # HTML generating routines
9 # Author: Patrick Canterino <patrick@patshaping.de>
10 # Last modified: 2005-05-10
12 # Copyright (C) 1999-2000 Roland Bluethgen, Frank Schoenmann
13 # Copyright (C) 2003-2009 Patrick Canterino
14 # All Rights Reserved.
16 # This file can be distributed and/or modified under the terms of
17 # of the Artistic License 1.0 (see also the LICENSE file found at
18 # the top level of the Dev-Editor distribution).
33 use base
qw(Exporter);
35 @EXPORT = qw(error_template
43 # Set the path to the template file used for error messages
46 # Params: Template file
55 # Format an error message
57 # Params: 1. Error message
58 # 2. Display a link to this path at the bottom of the page (optional)
59 # Please use the unencoded form of the string!
60 # 3. Hash reference: Template variables (optional)
62 # Return: Formatted message (Scalar Reference)
66 my ($message,$path,$vars) = @_;
68 my $tpl = new Template
;
69 $tpl->read_file($tpl_error);
71 $tpl->fillin('ERROR',$message);
73 $tpl->set_var('BACK',encode_html
($path));
74 $tpl->set_var('BACK_URL',escape
($path));
75 $tpl->set_var('SCRIPT',encode_html
($ENV{'SCRIPT_NAME'}));
77 $tpl->parse_if_block('dir',defined $path);
79 if(ref($vars) eq 'HASH')
81 while(my ($key,$value) = each(%$vars))
83 $tpl->set_var($key,$value);
89 my $output = header
(-type
=> 'text/html');
90 $output .= $tpl->get_template;
97 # Print an error message and exit script
100 # Params: 1. Error message
101 # 2. Display a link to this path at the bottom of the page (optional)
102 # 3. Hash reference: Template variables (optional)
106 my $output = error
(shift,shift,shift);
111 # it's true, baby ;-)
patrick-canterino.de