<snip>
Question about column names, see below.
I'm manipulating passwords and virtmaps. DBI::AnyData is so much easier
to write/maintain than the glob of Perl this replaces!
> Well, subclassing AnyData is alot simpler than you imagine. All you
> need to supply is a read_field and write_field and AnyData will handle
> things like deleting, updating etc. Here's an entire subclass that
> would handle all the same SQL as the other formats for what you describe:
>
> package AnyData::Format::Vertmap
> use AnyData::Format::Base;
> use vars qw( @ISA $VERSION);
> @AnyData::Format::Vertmap::ISA = qw( AnyData::Format::Base );
>
> sub new {
> my $class = shift;
One last question. How do I predefine column names as you have done in
Passwd.pm
I tried adding:
$flags->{col_names} = 'virtual_email,real_email';
here. But I still needed to add a first row with the column names.
> my $self = shift || {};
> return bless $self, $class;
> }
> sub read_fields {
> my $self = shift;
> my $str = shift || return undef;
> my @fields = split /\s+/,$str;
> }
> sub write_fields {
> return join "\t",@_;
> }
> 1;
>
> That's all, stick in in your AnyData/Format directory and you can use it
> the same as Pipe, CSV, etc.
>
> --
> Jeff