Re: RFC: Date::Iterator

2003-12-19 Thread Mike Guy
Andy Wardley <[EMAIL PROTECTED]> wrote
> Something like this should do the trick:
>
> $date = ref $date eq 'ARRAY' ? $date : [ split(/\D+/, $date) ];

Never use the value of ref() except in a true/false test.

The correct way to tell if something is an array ref is

ref $date && UNIVERSAL::isa($date, 'ARRAY')


Mike Guy


Re: Simple multi-level tie

2003-12-18 Thread Mike Guy
Andrew Sterling Hanenkamp <[EMAIL PROTECTED]> wrote
> use Storable qw(freeze thaw);
> use Tie::HashWrapper;
> 
> tie my %wrappee, 'AnyDBM_File', ...;
> tie my %hash, 'Tie::HashWrapper', \%wrappee,
>   -inflate_value => sub { thaw(shift) },
>   -deflate_value => sub { freeze(shift) };

Or rather more Perlishly

-inflate_value => \&thaw,
-deflate_value => \&freeze };

> $hash{a}{complicated}[4]{data} = [ 'structure' ];


Mike Guy