| 1 | # | ||
| 2 | # $Id$ | ||
| 3 | # | ||
| 4 | # core::global Brik | ||
| 5 | # | ||
| 6 | package Metabrik::Core::Global; | ||
| 7 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | # Breaking.Feature.Fix | ||
| 11 | our $VERSION = '1.41'; | ||
| 12 | our $FIX = '0'; | ||
| 13 | |||
| 14 | 2 | ▶ | use base qw(Metabrik); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | sub brik_properties { | ||
| 17 | return { | ||
| 18 | revision => '$Revision$', | ||
| 19 | tags => [ qw(main core) ], | ||
| 20 | attributes => { | ||
| 21 | device => [ qw(device) ], | ||
| 22 | family => [ qw(ipv4|ipv6) ], | ||
| 23 | protocol => [ qw(udp|tcp) ], | ||
| 24 | ctimeout => [ qw(seconds) ], | ||
| 25 | rtimeout => [ qw(seconds) ], | ||
| 26 | wtimeout => [ qw(seconds) ], | ||
| 27 | datadir => [ qw(directory) ], | ||
| 28 | username => [ qw(username) ], | ||
| 29 | hostname => [ qw(hostname) ], | ||
| 30 | homedir => [ qw(directory) ], | ||
| 31 | # encoding: see `perldoc Encode::Supported' for other types | ||
| 32 | encoding => [ qw(utf8|ascii) ], | ||
| 33 | exit_on_sigint => [ qw(0|1) ], | ||
| 34 | pid => [ qw(metabrik_main_pid) ], | ||
| 35 | repository => [ qw(repository) ], | ||
| 36 | }, | ||
| 37 | attributes_default => { | ||
| 38 | device => 'eth0', | ||
| 39 | family => 'ipv4', | ||
| 40 | protocol => 'tcp', | ||
| 41 | ctimeout => 5, | ||
| 42 | rtimeout => 5, | ||
| 43 | wtimeout => 5, | ||
| 44 | username => $ENV{USER} || 'root', | ||
| 45 | hostname => $ENV{HOST} || 'localhost', | ||
| 46 | homedir => $ENV{HOME} || '/tmp', | ||
| 47 | encoding => 'utf8', | ||
| 48 | exit_on_sigint => 0, | ||
| 49 | pid => $$, | ||
| 50 | }, | ||
| 51 | require_modules => { | ||
| 52 | 'File::Path' => [ qw(make_path) ], | ||
| 53 | }, | ||
| 54 | }; | ||
| 55 | } | ||
| 56 | |||
| 57 | sub brik_use_properties { | ||
| 58 | my $self = shift; | ||
| 59 | |||
| 60 | my $homedir = $ENV{HOME} || '/tmp'; | ||
| 61 | my $datadir = $homedir.'/metabrik'; | ||
| 62 | my $repository = $homedir.'/metabrik/repository'; | ||
| 63 | |||
| 64 | eval("use File::Path qw(make_path);"); | ||
| 65 | File::Path::make_path($homedir, $datadir, $repository, { | ||
| 66 | mode => 0755, | ||
| 67 | }); | ||
| 68 | |||
| 69 | return { | ||
| 70 | attributes_default => { | ||
| 71 | homedir => $homedir, | ||
| 72 | datadir => $datadir, | ||
| 73 | repository => $repository, | ||
| 74 | }, | ||
| 75 | }; | ||
| 76 | } | ||
| 77 | |||
| 78 | 1; | ||
| 79 | |||
| 80 | __END__ | ||