| 1 | # -*- perl -*- | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # $Id: MainAny.pm,v 1.4 2003/12/16 15:21:23 eserte Exp $ | ||||||||||||||||||||||||||||
| 5 | # Author: Slaven Rezic | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # Copyright (C) 2002 Online Office Berlin. All rights reserved. | ||||||||||||||||||||||||||||
| 8 | # Copyright (C) 2002 Slaven Rezic. | ||||||||||||||||||||||||||||
| 9 | # This is free software; you can redistribute it and/or modify it under the | ||||||||||||||||||||||||||||
| 10 | # terms of the GNU General Public License, see the file COPYING. | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||
| 13 | # Mail: slaven@rezic.de | ||||||||||||||||||||||||||||
| 14 | # WWW: http://we-framework.sourceforge.net | ||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | package WE_Frontend::MainAny; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use vars qw($VERSION $VERBOSE); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 3 | $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | ▶ | $VERBOSE = 0 if !defined $VERBOSE; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=45.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 0 | my($class, $root) = @_; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | my $get_wesiteinfo = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 29 | 0 | my $wesiteinfo = $INC{"WEsiteinfo.pm"}; | |||||||||||||||||||||||||||
| 30 | 0 | ▶ | if (!defined $wesiteinfo) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 0 | die "Strange: WEsiteinfo can be required, but is not recorded in \%INC"; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if (!-r $wesiteinfo) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | die "Strange: WEsiteinfo can be required, but the file $wesiteinfo is not accessible"; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | 0 | $wesiteinfo; | |||||||||||||||||||||||||||
| 37 | 0 | }; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # try for new implementation: | ||||||||||||||||||||||||||||
| 40 | 3 | ▶ | use vars qw($c); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 41 | 0 | require File::Spec; | |||||||||||||||||||||||||||
| 42 | 0 | my $err; | |||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | unless ($VERBOSE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | open(OLDERR, ">&STDERR"); | |||||||||||||||||||||||||||
| 46 | 0 | ▶ | open(STDERR, ">".File::Spec->devnull) or die $!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | 0 | eval 'use WEsiteinfo qw($c)'; | |||||||||||||||||||||||||||
| 49 | 0 | $err = $@; | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | if ($VERBOSE && $err) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$WE_Frontend::MainAny::VERBOSE and $err
MC/DC0%0/2
$WE_Frontend::MainAny::VERBOSE and $err
$WE_Frontend::MainAny::VERBOSE
$err
Truth table0%0/3
A and B
A= $WE_Frontend::MainAny::VERBOSEB= $err
| |||||||||||||||||||||||||||||
| 51 | 0 | warn "warn at line " . __LINE__ . ": " . $err; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | unless ($VERBOSE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | open(STDERR, ">&OLDERR"); | |||||||||||||||||||||||||||
| 55 | 0 | close OLDERR; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if (!$err) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | my $wesiteinfo = $get_wesiteinfo->(); | |||||||||||||||||||||||||||
| 60 | 0 | require WE_Frontend::Main2; | |||||||||||||||||||||||||||
| 61 | 0 | return WE_Frontend::Main->new(-root => $root, -config => $c); | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | # try for old implementation | ||||||||||||||||||||||||||||
| 65 | 0 | eval 'use WEsiteinfo qw($rootdir)'; | |||||||||||||||||||||||||||
| 66 | 0 | $err = $@; | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ($VERBOSE && $err) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$WE_Frontend::MainAny::VERBOSE and $err
MC/DC0%0/2
$WE_Frontend::MainAny::VERBOSE and $err
$WE_Frontend::MainAny::VERBOSE
$err
Truth table0%0/3
A and B
A= $WE_Frontend::MainAny::VERBOSEB= $err
| |||||||||||||||||||||||||||||
| 68 | 0 | warn "warn at line " . __LINE__ . ": " . $err; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if (!$err) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | require WE_Frontend::Main; | |||||||||||||||||||||||||||
| 72 | 0 | return WE_Frontend::Main->new($root); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | die $err; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 3 | 1; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | __END__ | ||||||||||||||||||||||||||||