=================================================================== RCS file: /cvs/palm/Palm-Keyring/examples/example3.pl,v retrieving revision 1.3 retrieving revision 1.6 diff -u -r1.3 -r1.6 --- palm/Palm-Keyring/examples/example3.pl 2007/01/31 04:17:15 1.3 +++ palm/Palm-Keyring/examples/example3.pl 2007/09/12 04:59:37 1.6 @@ -1,6 +1,18 @@ #!/usr/bin/perl +# $RedRiver: example3.pl,v 1.5 2007/08/10 04:13:31 andrew Exp $ +######################################################################## +# palmkeyring.pl *** a command line client for Keyring databases. +# +# 2007.02.10 #*#*# andrew fresh +######################################################################## +# Copyright (C) 2007 by Andrew Fresh +# +# This program is free software; you can redistribute it and/or modify +# it under the same terms as Perl itself. +######################################################################## use strict; use warnings; + use Getopt::Long; Getopt::Long::Configure('bundling'); use Term::ReadLine; @@ -45,11 +57,9 @@ sub show_list { print "Showing List\n"; - foreach (0..$#{ $pdb->{'records'} }) { - next if $_ == 0; - my $r = $pdb->{'records'}->[$_]; + foreach my $r (@{ $pdb->{records} }) { my $category = - $pdb->{'appinfo'}->{'categories'}->[ $r->{'category'} ]->{'name'}; + $pdb->{appinfo}->{categories}->[ $r->{category} ]->{name}; my $matched = 0; foreach my $cat (@{ $Categories }) { @@ -61,9 +71,9 @@ next if ( @{ $Categories } || @{ $Names } ) && not $matched; # XXX Fix up formatting - print $r->{'name'} . + print $r->{plaintext}->{0}->{data} . ":" . - $r->{'category'} . + $r->{category} . ":" . $category . "\n"; @@ -96,18 +106,18 @@ $matched++ if uc($category) eq uc($cat); } foreach my $name (@{ $Names}) { - $matched++ if uc($r->{'name'}) eq uc($name); + $matched++ if uc($r->{plaintext}->{0}->{data}) eq uc($name); } next if ( @{ $Categories } || @{ $Names } ) && not $matched; my $a = $pdb->Decrypt($r); # XXX Fix up formatting - print $r->{'name'} . "\n\t" . + print $a->{0}->{data} . "\n\t" . "Category: " . $category . "\n\t" . - "Account: " . $a->{'account'} . "\n\t" . - "Password: " . $a->{'password'} . "\n"; - print "\tNotes: " . $a->{'notes'} . "\n" if $a->{'notes'}; + "Account: " . $a->{1}->{data} . "\n\t" . + "Password: " . $a->{2}->{data} . "\n"; + print "\tNotes: " . $a->{255}->{data} . "\n" if $a->{255}->{data}; } }