"KAWAI,Takanori" wrote:
>
> Hi.
> I think that DBD::AnyData and its base AnyData are
> very powerful and interesting modules.
Thanks for your on-going support.
> But I have a question about it :
> Why should I make a new module for my specific format?
> (for just 2 methods)
We think alike! There was a "user" method in the old DBD::RAM that did
just as you suggest and I added it to the development version of AnyData
several months ago. I call it AnyData::Format::User because it allows
the user to create on-the-fly format parsers. It allows users to pass
in read and write code refs as your sample does and it also allows the
user to pass in an *object* reference. So if someone creates a module
Foo::Bar.pm that is a stand-alone parser for data in format "Bar", they
can just add read and write (or import, export, etc.) subroutines and
users will be able to access it via AnyData or DBD::AnyData without
there needing to be a specific AnyData::Format::Bar.pm module.
> (*)When you use FlexRAM you should modify AnyData.pm (645) like
> below:
>
> if ('XML HTMLtable Excel Vertical FlexRAM' =~ /$target_format/) {
I have already added several new parsers that need to go in that list
and would like to avoid having changes to AnyData.pm to accomodate
them. In the next version, that line in AnyData.pm will be replaced
with:
if( $target_ad->{parser}->{has_export_method} ) {
That way, maintainers of these AnyData parsers will be able to specify
in the AnyData::Format::Foo->new() method a line like this
$self->{has_export_method} = 1;
And no one will have to modify the AnyData.pm file.
Kawai (sorry, is that right, is that the name to address you with?), how
does that sound?
--
Jeff