From a1cee8071f753b80daf374af4bad8458657dd07a Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 18 Apr 2012 03:37:55 +0200 Subject: wibble --- fripost-passwd | 11 +++++++++-- lib/Fripost/Schema.pm | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fripost-passwd b/fripost-passwd index 9ae47d9..d6abe3f 100755 --- a/fripost-passwd +++ b/fripost-passwd @@ -10,7 +10,7 @@ fripost-passwd - Change password of user =head1 SYNOPSIS -B [B<--debug>] [B<--pretend>] [I] +B [B<--verbose>] [B<--debug>] [B<--pretend>] [I] [B<--password=>I] =head1 DESCRIPTION @@ -60,6 +60,10 @@ The default value is read from the configuration file, see B. The root DN for everything done by B. The default value is read from the configuration file, see B. +=item B<-v>, B<--verbose> + +Verbose mode. + =item B<--debug> Debug mode. @@ -120,11 +124,14 @@ GetOptions( 'bind_pw=s' => \$conf->{bind_pw}, 'pretend' => \$conf->{pretend}, 'debug' => \$conf->{debug}, + 'v|verbose' => \$conf->{verbose}, 'password=s' => \$conf->{password}, 'man' => sub { pod2usage(-exitstatus => 0, -verbose => 2) } ) or pod2usage(2); +sub vsay { say STDERR @_ if $conf->{verbose} || $conf->{debug}; } + # Connect to the LDAP server my $ldap = Fripost::Schema->new( $conf ); @@ -149,7 +156,7 @@ die "Error: Unknown user `" .$username. "'.\n" if ($conf->{pretend}) { - say "Nothing to do since we are pretending..."; + vsay "Nothing to do since we are pretending..."; exit 0; } diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm index 288aa1e..14caccd 100755 --- a/lib/Fripost/Schema.pm +++ b/lib/Fripost/Schema.pm @@ -111,6 +111,7 @@ sub passwd { # Disconnect to the LDAP server. sub unbind { + $_[0]->_dsay( "Unbinding from the LDAP server." ); $_[0]->{_ldap}->unbind(); } @@ -120,7 +121,7 @@ sub _dsay { my $self = shift; return unless (exists $self->{_options}->{debug}) and $self->{_options}->{debug}; - print STDERR "Debug: "; + print STDERR "DEBUG: "; say STDERR @_; } -- cgit v1.2.3