diff options
| -rwxr-xr-x | regress/base/io_add_del.pl | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/regress/base/io_add_del.pl b/regress/base/io_add_del.pl new file mode 100755 index 00000000..8b285948 --- /dev/null +++ b/regress/base/io_add_del.pl @@ -0,0 +1,50 @@ +#!/usr/bin/env perl +#-*- perl -*- +# +# Copyright (C) 2001,2002 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: search.pl,v 1.3 2002/04/18 14:18:08 fukachan Exp $ +# + +use strict; +use Carp; +use IO::Adapter; +my $debug = defined $ENV{'debug'} ? 1 : 0; +my $map = shift || 'file:/var/spool/ml/elena/etc/passwd-admin'; +my $obj = new IO::Adapter $map; +my $key = 'fukachan@sapporo.iij.ad.jp'; + +_dump(1); + +$obj->open || croak("cannot open $map"); + +$obj->delete($key); +$obj->add($key, crypt($$, $$)); + +$obj->close; + +_dump(2); + +exit 0; + + +sub _dump +{ + my ($i) = @_; + my $x; + + print "\n<<< $i >>>\n"; + + $obj->open(); + while ($x = $obj->getline()) { + print "<< ", $x if $x =~ /\S+/; + } + + my $a = $obj->get_value_as_array_ref( $key ); + if (defined $a) { + print "'$key' => '", $a->[0], "'\n"; + } + $obj->close(); +} |
