summaryrefslogtreecommitdiff
path: root/examples/multifile.pl
blob: d04afee8308d0e7126fa110b51c7174e2be369b9 (plain)
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
#!/usr/bin/perl

# This example loads all code from MyWebsite/, which in contains either
# functions that are exported to the main object or TUWF::register() or
# TUWF::set() calls.

use strict;
use warnings;


# See examples/singlefile.pl for an explanation on what this does
use Cwd 'abs_path';
our $ROOT;
BEGIN { ($ROOT = abs_path $0) =~ s{/examples/multifile.pl$}{}; }
use lib $ROOT.'/lib';
use lib $ROOT.'/examples';


# load TUWF
use TUWF;

# load all modules under MyWebsite/
TUWF::load_recursive('MyWebsite');

# Let's enable debug mode
TUWF::set(debug => 1);

# And let's enable logging
# (Note that in practice you don't want to log to /tmp, I'll do it anyway to
# make this example easier to setup, since /tmp is supposed to be always
# writable from any process)
TUWF::set(logfile => '/tmp/tuwf-multifile-example.log');

# run TUWF
TUWF::run();