[LDAPsh-cvs] ldapsh ldapsh,1.29,1.30
Status: Beta
Brought to you by:
rcorvalan
From: <j-d...@us...> - 2003-11-06 03:46:55
|
Update of /cvsroot/ldapsh/ldapsh In directory sc8-pr-cvs1:/tmp/cvs-serv13311 Modified Files: ldapsh Log Message: The 'set' command can now display read-only variables (upon request). Add PERL_RL as a user-readable variable (read-only). Index: ldapsh =================================================================== RCS file: /cvsroot/ldapsh/ldapsh/ldapsh,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ldapsh 6 Nov 2003 03:36:02 -0000 1.29 --- ldapsh 6 Nov 2003 03:46:52 -0000 1.30 *************** *** 283,286 **** --- 283,287 ---- my ($CWD, $PROMPT, $CONNPARAMS, $LDAPCONN, $ENTRIES, $EDITOR, $COLUMNS, $DNSEP, $G); + my ($PERL_RL); # read-only values my ($Term, $TermAttribs); *************** *** 312,315 **** --- 313,321 ---- sub _InitReadLine { $Term = new Term::ReadLine('LDAPShell', \*STDIN, \*STDERR); + + $Globals->{PERL_RL} = { VALUE => $Term->ReadLine, RIGHTS => 'RL' }; + $Globals->{PERL_RL}{VALUE} =~ s/^Term::ReadLine:://; + eval(sprintf(q{tie ${%s}, 'Tie::Scalar::Hash', $Globals, '%s'}, 'PERL_RL', 'PERL_RL')) || warn $@; + _ReadHistory(); $TermAttribs = $Term->Attribs; *************** *** 965,978 **** =head3 set ! Display the names and values of the global variables you can set. The purpose of this function is to help the user to remember the names of the variables he can set. =cut ! sub set() { my $oldterse = $Data::Dumper::Terse; $Data::Dumper::Terse = 1; foreach (keys %$Globals) { next if /^_/ or not $Globals->{$_}{RIGHTS} =~ /l/i; ! printf {$Output->{FILEHANDLE}} "\$%s = %s\n", $_, Dumper($Globals->{$_}{VALUE}); } $Data::Dumper::Terse = $oldterse; --- 971,991 ---- =head3 set ! B<Synopsis>: C<set ['-a']> ! ! Display the names and values of the global variables you can set. The purpose of this function is to help the user to remember the names of the variables he can set. The C<-a> parameter allows read-only values to be seen. =cut ! sub set { ! my $showall = (scalar(@_) and shift =~ /-a/); ! my $canwrite; my $oldterse = $Data::Dumper::Terse; $Data::Dumper::Terse = 1; foreach (keys %$Globals) { next if /^_/ or not $Globals->{$_}{RIGHTS} =~ /l/i; ! $canwrite = $Globals->{$_}{RIGHTS} =~ /w/i; ! next if not $canwrite and not $showall; ! # Read-only values are displayed with == instead of = ! printf {$Output->{FILEHANDLE}} "\$%s =%s %s\n", $_, $canwrite ? '' : '=', Dumper($Globals->{$_}{VALUE}); } $Data::Dumper::Terse = $oldterse; |