]>
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: 2011-02-11
11 # Copyright (C) 1999-2000 Roland Bluethgen, Frank Schoenmann
12 # Copyright (C) 2003-2011 Patrick Canterino
13 # All Rights Reserved.
15 # This file can be distributed and/or modified under the terms of
16 # of the Artistic License 2.0 (see also the LICENSE file found at
17 # the top level of the Dev-Editor distribution).
32 use base
qw(Exporter);
34 @EXPORT = qw(error_template
42 # Set the path to the template file used for error messages
45 # Params: Template file
54 # Format an error message
56 # Params: 1. Error message
57 # 2. Display a link to this path at the bottom of the page (optional)
58 # Please use the unencoded form of the string!
59 # 3. Hash reference: Template variables (optional)
61 # Return: Formatted message (Scalar Reference)
65 my ($message,$path,$vars) = @_;
67 my $tpl = new Template
;
68 $tpl->read_file($tpl_error);
70 $tpl->fillin('ERROR',$message);
71 $tpl->fillin('BACK',encode_html
($path));
72 $tpl->fillin('BACK_URL',escape
($path));
73 $tpl->fillin('SCRIPT',encode_html
($ENV{'SCRIPT_NAME'}));
75 $tpl->parse_if_block('dir',defined $path);
77 if(ref($vars) eq 'HASH')
79 while(my ($key,$value) = each(%$vars))
81 $tpl->fillin($key,$value);
85 my $output = header
(-type
=> 'text/html');
86 $output .= $tpl->get_template;
93 # Print an error message and exit script
96 # Params: 1. Error message
97 # 2. Display a link to this path at the bottom of the page (optional)
98 # 3. Hash reference: Template variables (optional)
102 my $output = error
(shift,shift,shift);
107 # it's true, baby ;-)
patrick-canterino.de