36 |
use 5.005_03; |
use 5.005_03; |
37 |
use Exporter; |
use Exporter; |
38 |
use Autom4te::ChannelDefs; |
use Autom4te::ChannelDefs; |
39 |
|
use Autom4te::Channels; |
40 |
use File::Basename; |
use File::Basename; |
|
use File::Spec; |
|
41 |
use File::stat; |
use File::stat; |
42 |
use IO::File; |
use IO::File; |
43 |
use Carp; |
use Carp; |
54 |
# Functions we define and export. |
# Functions we define and export. |
55 |
my @export_subs = |
my @export_subs = |
56 |
qw (&debug |
qw (&debug |
|
&file_name_is_absolute |
|
57 |
&getopt &mktmpdir |
&getopt &mktmpdir |
58 |
&uniq &verbose); |
&uniq); |
59 |
|
|
60 |
# Functions we forward (coming from modules we use). |
# Functions we forward (coming from modules we use). |
61 |
my @export_forward_subs = |
my @export_forward_subs = |
146 |
=cut |
=cut |
147 |
|
|
148 |
|
|
|
## ------------ ## |
|
|
## Prototypes. ## |
|
|
## ------------ ## |
|
|
|
|
|
sub verbose (@); |
|
|
|
|
149 |
|
|
150 |
## ----- ## |
## ----- ## |
151 |
## END. ## |
## END. ## |
240 |
} |
} |
241 |
|
|
242 |
|
|
|
=item C<file_name_is_absolute ($filename)> |
|
|
|
|
|
Wrapper around C<File::Spec->file_name_is_absolute>. Return true iff |
|
|
C<$filename> is absolute. |
|
|
|
|
|
=cut |
|
|
|
|
|
# $BOOLEAN |
|
|
# &file_name_is_absolute ($FILE) |
|
|
# ------------------------------ |
|
|
sub file_name_is_absolute ($) |
|
|
{ |
|
|
my ($file) = @_; |
|
|
return File::Spec->file_name_is_absolute ($file); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
243 |
=item C<getopt (%option)> |
=item C<getopt (%option)> |
244 |
|
|
245 |
Wrapper around C<Getopt::Long>. In addition to the user C<option>s, |
Wrapper around C<Getopt::Long>. In addition to the user C<option>s, |
286 |
|
|
287 |
push @ARGV, '-' |
push @ARGV, '-' |
288 |
if $stdin; |
if $stdin; |
289 |
|
|
290 |
|
setup_channel 'note', silent => !$verbose; |
291 |
|
setup_channel 'verb', silent => !$verbose; |
292 |
} |
} |
293 |
|
|
294 |
|
|
350 |
} |
} |
351 |
|
|
352 |
|
|
|
=item C<verbose (@message)> |
|
|
|
|
|
If the verbose mode is enabled (C<$verbose>), report the C<@message> |
|
|
on C<STDERR>, signed with the name of the program. These messages are |
|
|
meant for ordinary users, and typically make explicit the steps being |
|
|
performed. |
|
|
|
|
|
=cut |
|
|
|
|
|
# verbose(@MESSAGE) |
|
|
# ----------------- |
|
|
sub verbose (@) |
|
|
{ |
|
|
print STDERR "$me: ", @_, "\n" |
|
|
if $verbose; |
|
|
} |
|
|
|
|
|
|
|
353 |
=item C<handle_exec_errors ($command)> |
=item C<handle_exec_errors ($command)> |
354 |
|
|
355 |
Display an error message for C<$command>, based on the content of |
Display an error message for C<$command>, based on the content of |