Revision: | 1.6.10.1 |
Committed: | Wed Feb 20 20:32:54 2008 UTC (17 years, 2 months ago) by muzaffar |
Content type: | text/plain |
Branch: | forBinLess_SCRAM |
CVS Tags: | V2_2_2, V2_2_2_pre4, V2_2_2_pre3, V2_2_2_pre2, V2_2_2_pre1, V2_2_2-pre1, V2_2_1, forV2_2_1, V2_2_0, sm100112, V2_1_4, V2_1_3, V2_1_2, V2_1_1, V2_1_0, V2_0_6, V2_0_5, V2_0_4, V2_0_4_relcand2, V2_0_4_relcand1, V2_0_3, V2_0_3_relcand3, V2_0_3_relcand2, V2_0_3_relcand1, V2_0_2, V2_0_2_relcand1, V2_0_1, V1_2_1b, V1_2_1a, V2_0_1_relcand4, V2_0_1_relcand3, V2_0_1_relcand2, V2_0_1_relcand1, V2_0_0_relcand4, V1_2_3, V2_0_0, V1_2_2, V1_2_2_relcand2, V1_2_2_relcand1, V2_0_0_relcand3, V2_0_0_relcand2, V2_0_0_relcand1, V1_2_1, V1_2_0, V1_2_0-cand11, V1_2_0-cand10, V1_2_0-cand9, V1_2_0-cand8 |
Branch point for: | SCRAM_V2_0 |
Changes since 1.6: | +3 -0 lines |
Log Message: | added 1; at the end of perl modules |
# | Content |
---|---|
1 | =head1 NAME |
2 | |
3 | Utilities::Verbose - Add verbosity to the current package. |
4 | |
5 | =head1 DESCRIPTION |
6 | |
7 | Provide a verbosity framework. |
8 | |
9 | =head1 METHODS |
10 | |
11 | =over |
12 | |
13 | =cut |
14 | |
15 | =item C<new()> |
16 | |
17 | A new Verbose object. |
18 | |
19 | =item C<verbose(string)> |
20 | |
21 | Print string in verbosity mode. |
22 | |
23 | =item C<verbosity($sw)> |
24 | |
25 | Turn verbosity on or off ($sw is 0 or 1). |
26 | |
27 | =back |
28 | |
29 | =head1 AUTHOR |
30 | |
31 | Originally Written by Christopher Williams. |
32 | |
33 | =head1 MAINTAINER |
34 | |
35 | Shaun ASHBY |
36 | |
37 | =cut |
38 | |
39 | package Utilities::Verbose; |
40 | require 5.004; |
41 | |
42 | sub new { |
43 | my $class=shift; |
44 | $self={}; |
45 | bless $self, $class; |
46 | $self->verbose("New ".ref($self)." Created"); |
47 | return $self; |
48 | } |
49 | |
50 | sub verbosity { |
51 | my $self=shift; |
52 | if ( @_ ) { |
53 | $self->{verbose}=shift; |
54 | } |
55 | else { |
56 | my $id="VERBOSE_".ref($self); |
57 | if ( defined $ENV{$id} ) { |
58 | return $ENV{$id}; |
59 | } |
60 | } |
61 | $self->{verbose}; |
62 | } |
63 | |
64 | sub verbose { |
65 | my $self=shift; |
66 | my $string=shift; |
67 | |
68 | if ( $self->verbosity() ) { |
69 | print ">".ref($self)."($self) : \n->".$string."\n"; |
70 | } |
71 | } |
72 | |
73 | sub error { |
74 | my $self=shift; |
75 | my $string=shift; |
76 | |
77 | print $string."\n"; |
78 | exit 1; |
79 | } |
80 | |
81 | 1; |
82 |