![]() |
|< 1 2 >| | ![]() |
18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
package Sources::MailCompose;
@ISA = qw( Sources::Global Sources::Session Sources::Config Session::MailShow);
use strict;
use warnings;
use Sources::Mail;
use Sources::Uploader;
use Sources::Mime;
use Sources::SMTP;
PerlRequire f:/apacheweb/8084_develop.perl-community.de/html/cgi-bin/mod_perl_startup.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /usr/bin/perl
# care for paths
BEGIN {
use vars qw($PATH_TO_CGI);
$PATH_TO_CGI = 'f:\apacheweb\8084_develop.perl-community.de\html\cgi-bin';
$ENV{PATH_TO_CGI} = 'f:\apacheweb\8084_develop.perl-community.de\html\cgi-bin';
}
use lib "$PATH_TO_CGI";
# load perl modules
use Apache::DBI;
use CGI;
use HTML::Template;
use Mail::RFC822::Address;
use HTML::Entities ();
use Regexp::Common qw(balanced);
use URI::Find::Schemeless ();
# use DBI ();
use Digest::MD5;
use File::Temp;
# load own PBoard-modules
use PBoard::Config;
use PBoard::Config;
use PBoard::Actions;
use PBoard::Subs;
use PBoard::User;
use PBoard::DB;
use PBoard::Posting;
my $dbh = Apache::DBI->connect_on_init
('DBI:mysql:' . &PBoard::Config::DATABASE_NAME,
&PBoard::Config::DATABASE_USER,
&PBoard::Config::DATABASE_PASSWORD,
)
or die "Error: couldn't connect to MySql: ", $DBI->errstr;
1;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
* cache - if set to 1 the module will cache in memory the parsed
templates based on the filename parameter and modification date
of the file. This only applies to templates opened with the
filename parameter specified, not scalarref or arrayref
templates. Caching also looks at the modification times of any
files included using <TMPL_INCLUDE> tags, but again, only if the
template is opened with filename parameter.
This is mainly of use in a persistent environment like
Apache/mod_perl. It has absolutely no benefit in a normal CGI
environment since the script is unloaded from memory after every
request. For a cache that does work for normal CGIs see the
'shared_cache' option below.
Note that different new() parameter settings do not cause a
cache refresh, only a change in the modification time of the
template will trigger a cache refresh. For most usages this is
fine. My simplistic testing shows that using cache yields a 90%
performance increase under mod_perl. Cache defaults to 0.
* shared_cache - if set to 1 the module will store its cache in
shared memory using the IPC::SharedCache module (available from
CPAN). The effect of this will be to maintain a single shared
copy of each parsed template for all instances of HTML::Template
to use. This can be a significant reduction in memory usage in a
multiple server environment. As an example, on one of our
systems we use 4MB of template cache and maintain 25 httpd
processes - shared_cache results in saving almost 100MB! Of
course, some reduction in speed versus normal caching is to be
expected. Another difference between normal caching and
shared_cache is that shared_cache will work in a CGI environment
- normal caching is only useful in a persistent environment like
Apache/mod_perl.
By default HTML::Template uses the IPC key 'TMPL' as a shared
root segment (0x4c504d54 in hex), but this can be changed by
setting the 'ipc_key' new() parameter to another 4-character or
integer key. Other options can be used to affect the shared
memory cache correspond to IPC::SharedCache options - ipc_mode,
ipc_segment_size and ipc_max_size. See IPC::SharedCache for a
description of how these work - in most cases you shouldn't need
to change them from the defaults.
For more information about the shared memory cache system used
by HTML::Template see IPC::SharedCache.
* double_cache - if set to 1 the module will use a combination of
shared_cache and normal cache mode for the best possible
caching. Of course, it also uses the most memory of all the
cache modes. All the same ipc_* options that work with
shared_cache apply to double_cache as well. By default
double_cache is off.
* blind_cache - if set to 1 the module behaves exactly as with
normal caching but does not check to see if the file has changed
on each request. This option should be used with caution, but
could be of use on high-load servers. My tests show blind_cache
performing only 1 to 2 percent faster than cache under mod_perl.
NOTE: Combining this option with shared_cache can result in
stale templates stuck permanently in shared memory!
* file_cache - if set to 1 the module will store its cache in a
file using the Storable module. It uses no additional memory,
and my simplistic testing shows that it yields a 50% performance
advantage. Like shared_cache, it will work in a CGI environment.
Default is 0.
If you set this option you must set the "file_cache_dir" option.
See below for details.
NOTE: Storable using flock() to ensure safe access to cache
files. Using file_cache on a system or filesystem (NFS) without
flock() support is dangerous.
![]() |
|< 1 2 >| | ![]() |
18 Einträge, 2 Seiten |