X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperldbmfilter.pod;h=8384999e6a78efa269bfde8ebff21c49093efdd9;hb=5269aecde866056a77e32c937c7c3182bb599487;hp=faed2d25d270b91f52f4d8227f5f6ad7107afb6a;hpb=9fe6733ac5627eddc014ed5f2afb208fa4afd501;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perldbmfilter.pod b/pod/perldbmfilter.pod index faed2d2..8384999 100644 --- a/pod/perldbmfilter.pod +++ b/pod/perldbmfilter.pod @@ -86,6 +86,7 @@ sure you have already guessed, this is a problem that DBM Filters can fix very easily. use strict ; + use warnings ; use SDBM_File ; use Fcntl ; @@ -99,7 +100,8 @@ fix very easily. # Install DBM Filters $db->filter_fetch_key ( sub { s/\0$// } ) ; $db->filter_store_key ( sub { $_ .= "\0" } ) ; - $db->filter_fetch_value( sub { s/\0$// } ) ; + $db->filter_fetch_value( + sub { no warnings 'uninitialized' ;s/\0$// } ) ; $db->filter_store_value( sub { $_ .= "\0" } ) ; $hash{"abc"} = "def" ; @@ -122,7 +124,7 @@ Here is another real-life example. By default, whenever Perl writes to a DBM database it always writes the key and value as strings. So when you use this: - $hash{12345} = "soemthing" ; + $hash{12345} = "something" ; the key 12345 will get stored in the DBM database as the 5 byte string "12345". If you actually want the key to be stored in the DBM database @@ -132,6 +134,7 @@ when reading. Here is a DBM Filter that does it: use strict ; + use warnings ; use DB_File ; my %hash ; my $filename = "/tmp/filt" ;