=================================================================== RCS file: /cvs/palm/Palm-Keyring/examples/example3.pl,v retrieving revision 1.5 retrieving revision 1.11 diff -u -r1.5 -r1.11 --- palm/Palm-Keyring/examples/example3.pl 2007/08/10 05:13:31 1.5 +++ palm/Palm-Keyring/examples/example3.pl 2008/09/17 15:49:50 1.11 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $RedRiver: example3.pl,v 1.4 2007/02/10 16:24:16 andrew Exp $ +# $RedRiver: example3.pl,v 1.10 2008/03/05 22:04:46 andrew Exp $ ######################################################################## # palmkeyring.pl *** a command line client for Keyring databases. # @@ -17,8 +17,6 @@ Getopt::Long::Configure('bundling'); use Term::ReadLine; -use YAML; - use Palm::PDB; use Palm::Keyring; @@ -26,6 +24,7 @@ my $PDBFile; my $Categories; my $Names; +my $Accounts; my $Action_List; my $Action_Show; @@ -33,6 +32,7 @@ "file|f=s" => \$PDBFile, "categories|c:s@" => \$Categories, "name|n=s@" => \$Names, + "account|a=s@" => \$Accounts, "list|l" => \$Action_List, "show|s" => \$Action_Show, ); @@ -71,7 +71,7 @@ next if ( @{ $Categories } || @{ $Names } ) && not $matched; # XXX Fix up formatting - print $r->{decrypted}->{0}->{data} . + print $r->{plaintext}->{0}->{data} . ":" . $r->{category} . ":" . @@ -93,11 +93,8 @@ sub show_items { get_password() || die "Couldn't decrypt file!"; - foreach (0..$#{ $pdb->{'records'} }) { - next if $_ == 0; - my $r = $pdb->{'records'}->[$_]; - + my $r = $pdb->{'records'}->[$_]; my $category = $pdb->{'appinfo'}->{'categories'}->[ $r->{'category'} ]->{'name'}; @@ -106,11 +103,17 @@ $matched++ if uc($category) eq uc($cat); } foreach my $name (@{ $Names}) { - $matched++ if uc($r->{decrypted}->{0}->{data}) eq uc($name); + $matched++ if uc($r->{plaintext}->{0}->{data}) eq uc($name); } next if ( @{ $Categories } || @{ $Names } ) && not $matched; - my $a = $pdb->Decrypt($r); + my $a = $pdb->Decrypt($r); + + $matched = 0; + foreach my $account (@{ $Accounts }) { + $matched++ if uc($a->{1}->{data}) eq uc($account); + } + next if ( @{ $Accounts } ) && not $matched; # XXX Fix up formatting print $a->{0}->{data} . "\n\t" .