AnyData patches
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Heya I used git send-emails to post some patches to rehs...@cpan.org and this list, but I suspect they haven't made it due to my server setup before I send them again, I thought I'd test, and ask if anyone has received them :) Cheers Sven - -- Professional Wiki Innovation and Support Enterprise Support Contracts for Foswiki Sven Dowideit http://fosiki.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlBCkoQACgkQPAwzu0QrW+lCfgCgkmD+Szyrsx5gwY4DLIK7J9tF tToAnR1RhBSKXoGtSDisSyyx+qAmk353 =AEwD -END PGP SIGNATURE-
[PATCH 06/14] vanity - add myself to authors
From: Sven Dowideit --- AnyData.pm |3 ++- Makefile.PL | 40 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/AnyData.pm b/AnyData.pm index c6ffcf8..df9aabb 100644 --- a/AnyData.pm +++ b/AnyData.pm @@ -14,7 +14,7 @@ use vars qw( @ISA @EXPORT $VERSION ); @EXPORT = qw( adConvert adTie adRows adColumn adExport adDump adNames adFormats); #@EXPORT = qw( ad_fields adTable adErr adArray); -$VERSION = '0.10'; +$VERSION = '0.11'; sub new { my $class = shift; @@ -1436,6 +1436,7 @@ Special thanks to Andy Duncan, Tom Lowery, Randal Schwartz, Michel Rodriguez, Jo Jeff Zucker This module is copyright (c), 2000 by Jeff Zucker. + Some changes (c) 2012 Sven Dowideit L<mailto:svendowid...@fosiki.com> It may be freely distributed under the same terms as Perl itself. =cut diff --git a/Makefile.PL b/Makefile.PL index 7ebef28..e08638d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,20 +3,28 @@ require 5.004; use strict; require ExtUtils::MakeMaker; -my %opts = -('NAME' => 'AnyData', - 'VERSION_FROM' => 'AnyData.pm', - 'dist' => { 'SUFFIX' => ".gz", -'DIST_DEFAULT' => 'all tardist', -'COMPRESS' => "gzip -9vf" }, - 'PREREQ_PM' => { - 'Test::More' => '0.9' - }, - ); -if ($ExtUtils::MakeMaker::VERSION >= 5.43) { -$opts{'AUTHOR'} = 'Jeff Zucker (j...@vpservices.com)'; -} -ExtUtils::MakeMaker::WriteMakefile(%opts); - - +ExtUtils::MakeMaker::WriteMakefile( +( +'NAME' => 'AnyData', +'VERSION_FROM' => 'AnyData.pm', +'ABSTRACT_FROM' => 'AnyData.pm', +'dist' => { +'SUFFIX' => ".gz", +'DIST_DEFAULT' => 'all tardist', +'COMPRESS' => "gzip -9vf" +}, +'PREREQ_PM' => { 'Test::More' => '0.9' }, +( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? + ( 'LICENSE' => 'perl', ) +: () ), +( +$ExtUtils::MakeMaker::VERSION >= 5.43 +? ( +'AUTHOR' => 'Jeff Zucker (j...@vpservices.com)', +'AUTHOR' => 'Sven Dowideit (svendowid...@fosiki.com)', + ) +: () +), +) +); -- 1.7.10.4
[PATCH 01/14] move to using Test::More
From: Sven Dowideit --- Changes |6 ++ MANIFEST|2 +- Makefile.PL |8 +++- t/pod.t | 12 t/test.t| 42 ++ t/test.t~ | 40 test.pl | 36 7 files changed, 108 insertions(+), 38 deletions(-) create mode 100644 t/pod.t create mode 100755 t/test.t create mode 100755 t/test.t~ delete mode 100755 test.pl diff --git a/Changes b/Changes index 6ee137a..f51a7df 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,12 @@ AnyData - easy access to data in many formats Revision history for Perl extension AnyData. +version 0.11, released Aug 2012 + + * new maintainer Sven Dowideit + * use Test::More + * + version 0.10, released 19 April 2004 * really fixed adConvert, thanks for bug reports - Dan Wright, Scott Godin diff --git a/MANIFEST b/MANIFEST index 4936bca..f803a04 100644 --- a/MANIFEST +++ b/MANIFEST @@ -22,7 +22,7 @@ AnyData/Storage/FileSys.pm AnyData/Storage/PassThru.pm AnyData/Storage/RAM.pm AnyData/Storage/TiedHash.pm -test.pl +t/pod.t diff --git a/Makefile.PL b/Makefile.PL index 2e95307..7ebef28 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,9 +8,15 @@ my %opts = 'VERSION_FROM' => 'AnyData.pm', 'dist' => { 'SUFFIX' => ".gz", 'DIST_DEFAULT' => 'all tardist', -'COMPRESS' => "gzip -9vf" } +'COMPRESS' => "gzip -9vf" }, + 'PREREQ_PM' => { + 'Test::More' => '0.9' + }, ); if ($ExtUtils::MakeMaker::VERSION >= 5.43) { $opts{'AUTHOR'} = 'Jeff Zucker (j...@vpservices.com)'; } ExtUtils::MakeMaker::WriteMakefile(%opts); + + + diff --git a/t/pod.t b/t/pod.t new file mode 100644 index 000..ee8b18a --- /dev/null +++ b/t/pod.t @@ -0,0 +1,12 @@ +#!perl -T + +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); diff --git a/t/test.t b/t/test.t new file mode 100755 index 000..b9cf639 --- /dev/null +++ b/t/test.t @@ -0,0 +1,42 @@ +#!/usr/local/bin/perl -wT +use strict; +use warnings; + +#the original tests that came with AnyData 0.10 + +my @formats = qw(CSV Pipe Tab Fixed Paragraph ARRAY); + +use Test::More; +plan tests => (1+$#formats) * 4; + +use AnyData; + + +for my $format( @formats ) { + printf " %10s ... %s\n", $format, test_ad($format); +} + +sub test_ad { +my $file = []; +my $format = shift; +my $mode = 'o'; +my $flags = {cols=>'name,country,sex',pattern=>'A5 A8 A3'}; +my $table = adTie( $format,$file, $mode, $flags ); # create a table +$table->{Sue} = {country=>'fr',sex=>'f'}; # insert rows +$table->{Tom} = {country=>'fr',sex=>'f'}; +$table->{Bev} = {country=>'en',sex=>'f'}; +$table->{{ name=>'Tom'}} = {sex=>'m'}; # update a row +delete $table->{Bev}; # delete a row +$flags = {pattern=>'A5 A8 A3'}; +ok('f' eq $table->{Sue}->{sex}, "Failed single select"); +my $tstr; +while ( my $person = each %$table ) { # select mulitple rows +$tstr .= $person->{name} if $person->{country} eq 'fr'; +} +ok('SueTom' eq $tstr, "Failed multiple select"); +ok('namecountrysex' eq join('',adNames($table)), "Failed names"); +ok(2 == adRows($table), "Failed rows"); +} + + +__END__ diff --git a/t/test.t~ b/t/test.t~ new file mode 100755 index 000..30d5abc --- /dev/null +++ b/t/test.t~ @@ -0,0 +1,40 @@ +#!/usr/local/bin/perl -wT +use strict; +use warnings; + +my @formats = qw(CSV Pipe Tab Fixed Paragraph ARRAY); + +use Test::More; +plan tests => (1+$#formats) * 4; + +use AnyData; + + +for my $format( @formats ) { + printf " %10s ... %s\n", $format, test_ad($format); +} + +sub test_ad { +my $file = []; +my $format = shift; +my $mode = 'o'; +my $flags = {cols=>'name,country,sex',pattern=>'A5 A8 A3'}; +my $table = adTie( $format,$file, $mode, $flags ); # create a table +$table->{Sue} = {country=>'fr',sex=>'f'}; # insert rows +$table->{Tom} = {country=>'fr',sex=>'f'}; +$table->{Bev
[PATCH 02/14] debian package patch: * Fails to retrieve XML data over HTTP (debian#421884) Bart Martens
From: Sven Dowideit --- AnyData/Format/XML.pm |3 ++- Changes |1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AnyData/Format/XML.pm b/AnyData/Format/XML.pm index e46271e..e3dd535 100644 --- a/AnyData/Format/XML.pm +++ b/AnyData/Format/XML.pm @@ -681,11 +681,12 @@ paste into parent record_tag__ sub get_data { my $self = shift; -my $fh_or_str = shift || return; +my $fh_or_str = shift; my $url = $self->{url}; if ( $url ) { $fh_or_str = AnyData::Storage::RAM::get_remote_data({},$url); } +return if( ! defined( $fh_or_str ) ); my $col_names = shift || []; $col_names = []; IGNORE USER COLUMN NAMES FOR NOW my $flags; diff --git a/Changes b/Changes index f51a7df..a916a97 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ version 0.11, released Aug 2012 * new maintainer Sven Dowideit * use Test::More + * Fails to retrieve XML data over HTTP (debian#421884) Bart Martens * version 0.10, released 19 April 2004 -- 1.7.10.4
[PATCH 03/14] debian package patch: fix pod and spelling errors - Ansgar Burchardt
From: Sven Dowideit --- AnyData.pm|2 +- AnyData/Format/XML.pm | 24 Changes |5 - 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/AnyData.pm b/AnyData.pm index 4ead62b..b91aa05 100644 --- a/AnyData.pm +++ b/AnyData.pm @@ -850,7 +850,7 @@ sub dump { The rather wacky idea behind this module and its sister module DBD::AnyData is that any data, regardless of source or format should -be accessable and modifiable with the same simple set of methods. +be accessible and modifiable with the same simple set of methods. This module provides a multi-dimensional tied hash interface to data in a dozen different formats. The DBD::AnyData module adds a DBI/SQL interface for those same formats. diff --git a/AnyData/Format/XML.pm b/AnyData/Format/XML.pm index e3dd535..fd86c39 100644 --- a/AnyData/Format/XML.pm +++ b/AnyData/Format/XML.pm @@ -654,17 +654,17 @@ sub get_structure_from_map { $map = $newmap; } ## -=pod -paste into parent record_tag__ -my $rt_atts = $record_tag->atts; -if (!$rt_atts->{record_tag__}) { - my $new_rt = $record_tag->copy; - $new_rt->set_att('record_tag__','1'); - $new_rt->set_att('xstruct__','1'); - $new_rt->paste('first_child',$record_tag->parent); - $record_tag = $new_rt; -} -=cut +#=pod +#paste into parent record_tag__ +#my $rt_atts = $record_tag->atts; +#if (!$rt_atts->{record_tag__}) { +# my $new_rt = $record_tag->copy; +# $new_rt->set_att('record_tag__','1'); +# $new_rt->set_att('xstruct__','1'); +# $new_rt->paste('first_child',$record_tag->parent); +# $record_tag = $new_rt; +#} +#=cut my $col_structure = { amap => $amap, map => $map, @@ -981,7 +981,7 @@ Importing options allow you to import/access/modify XML of almost any length or Exporting and converting options allow you to take data from almost any source (a perl array, any DBI database, etc.) and output it as an XML file. You can control the formating of the resulting XML either by supplying a DTD listing things like nesting of tags and which columns should be output as attributes and/or you can use XML::Twig pretty_print settings to generate half a dozen different levels of compactness or whitespace in how the XML looks. -The documentaion below outlines the special flags that can be used +The documentation below outlines the special flags that can be used in either of the interfaces to fine-tune how the XML is treated. The flags listed below define the relationship between tags and diff --git a/Changes b/Changes index a916a97..44c8c9e 100644 --- a/Changes +++ b/Changes @@ -7,7 +7,10 @@ version 0.11, released Aug 2012 * new maintainer Sven Dowideit * use Test::More * Fails to retrieve XML data over HTTP (debian#421884) Bart Martens - * + * Fix syntax error in POD documentation (debian) Ansgar Burchardt + * Fix spelling errors (debian) Ansgar Burchardt + + version 0.10, released 19 April 2004 -- 1.7.10.4
[PATCH 04/14] * adColumn not handled (RT#6248 & RT#6251) John D. Lima
From: Sven Dowideit --- AnyData.pm |5 +++-- Changes|2 +- t/test.t | 10 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AnyData.pm b/AnyData.pm index b91aa05..c6ffcf8 100644 --- a/AnyData.pm +++ b/AnyData.pm @@ -498,13 +498,14 @@ sub adRows { my $thash = shift; my %keys = @_; my $obj = tied(%$thash); -return $obj->adRows(\%keys) +return $obj->adRows(\%keys); } sub adColumn { my $thash = shift; my $column = shift; +my $flags = shift; my $obj= tied(%$thash); -return $obj->adColumn($column) +return $obj->adColumn($column, $flags); } sub adArray { my($format,$data)=@_; diff --git a/Changes b/Changes index 44c8c9e..880750a 100644 --- a/Changes +++ b/Changes @@ -9,7 +9,7 @@ version 0.11, released Aug 2012 * Fails to retrieve XML data over HTTP (debian#421884) Bart Martens * Fix syntax error in POD documentation (debian) Ansgar Burchardt * Fix spelling errors (debian) Ansgar Burchardt - + * adColumn $distinct_flag not handled (RT#6248 & RT#6251) John D. Lima version 0.10, released 19 April 2004 diff --git a/t/test.t b/t/test.t index b9cf639..a860f48 100755 --- a/t/test.t +++ b/t/test.t @@ -7,13 +7,13 @@ use warnings; my @formats = qw(CSV Pipe Tab Fixed Paragraph ARRAY); use Test::More; -plan tests => (1+$#formats) * 4; +plan tests => (1+$#formats) * 6; use AnyData; for my $format( @formats ) { - printf " %10s ... %s\n", $format, test_ad($format); + test_ad($format); } sub test_ad { @@ -25,6 +25,8 @@ sub test_ad { $table->{Sue} = {country=>'fr',sex=>'f'}; # insert rows $table->{Tom} = {country=>'fr',sex=>'f'}; $table->{Bev} = {country=>'en',sex=>'f'}; +$table->{Nel} = {country=>'en',sex=>'f'}; +$table->{Pam} = {country=>'au',sex=>'f'}; $table->{{ name=>'Tom'}} = {sex=>'m'}; # update a row delete $table->{Bev}; # delete a row $flags = {pattern=>'A5 A8 A3'}; @@ -35,7 +37,9 @@ sub test_ad { } ok('SueTom' eq $tstr, "Failed multiple select"); ok('namecountrysex' eq join('',adNames($table)), "Failed names"); -ok(2 == adRows($table), "Failed rows"); +ok(4 == adRows($table), "Failed rows"); +ok(4 == adColumn($table, 'country'), "total number of rows"); +ok(3 == adColumn($table, 'country', 1), "distinct countries"); } -- 1.7.10.4
[PATCH 07/14] fix NAME section so ABSTRACT_FROM works
From: Sven Dowideit --- AnyData.pm |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnyData.pm b/AnyData.pm index df9aabb..2182c15 100644 --- a/AnyData.pm +++ b/AnyData.pm @@ -818,7 +818,7 @@ sub dump { =head1 NAME - AnyData -- easy access to data in many formats +AnyData - easy access to data in many formats =head1 SYNOPSIS -- 1.7.10.4
[PATCH 05/14] * writing fields containing 0 with AnyData::Format::Fixed (RT#8671)
From: Sven Dowideit --- AnyData/Format/Fixed.pm |4 +++- Changes |2 +- MANIFEST|3 +++ t/fixed.t | 31 +++ t/fixed.tbl |7 +++ t/test.t~ | 40 6 files changed, 45 insertions(+), 42 deletions(-) create mode 100644 t/fixed.t create mode 100644 t/fixed.tbl delete mode 100755 t/test.t~ diff --git a/AnyData/Format/Fixed.pm b/AnyData/Format/Fixed.pm index d951c03..afdf03e 100644 --- a/AnyData/Format/Fixed.pm +++ b/AnyData/Format/Fixed.pm @@ -31,6 +31,8 @@ package AnyData::Format::Fixed; This is a parser for fixed length record files. You must specify an unpack pattern listing the widths of the fields e.g. {pattern=>'A3 A7 A20'}. You can either supply the column names or let the module get them for you from the first line of the file. In either case, they should be a comma separated string. +Refer to L<http://perldoc.perl.org/functions/pack.html> for the formating of the pattern. + Please refer to the documentation for AnyData.pm and DBD::AnyData.pm for further details. @@ -70,7 +72,7 @@ sub write_fields { my @fieldLengths = split /\s+/, $patternStr; my $fieldStr = ''; for(@fields) { -next unless $_; +next unless defined $_; # PAD OR TRUNCATE DATA TO FIT WITHIN FIELD LENGTHS my $oldLen = length $_ || 0; my $newLen = $fieldLengths[$fieldNum] || 0; diff --git a/Changes b/Changes index 880750a..9593473 100644 --- a/Changes +++ b/Changes @@ -10,7 +10,7 @@ version 0.11, released Aug 2012 * Fix syntax error in POD documentation (debian) Ansgar Burchardt * Fix spelling errors (debian) Ansgar Burchardt * adColumn $distinct_flag not handled (RT#6248 & RT#6251) John D. Lima - + * writing fields containing 0 with AnyData::Format::Fixed (RT#8671) version 0.10, released 19 April 2004 diff --git a/MANIFEST b/MANIFEST index f803a04..7a52d0c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -23,6 +23,9 @@ AnyData/Storage/PassThru.pm AnyData/Storage/RAM.pm AnyData/Storage/TiedHash.pm t/pod.t +t/test.t +t/fixed.t +t/fixed.tbl diff --git a/t/fixed.t b/t/fixed.t new file mode 100644 index 000..f2bd342 --- /dev/null +++ b/t/fixed.t @@ -0,0 +1,31 @@ +#!/usr/local/bin/perl -wT +use strict; +use warnings; + +use Test::More; +plan tests => 6; + +use AnyData; + +my $table = adTie( 'Fixed', 't/fixed.tbl', 'r', {pattern=>'A11 A2'} ); + +ok(6 == adRows($table), "Failed rows"); +ok('au' eq $table->{'australia'}->{code}, 'select one'); +ok('ch' eq $table->{'switzerland'}->{code}, 'select another'); +ok('0' eq $table->{'broken'}->{code}, 'select another'); +ok(' 0' eq $table->{'broken2'}->{code}, 'select another'); + +#write test +ok(<<'HERE' eq adExport($table, 'Fixed', undef, {pattern=>'A11 A2'}), 'export fixed format'); +countryco +australia au +germanyde +france fr +switzerlandch +broken 0 +broken2 0 +HERE + +#TODO: note that the docco says the column names need to be comma separated, and the input file has 'country,code', thus the written file would be busted too + +__END__ diff --git a/t/fixed.tbl b/t/fixed.tbl new file mode 100644 index 000..02ffb63 --- /dev/null +++ b/t/fixed.tbl @@ -0,0 +1,7 @@ +country,code +australia au +germanyde +france fr +switzerlandch +broken 0 +broken2 0 diff --git a/t/test.t~ b/t/test.t~ deleted file mode 100755 index 30d5abc..000 --- a/t/test.t~ +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/local/bin/perl -wT -use strict; -use warnings; - -my @formats = qw(CSV Pipe Tab Fixed Paragraph ARRAY); - -use Test::More; -plan tests => (1+$#formats) * 4; - -use AnyData; - - -for my $format( @formats ) { - printf " %10s ... %s\n", $format, test_ad($format); -} - -sub test_ad { -my $file = []; -my $format = shift; -my $mode = 'o'; -my $flags = {cols=>'name,country,sex',pattern=>'A5 A8 A3'}; -my $table = adTie( $format,$file, $mode, $flags ); # create a table -$table->{Sue} = {country=>'fr',sex=>'f'}; # insert rows -$table->{Tom} = {country=>'fr',sex=>'f'}; -$table->{Bev} = {country=>'en',sex=>'f'}; -$table->{{ name=>'Tom'}} = {sex=>'m'}; # update a row -delete $table->{Bev}; # delete a row -$flags = {pattern=>'A5 A8 A3'}; -ok('f' eq $table->{Sue}->{sex}, "Failed single select"); -my $tstr; -while ( my $person = each %$table ) { # select mulitple rows -$tstr .= $person->{name} if $person->{country} eq 'fr'; -} -ok('SueTom' eq $tstr, "Failed multiple select"); -ok('namecountrysex' eq join('',adNames($table)), "Failed names"); -ok(2 == adRows($table), "Failed rows"); -} - - -__END__ -- 1.7.10.4
[PATCH 09/14] add spelling test for pod
From: Sven Dowideit --- Makefile.PL |5 - t/spelling.t | 14 ++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 t/spelling.t diff --git a/Makefile.PL b/Makefile.PL index b7962f1..8d8109a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -13,7 +13,10 @@ ExtUtils::MakeMaker::WriteMakefile( 'DIST_DEFAULT' => 'all tardist', 'COMPRESS' => "gzip -9vf" }, -'PREREQ_PM' => { 'Test::More' => '0.9' }, +'PREREQ_PM' => { +'Test::More' => '0.9', +'Test::Pod::Spelling::CommonMistakes' => '1.000' +}, ( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ( 'LICENSE' => 'perl', ) : () ), diff --git a/t/spelling.t b/t/spelling.t new file mode 100644 index 000..03f9e68 --- /dev/null +++ b/t/spelling.t @@ -0,0 +1,14 @@ +#!/usr/bin/perl +use strict; +use warnings; + +use Test::More; + +eval "use Test::Pod::Spelling::CommonMistakes"; +if ($@) { +plan skip_all => + 'Test::Pod::Spelling::CommonMistakes required for testing POD'; +} +else { +all_pod_files_ok(); +} -- 1.7.10.4
[PATCH 08/14] yes, that wasn't an array of authors
From: Sven Dowideit --- Makefile.PL |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index e08638d..b7962f1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -20,8 +20,10 @@ ExtUtils::MakeMaker::WriteMakefile( ( $ExtUtils::MakeMaker::VERSION >= 5.43 ? ( -'AUTHOR' => 'Jeff Zucker (j...@vpservices.com)', - 'AUTHOR' => 'Sven Dowideit (svendowid...@fosiki.com)', +'AUTHOR' => [ + 'Jeff Zucker (j...@vpservices.com)', +'Sven Dowideit (svendowid...@fosiki.com)', +] ) : () ), -- 1.7.10.4
[PATCH 11/14] add a few more tests and a few fixes
From: Sven Dowideit --- AnyData.pm | 47 +-- MANIFEST|7 --- t/01distributtion.t |7 +-- t/01pod_snippets.t | 10 ++ t/fixed.t | 15 --- t/fixed.tbl |8 +--- t/test.t| 47 +++ 7 files changed, 76 insertions(+), 65 deletions(-) create mode 100644 t/01pod_snippets.t diff --git a/AnyData.pm b/AnyData.pm index 2182c15..dd350c7 100644 --- a/AnyData.pm +++ b/AnyData.pm @@ -822,7 +822,8 @@ AnyData - easy access to data in many formats =head1 SYNOPSIS - $table = adTie( 'CSV','my_db.csv','o',# create a table + use AnyData; + my $table = adTie( 'CSV','my_db.csv','o',# create a table {col_names=>'name,country,sex'} ); $table->{Sue} = {country=>'de',sex=>'f'}; # insert a row @@ -831,7 +832,7 @@ AnyData - easy access to data in many formats while ( my $row = each %$table ) {# loop through table print $row->{name} if $row->{sex} eq 'f'; } - $rows = $table->{{age=>'> 25'}} # select multiple rows + $rows = $table->{{age=>'> 25'}}; # select multiple rows delete $table->{{country=>qr/us|mx|ca/}}; # delete multiple rows $table->{{country=>'Nz'}}={country=>'nz'};# update multiple rows my $num = adRows( $table, age=>'< 25' ); # count matching rows @@ -843,9 +844,8 @@ AnyData - easy access to data in many formats print adDump($table); # dump table to screen undef $table; # close the table - adConvert( $format1, $file1, $format2, $file2 ); # convert btwn formats - print adConvert( $format1, $file1, $format2 );# convert to screen - + #adConvert( $format1, $file1, $format2, $file2 ); # convert btwn formats + #print adConvert( $format1, $file1, $format2 );# convert to screen =head1 DESCRIPTION @@ -883,7 +883,9 @@ DBI, DBD::AnyData, SQL::Statement and DBD::File installed. =head1 USAGE - The AnyData module imports eight methods (functions): +The AnyData module imports eight methods (functions): + +=for test ignore adTie() -- create a new table or open an existing table adExport() -- save an existing table in a specified format @@ -894,14 +896,14 @@ DBI, DBD::AnyData, SQL::Statement and DBD::File installed. adDump()-- display the data formatted as an array of rows adColumn() -- group values in a single column - The adTie() command returns a special tied hash. The tied hash can - then be used to access and/or modify data. See below for details +The adTie() command returns a special tied hash. The tied hash can +then be used to access and/or modify data. See below for details - With the exception of the XML, HTMLtable, and ARRAY formats, the - adTie() command saves all modifications of the data directly to file - as they are made. With XML and HTMLtable, you must make your - modifications in memory and then explicitly save them to file with - adExport(). +With the exception of the XML, HTMLtable, and ARRAY formats, the +adTie() command saves all modifications of the data directly to file +as they are made. With XML and HTMLtable, you must make your +modifications in memory and then explicitly save them to file with +adExport(). =head2 adTie() @@ -911,22 +913,23 @@ The adTie() command creates a reference to a multi-dimensional tied hash. In its my $table = adTie( $format, $file ); - $format is the name of any supported format 'CSV','Fixed','Passwd', etc. - $file is the name of a relative or absolute path to a local file +$format is the name of any supported format 'CSV','Fixed','Passwd', etc. +$file is the name of a relative or absolute path to a local file - e.g. my $table = adTie( 'CSV', '/usr/me/myfile.csv' ); +e.g. + my $table = adTie( 'CSV', '/usr/me/myfile.csv' ); - this creates a tied hash called $table by reading data in the - CSV (comma separated values) format from the file 'myfile.csv'. +this creates a tied hash called $table by reading data in the +CSV (comma separated values) format from the file 'myfile.csv'. The hash reference resulting from adTie() can be accessed and modified as follows: use AnyData; my $table = adTie( $format, $file ); - $table->{$key}->{$column} # select a value - $table->{$key} = {$col1=>$val1,$col2=>$val2...} # update a row - delete $table->{$key} # delete a row - while(my $row = each %$table) {
[PATCH 10/14] add disabled distro test
From: Sven Dowideit --- t/01distributtion.t | 14 ++ 1 file changed, 14 insertions(+) create mode 100644 t/01distributtion.t diff --git a/t/01distributtion.t b/t/01distributtion.t new file mode 100644 index 000..a6963b8 --- /dev/null +++ b/t/01distributtion.t @@ -0,0 +1,14 @@ +use Test::More; + +BEGIN { +eval { require Test::Distribution; }; +if ($@) { +plan skip_all => 'Test::Distribution not installed'; +} +else { + +#TODO: work to fix these +# import Test::Distribution only => [ qw/use description sig versions use prereq pod podcoverage/ ]; +} +} + -- 1.7.10.4
[PATCH 13/14] adDump writes out fields containing 0 as empty strings (RT#28006) xcaron [...] gmail.com
From: Sven Dowideit --- AnyData.pm |2 +- Changes|2 +- t/api.t| 27 +++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 t/api.t diff --git a/AnyData.pm b/AnyData.pm index dd350c7..1b34d2d 100644 --- a/AnyData.pm +++ b/AnyData.pm @@ -488,7 +488,7 @@ sub adDump { my @cols = @{ $ad->col_names }; print "<",join(":", @cols), ">\n"; while (my $row = each %$table) { -my @row = map {$row->{$_} || ''} @cols; +my @row = map {defined $row->{$_} ? $row->{$_} : ''} @cols; for (@row) { print "[$_]"; } print "\n"; } diff --git a/Changes b/Changes index e09929f..6c651c8 100644 --- a/Changes +++ b/Changes @@ -12,7 +12,7 @@ version 0.11, released Aug 2012 * adColumn $distinct_flag not handled (RT#6248 & RT#6251) John D. Lima * writing fields containing 0 with AnyData::Format::Fixed (RT#8671) * weblog request and referer regexs were too greedy, and the referer and client regex's where in the wrong order (RT#34063) and (RT#72334) Wes Brown and pawal [...] blipp.com - * + * adDump writes out fields containing 0 as empty strings (RT#28006) xcaron [...] gmail.com version 0.10, released 19 April 2004 diff --git a/t/api.t b/t/api.t new file mode 100644 index 000..9c743b2 --- /dev/null +++ b/t/api.t @@ -0,0 +1,27 @@ +#!/usr/local/bin/perl -wT +use strict; +use warnings; + +use Test::More; +plan tests => 2; +use Test::Output; + + +use AnyData; + +my $table = adTie( 'CSV', ["word,number\none,1\ntwo,2\nthree,3\nunknown\nunknowncomma,\nzero,0"] ); + +ok( 6 == adRows($table), "Failed rows" ); + +stdout_is( sub {adDump( $table )}, <<'HERE', 'export fixed format' ); + +[one][1] +[two][2] +[three][3] +[unknown][] +[unknowncomma][] +[zero][0] +HERE + + +__END__ -- 1.7.10.4
[PATCH 12/14] weblog request and referer regexs were too greedy, and the referer and client regex's where in the wrong order (RT#34063) and (RT#72334) Wes Brown and pawal [..
From: Sven Dowideit --- AnyData/Format/Weblog.pm | 24 +++- Changes |2 ++ t/fixed.tbl |8 +++- t/weblog.t | 42 ++ t/weblog.tbl |1 + 5 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 t/weblog.t create mode 100644 t/weblog.tbl diff --git a/AnyData/Format/Weblog.pm b/AnyData/Format/Weblog.pm index 0c89da8..339623f 100644 --- a/AnyData/Format/Weblog.pm +++ b/AnyData/Format/Weblog.pm @@ -61,12 +61,11 @@ all rights reserved =cut - use strict; use AnyData::Format::Base; use vars qw( @ISA $DEBUG $VERSION); @AnyData::Format::Weblog::ISA = qw( AnyData::Format::Base ); -$DEBUG = 0; +$DEBUG= 0; $VERSION = '0.06'; @@ -74,9 +73,9 @@ sub new { my $class = shift; my $self = shift || {}; $self->{col_names} = - 'remotehost,username,authuser,date,request,status,bytes,client,referer'; -$self->{record_sep} = "\n"; -$self->{key} = 'datestamp'; + 'remotehost,username,authuser,date,request,status,bytes,referer,client'; +$self->{record_sep} = "\n"; +$self->{key} = 'datestamp'; $self->{keep_first_line} = 1; return bless $self, $class; } @@ -84,21 +83,20 @@ sub new { sub read_fields { print "PARSE RECORD\n" if $DEBUG; my $self = shift; -my $str = shift || return undef; +my $str = shift || return undef; $str =~ s/^\s+//; $str =~ s/\s+$//; return undef unless $str; -my(@row) = $str =~ -/^(\S*) (\S*) (\S*) \[([^\]]*)\] "(.*)" (\S*) (\S*)\s*(.*)$/; +my (@row) = + $str =~ /^(\S*) (\S*) (\S*) \[([^\]]*)\] "(.*?)" (\S*) (\S*)\s*(.*)$/; return undef unless defined $row[0]; -my($client,$referer) = $row[7] =~ /^(.*) (\S*)$/; +my ( $referer, $client ) = $row[7] =~ /^(.*?)\s(.*)$/; $client ||= ''; $referer ||= ''; -($row[7],$row[8])=($client,$referer); +( $row[7], $row[8] ) = ( $referer, $client ); + # $row[3] =~ s/\s*-\s*(\S*)$//; # hide GMT offset on datestamp -return @row +return @row; } 1; - - diff --git a/Changes b/Changes index 9593473..e09929f 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ version 0.11, released Aug 2012 * Fix spelling errors (debian) Ansgar Burchardt * adColumn $distinct_flag not handled (RT#6248 & RT#6251) John D. Lima * writing fields containing 0 with AnyData::Format::Fixed (RT#8671) + * weblog request and referer regexs were too greedy, and the referer and client regex's where in the wrong order (RT#34063) and (RT#72334) Wes Brown and pawal [...] blipp.com + * version 0.10, released 19 April 2004 diff --git a/t/fixed.tbl b/t/fixed.tbl index aeac94d..02ffb63 100644 --- a/t/fixed.tbl +++ b/t/fixed.tbl @@ -1 +1,7 @@ -country, code australia au germany de france fr switzerlandch broken 0 broken2 0 +country,code +australia au +germanyde +france fr +switzerlandch +broken 0 +broken2 0 diff --git a/t/weblog.t b/t/weblog.t new file mode 100644 index 000..2d494e6 --- /dev/null +++ b/t/weblog.t @@ -0,0 +1,42 @@ +#!/usr/local/bin/perl -wT +use strict; +use warnings; + +use Test::More; +plan tests => 10; + +use AnyData; + +my $table = adTie( 'Weblog', 't/weblog.tbl', 'r', {} ); + +ok( 1 == adRows($table), "Failed rows" ); + +#remotehost,username,authuser,date,request,status,bytes,client,referer +#12.34.56.78 - - [13/Mar/2008:07:38:53 +0100] "GET /creeper/image HTTP/1.1" 200 252 "http://www.example.com/"; "Mozilla/5.0 (Windows; U; Windows NT 6.0; sv-SE; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12" + +my $row = each %$table; +ok( '12.34.56.78' eq $row->{remotehost}, 'remotehost' ); +ok( '-' eq $row->{username}, 'username' ); +ok( '-' eq $row->{authuser}, 'authuser' ); +ok( '13/Mar/2008:07:38:53 +0100' eq $row->{date}, 'date' ); +ok( 'GET /creeper/image HTTP/1.1' eq $row->{request},'request' ); +ok( '200' eq $row->{status}, 'status' ); +ok( '252' eq $row->{bytes}, 'bytes' ); +ok( +'"Mozilla/5.0 (Windows; U; Windows NT 6.0; sv-SE; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12"' + eq $row->{client}, +'client ' . $row->{client} +); +ok( '"http://www.example.com/";' eq $row->{referer}, +'referer: ' . $row->{referer} ); + +#write test +#TODO: looks like writing a weblog is broken +#print STDERR "\n---\n"; +
[PATCH 14/14] adExport to XML hangs while flock (RT#19223) zmousm [...] admin.grnet.gr
From: Sven Dowideit --- AnyData/Format/XML.pm |6 ++ Changes |1 + MANIFEST.SKIP | 27 +++ t/htmltable.t | 31 +++ t/xml.t | 31 +++ 5 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 MANIFEST.SKIP create mode 100644 t/htmltable.t create mode 100644 t/xml.t diff --git a/AnyData/Format/XML.pm b/AnyData/Format/XML.pm index fd86c39..1014c38 100644 --- a/AnyData/Format/XML.pm +++ b/AnyData/Format/XML.pm @@ -867,11 +867,9 @@ sub export { #z my $format = shift; my $file = shift; my $flags = shift || {}; -#print "\n\n== $file == \n\n" if $file; #$self->{twig}->print; -#zif ( ( $storage and $file and !($file eq $storage->{file_name}) ) -#z or ( $storage and $file and !$storage->{fh} ) -if ( ( $storage and $file ) +if ( + ( $storage and $file and !$storage->{fh} ) ) { $storage->{file_name} = $file; $storage->{fh} = $storage->open_local_file($file,'o'); diff --git a/Changes b/Changes index 6c651c8..5f50a15 100644 --- a/Changes +++ b/Changes @@ -13,6 +13,7 @@ version 0.11, released Aug 2012 * writing fields containing 0 with AnyData::Format::Fixed (RT#8671) * weblog request and referer regexs were too greedy, and the referer and client regex's where in the wrong order (RT#34063) and (RT#72334) Wes Brown and pawal [...] blipp.com * adDump writes out fields containing 0 as empty strings (RT#28006) xcaron [...] gmail.com + * A bug in AnyData::Format::Weblog, SQL excuting result is not correct (RT#56962) young...@gmail.com version 0.10, released 19 April 2004 diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP new file mode 100644 index 000..ff3da45 --- /dev/null +++ b/MANIFEST.SKIP @@ -0,0 +1,27 @@ +\B\.svn\b +\.[Bb][Aa][Kk]$ +\.orig$ +\.old$ +\.tdy$ +\.tmp$ +\..*swp +^Makefile$ +^Build$ +CVS/.* +\.svn/.* +\.cvsignore$ +\.Inline/.* +_Inline/.* +\.bak$ +\.tar$ +\.tgz$ +\.tar\.gz$ +^mess/ +^tmp/ +^testdata/ +^blib/ +^pm_to_blib$ +^_build/.* +~$ +^MYMETA.yml$ +DBD-AnyData-.* diff --git a/t/htmltable.t b/t/htmltable.t new file mode 100644 index 000..83f6a58 --- /dev/null +++ b/t/htmltable.t @@ -0,0 +1,31 @@ +#!/usr/local/bin/perl -w +use strict; +use warnings; + +use Test::More; +plan tests => 3; + +use AnyData; + +my $table = + adTie( 'CSV', +["word,number\none,1\ntwo,2\nthree,3\nunknown\nunknowncomma,\nzero,0"] ); + +ok( 6 == adRows($table), "Failed rows" ); + +adExport( $table, "HTMLtable", 't/htmltable.out' ); +ok( open( my $fh, '<', 't/htmltable.out' ), 'open file' ); +local $\ = ''; +my $result = <$fh>; + +#print STDERR "\n---\n"; +#print STDERR "$result"; +#print STDERR "\n---\n"; + +ok( +$result eq +'t/htmltable.out word number one 1 two 2 three 3 unknown unknowncomma zero ', +'xml export ok' +); + +__END__ diff --git a/t/xml.t b/t/xml.t new file mode 100644 index 000..a0ee2fc --- /dev/null +++ b/t/xml.t @@ -0,0 +1,31 @@ +#!/usr/local/bin/perl -w +use strict; +use warnings; + +use Test::More; +plan tests => 3; + +use AnyData; + +my $table = + adTie( 'CSV', +["word,number\none,1\ntwo,2\nthree,3\nunknown\nunknowncomma,\nzero,0"] ); + +ok( 6 == adRows($table), "Failed rows" ); + +adExport( $table, "XML", 't/xml.out' ); +ok( open( my $fh, '<', 't/xml.out' ), 'open file' ); +local $\ = ''; +my $result = <$fh>; + +#print STDERR "\n---\n"; +#print STDERR "$result"; +#print STDERR "\n---\n"; + +ok( +$result eq +'one1two2three3unknownunknowncommazero0', +'xml export ok' +); + +__END__ -- 1.7.10.4
Re: AnyData patches
yup :) http://github.com/SvenDowideit/AnyData Sven On 04/09/12 21:05, H.Merijn Brand wrote: On Sun, 02 Sep 2012 08:56:04 +1000, Sven Dowideit wrote: Heya I used git send-emails to post some patches to rehs...@cpan.org and this list, but I suspect they haven't made it due to my server setup before I send them again, I thought I'd test, and ask if anyone has received them :) Does all of this has some git repo we could clone so we can run some (more) tests on it?
Re: AnyData patches
excellent, thankyou for the list updates pushed to http://github.com/SvenDowideit/AnyData (onlist is fine by me - others might have suggestions for me too :)) that sent me off to learn a pile more - though some was easier to address using Module::Build than MakeMaker (which AnyData is still using for now) I (think) i've done all except the examples/ suggestion, which I might leave until i've fixed some more bugs and have more of an idea of what can be done using AnyData Cheers Sven On 05/09/12 16:47, H.Merijn Brand wrote: > I have a *lot* of modules - for testing - installed, but still run into > new ones, and neither is mentioned when running Makefile.PL > > t/01distributtion.t .. skipped: Test::Distribution not installed > t/01pod_snippets.t ... Can't locate Test/Pod/Snippets.pm > > And Test::Pod::Snippets depends on a lot of unneeded stuff like > Object::InsideOut and Module::Locate, two I also had not installed. > > If you really want to depend on those just locally, disable these tests > in the distribution if the module cannot be loaded. Even after having > the modules installed, I get > > t/01distributtion.t .. skipped: Test::Distribution not installed > t/01pod_snippets.t ... skipped: Need to do more work fixing pod code snippets > > so I guess it is better to just drop that test and use Test::Pod and > Test::Pod::Coverage instead: I've moved the author tests I have started using into xt/ - though unlinke in M:B I've not worked out how to activate them cleanly I'm planning to use Test::Pod::Snippets, because it test the code examples in the Pod, but for now its not that happy Test::Pod and Coverage are in xt/ now too :) > > I miss an examples folder. Docs are fine, but examples are great This is a good idea for later - initially, I want to get some of the bugs fixed > > Makefile.PL requires 5.004. I'd say that by now it is safe to require > at least 5.6.2, but when also using DBI, require 5.8.1. Additional, you > can then add: 5.6 it is :) though clearly I need to tweak the docco to show AnyData doesn't use DBI > > * use_warnings > Add 'use warnings' to all modules. (This will require perl > 5.6) done - I hope there aren't any lurking consequenses that I won't know about due to a lack of test cases > > MYMETA.json/yml should include the git repo under resources META_ADD-ed > > Spell-checking - after filtering known words. I can give you the tools > on IRC > xt/spelling.t :) > > > Not in MANIFEST: AnyData/Storage/File.pod > Not in MANIFEST: t/htmltable.t > Not in MANIFEST: t/xml.t updated using make manifest > > * has_humanreadable_license > Add a section called 'LICENSE' to the documentation, or add a file named LICENSE to the distribution. in M:B i used create_license - I didn't see the same in MM, so I copied a LICENSE file for now > > * has_test_pod_coverage > Add a test using Test::Pod::Coverage to check for POD coverage. > done
Re: Status of AnyData / DBD::AnyData
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Heya Jens, yup, other tasks are killing progress at the moment (worse, paid ones) what a terrible firstworld luxury :) which of course makes irc even harder Sven On 13/10/12 06:22, Jens Rehsack wrote: > Hi Sven, > > I didn't talk to you for a while on IRC (I know - widest time zone > difference possible), so I'm trying mail ;) > > Did you made progress on AnyData / DBD::AnyData? Do you need help? Or > are you just busy with other tasks? > > Best regards, > Jens - -- Professional Wiki Innovation and Support Enterprise Support Contracts for Foswiki Sven Dowideit http://fosiki.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlB4pTkACgkQPAwzu0QrW+l5FACeMb4JjRSzKepO/Lbm+Hl+OtYv 2C8AnjHC1Q4Xc+bw5om9iFoOCnrQlqE4 =K4B0 -END PGP SIGNATURE-
Re: Merging DBD::RAM into DBI
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 yup :) https://metacpan.org/source/REHSACK/DBD-AnyData-0.110/README (then search for 'RAM') | ||HISTORICAL NOTE: this module was formerly called DBD::RAM. Its name| | ||was changed because many people were unaware that the module supports| | ||file operations in addition to in-memory operations. See the Changes| | ||file for a description of changes since the last release of DBD::RAM. Not to say that its a bad idea, but there is more up to date code to tease apart in DBD::AnyData :/ The most complicated issue with DBD::AnyData is that is not written only for DBI use, the non-DBI AnyData module is useful by itself (and it does the heavy lifting wrt IO). Sven| On 22/12/12 03:34, Jens Rehsack wrote: > Hi all, > > I'd like to merge DBD::RAM into DBI for several reasons: > > 1) It's a tiny one without much dependencies, it should run fine > with just DBI::Sql::Nano (or should) > > 2) I had an evil idea how to allow Pure-Perl drivers can work > together in one instance like: > > DBI->connect( "dbi:DBM:", , , { > sql_join_drv => "DBD::RAM", ... } ); > > But there is something for testing required ;) > > 3) It currently doesn't get some love, even if it should get. > > Any comments? > > Cheers - -- ____ Professional Wiki Innovation and Support Enterprise Support Contracts for Foswiki Sven Dowideit http://fosiki.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlDU14YACgkQPAwzu0QrW+kyYQCdGxMFncZpz+GVwP2amnZfV8HO 2j0AoKrNkaS8rQcfRZEOE1iywCAFhmuu =al5c -END PGP SIGNATURE-
Re: DBD::AnyData fails "make test"
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I presume you mean with the svn version of DBI::DBD::SQLEngine? yup, terrible timing I think I may get time after 6 Jan but the stack of cards i have to fix now may just blow away :) Sven On 22/12/12 03:18, Jens Rehsack wrote: > Hi Sven, > > I know you're busy and Xmas is coming, but I run a > $make test > for recent DBD::AnyData. > > See the result in http://pasta.test-smoke.org/402 > > If I can help you clearing up, please let me know. > > Merry Christmas - -- Professional Wiki Innovation and Support Enterprise Support Contracts for Foswiki Sven Dowideit http://fosiki.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlDU6d8ACgkQPAwzu0QrW+ksIQCeMA9YWhaf/gRJEVdGqQ3gw3X6 HOYAnAwe3+0XIFbI0B76hIB4eDB9m1Ik =T6pT -END PGP SIGNATURE-
Re: AnyData open API
Heya Søren and Jens, It depends :) The API for the AnyData module is relatively well documented in the code - I was able to use it pretty quickly. on the other hand DBI::AnyData is broken (and this is the issue Jens is talking about) I started to look into this (a year or more ago?) but I had to step back, and havn't found either the time, energy or idea on what to do about it. fundamentally, DBI::AnyData was once a very light wrapper around AnyData, but DBI has changed in ways that makes large parts of AnyData mismatched or redundant. So - if you want a fast to code Tied hash interface into your data, AnyData is pretty nice. But if you really want DBI/SQL access to it, er, then DBI has more modern modules to help you (wrt moving the git repo - do you really want the AnyData code in there, or just DBI::AnyData?) Sven On 12/10/13 00:10, Jens Rehsack wrote: Am 07.10.2013 um 02:37 schrieb Søren Døssing : Where is open API for AnyData documented? In particular I'm interested in how to write a module that does bulk table import/export instead read/write individual records. /etc/hosts file is an example; multiple host names map to a single ip, so adding a record is no longer a matter of a simple append. Hi Søren, I'm sorry to respond such late. To be true - even if I would point you to some documentation, it wouldn't satisfy you're needs neither it would be fair since I plan a more or less hard refactoring. A few month ago we integrated an API into DBI::DBD::SqlEngine for such kind of interaction, especially for DBD::File related DBD's as DBD::AnyData. Because of $work, family, etc. we stuck a bit but today I officially set the NEEDHELP flag on PAUSE which says: I want help to move AnyData and DBD::AD to the improved basic of DBI::DBD::SqlEngine and start over with AnyData. I know Sven has created a GitHub repository. It should be moved to perl5-dbi which would allow anyone on DBI-Team to grant support. Cheers
Re: AnyData open API
Søren I think you have a very good idea there. DBI has pretty strong text access now, making DBI::AnyData deprecatable - and non-DBI AnyData somewhat dubious (its really just a tied-hash API) So making an Augeas (like?) <-> DBI bridge could be very interesting indeed Sven (and atm, i'm pottering around in golang and docker, so not much help) On 01/11/13 10:41, Gmail wrote: Hi Jens and Sven, I understand that AnyData needs a reset. What is consensus if direction? For my project I need to manage a big variety of source formats, so I'll be willing to participate in redesign or coding of AnyData if need be. Otherwise I'll have to dream up my own data format abstraction layer. There are generally four types of sources or formats in my environment Databases accessible through DBI Databases accessible through command line binaries Records based files, such as csv Table based files, such as /etc/hosts, json etc. Any lessons we can stage from Augeas and it's concept of lenses? Or just bridge between Augeas and DBI? Regards, -- Søren On 2013/10/12, at 17:39, Jens Rehsack wrote: Am 12.10.2013 um 00:49 schrieb Sven Dowideit : Heya Søren and Jens, /wave It depends :) The API for the AnyData module is relatively well documented in the code - I was able to use it pretty quickly. on the other hand DBI::AnyData is broken (and this is the issue Jens is talking about) I also talk about your later statement "large parts of AnyData mismatched or redundant" - especially the redundant part. From architectural point of view, AnyData needs a redesign to modularize storage backends, as DBI::DBD::SqlEngine suggests. I started to look into this (a year or more ago?) but I had to step back, and havn't found either the time, energy or idea on what to do about it. fundamentally, DBI::AnyData was once a very light wrapper around AnyData, but DBI has changed in ways that makes large parts of AnyData mismatched or redundant. So - if you want a fast to code Tied hash interface into your data, AnyData is pretty nice. But if you really want DBI/SQL access to it, er, then DBI has more modern modules to help you (wrt moving the git repo - do you really want the AnyData code in there, or just DBI::AnyData?) I want both there, because it more or less belongs together. DBD::AnyData makes no sense without AnyData. I always thought I moved DBD::AnyData from svn.perl.org, but I didn't. I cannot promise for this week - but I try to move asap. Shall I simply fork you're AnyData repo to perl5-dbi and you do a new clone from there? Sven On 12/10/13 00:10, Jens Rehsack wrote: Am 07.10.2013 um 02:37 schrieb Søren Døssing : Where is open API for AnyData documented? In particular I'm interested in how to write a module that does bulk table import/export instead read/write individual records. /etc/hosts file is an example; multiple host names map to a single ip, so adding a record is no longer a matter of a simple append. Hi Søren, I'm sorry to respond such late. To be true - even if I would point you to some documentation, it wouldn't satisfy you're needs neither it would be fair since I plan a more or less hard refactoring. A few month ago we integrated an API into DBI::DBD::SqlEngine for such kind of interaction, especially for DBD::File related DBD's as DBD::AnyData. Because of $work, family, etc. we stuck a bit but today I officially set the NEEDHELP flag on PAUSE which says: I want help to move AnyData and DBD::AD to the improved basic of DBI::DBD::SqlEngine and start over with AnyData. I know Sven has created a GitHub repository. It should be moved to perl5-dbi which would allow anyone on DBI-Team to grant support. Cheers -- Jens Rehsack pkgsrc, Perl5 rehs...@cpan.org
Re: AnyData / DBD::AnyData
Mmmm, to reply to all... Yes please - I currently work for Docker Inc, so barely have time to breath, let alone work on Perl things :) Seriously cool to see something though Sven On 08/10/14 16:03, Jens Rehsack wrote: > Hi Sven, > > it seems I found a tuit wrt. AnyData & DBD::AnyData. > > I've seen your (released) work from Dec 2012 and ask kindly whether it's ok > for you to > move both modules, AnyData and DBD::AnyData to perl5-dbi repository and start > migration > of DataSources concept of DBD::File. AFAIK you told me you don't have any > time for > it and you're happy with any progress - but I'd like to be sure. > > Cheers