Revision: | 1.1.2.2.2.1.4.1 |
Committed: | Thu Oct 26 13:05:02 2000 UTC (24 years, 6 months ago) by williamc |
Content type: | text/plain |
Branch: | V0_16branch |
CVS Tags: | BuildSystemProto1, V0_18_0, V0_18_0model, V0_17_1, V0_18_0alpha, V0_17_0, V0_16_4, V0_16_3, V0_16_2, V0_16_1 |
Branch point for: | V0_17branch |
Changes since 1.1.2.2.2.1: | +7 -2 lines |
Log Message: | Add global variable setting to activate verbose mode |
# | Content |
---|---|
1 | # |
2 | # Verbose.pm |
3 | # |
4 | # Originally Written by Christopher Williams |
5 | # |
6 | # Description |
7 | # ----------- |
8 | # Simple multi parsing functionality |
9 | # |
10 | # Interface |
11 | # --------- |
12 | # new() : A new ActiveDoc object |
13 | # verbose(string) : Print string in verbosity mode |
14 | # verbosity(0|1) : verbosity off|on |
15 | |
16 | package Utilities::Verbose; |
17 | require 5.004; |
18 | |
19 | sub new { |
20 | my $class=shift; |
21 | $self={}; |
22 | bless $self, $class; |
23 | $self->verbose("New ".ref($self)." Created"); |
24 | return $self; |
25 | } |
26 | |
27 | sub verbosity { |
28 | my $self=shift; |
29 | if ( @_ ) { |
30 | $self->{verbose}=shift; |
31 | } |
32 | else { |
33 | my $id="VERBOSE_".ref($self); |
34 | if ( defined $ENV{$id} ) { |
35 | return $ENV{$id}; |
36 | } |
37 | } |
38 | $self->{verbose}; |
39 | } |
40 | |
41 | sub verbose { |
42 | my $self=shift; |
43 | my $string=shift; |
44 | |
45 | if ( $self->verbosity() ) { |
46 | print ">".ref($self)."($self) : \n->".$string."\n"; |
47 | } |
48 | } |
49 | |
50 | sub error { |
51 | my $self=shift; |
52 | my $string=shift; |
53 | |
54 | print $string."\n"; |
55 | exit 1; |
56 | } |