|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
# use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use Sources::Env;
use Sources::CGI;
use Sources::Global;
use Sources::Config;
use Sources::Authenticate;
use Sources::Session;
use Sources::MailShow;
use Sources::MailCompose;
use Sources::Cookie;
use Sources::Cleanup;
use Sources::Benchmark;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package Sources::MailCompose;
use strict;
use warnings;
use Sources::Global;
use Sources::Session;
use Sources::Config;
use Sources::Mail;
use Sources::MailShow;
use Sources::Uploader;
use Sources::Mime;
use Sources::SMTP;
...
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
my %Actions = (
login => {
libs => [
"Sources::Env",
"Sources::Global",
"Sources::Authenticate",
],
subs => [
\&Sources::Env::global_set,
\&Sources::Global::write_standardhttp_header,
\&Sources::Authenticate::write_loginmask,
],
},
);
sub handler
{
my ($obj) = @_;
my $action = lc($obj->{CGI}->getparam('action')) || 'login';
unless(exists $Actions{$action}->{subs}) { $action = 'login'; }
foreach my $lib (@{$Actions{$action}->{libs}})
{
require $lib;
}
foreach my $proc (@{$Actions{$action}->{subs}})
{
unless($proc->($obj))
{
# error in sub
last; # errorhandling
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
my %Actions = (
login => {
libs => [
"Sources/Env.pm",
"Sources/Global.pm",
"Sources/Authenticate.pm",
],
subs => [
\&Sources::Env::global_set,
\&Sources::Global::write_standardhttp_header,
\&Sources::Authenticate::write_loginmask,
],
},
);
...
foreach my $lib (@{$Actions{$action}->{libs}})
{
# eval "require $lib";
require $lib;
]
QuoteIf EXPR is a bareword, the require assumes a ".pm"
extension and replaces "::" with "/" in the
filename for you, to make it easy to load standard
modules.
QuoteIf no "import" method can be found then the call is skipped.
QuoteThe module can implement its "import" method any way it likes, though most modules just choose to derive their "import" method via inheritance[...]
|< 1 2 >| | 18 Einträge, 2 Seiten |