ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Utilities/Verbose.pm
Revision: 1.3
Committed: Wed Nov 15 10:20:07 2000 UTC (24 years, 5 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: V0_19_0, V0_18_5, V0_18_4, V_18_3_TEST, VO_18_3, V0_18_2, V0_18_1
Changes since 1.2: +7 -2 lines
Log Message:
IMport from V0_18_0

File Contents

# User Rev Content
1 williamc 1.2 #
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 williamc 1.3 else {
33     my $id="VERBOSE_".ref($self);
34     if ( defined $ENV{$id} ) {
35     return $ENV{$id};
36     }
37     }
38 williamc 1.2 $self->{verbose};
39     }
40    
41     sub verbose {
42     my $self=shift;
43     my $string=shift;
44    
45 williamc 1.3 if ( $self->verbosity() ) {
46 williamc 1.2 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     }