r30486 - in /trunk/liborlite-perl: ./ debian/ inc/Module/ inc/Module/Install/ lib/ t/ t/lib/

rmayorga at users.alioth.debian.org rmayorga at users.alioth.debian.org
Fri Feb 6 01:44:54 UTC 2009


Author: rmayorga
Date: Fri Feb  6 01:44:51 2009
New Revision: 30486

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=30486
Log:
* New upstream release
* debian/control:  update my email address
* debian/copyright: update inc/* copyright years.

Modified:
    trunk/liborlite-perl/Changes
    trunk/liborlite-perl/META.yml
    trunk/liborlite-perl/Makefile.PL
    trunk/liborlite-perl/README
    trunk/liborlite-perl/debian/changelog
    trunk/liborlite-perl/debian/control
    trunk/liborlite-perl/debian/copyright
    trunk/liborlite-perl/inc/Module/Install.pm
    trunk/liborlite-perl/inc/Module/Install/Base.pm
    trunk/liborlite-perl/inc/Module/Install/Can.pm
    trunk/liborlite-perl/inc/Module/Install/Fetch.pm
    trunk/liborlite-perl/inc/Module/Install/Makefile.pm
    trunk/liborlite-perl/inc/Module/Install/Metadata.pm
    trunk/liborlite-perl/inc/Module/Install/Win32.pm
    trunk/liborlite-perl/inc/Module/Install/With.pm
    trunk/liborlite-perl/inc/Module/Install/WriteAll.pm
    trunk/liborlite-perl/lib/ORLite.pm
    trunk/liborlite-perl/t/06_create.t
    trunk/liborlite-perl/t/lib/Test.pm

Modified: trunk/liborlite-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/Changes?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/Changes (original)
+++ trunk/liborlite-perl/Changes Fri Feb  6 01:44:51 2009
@@ -1,4 +1,9 @@
 Changes for Perl extension ORLite
+
+1.19 Tue  3 Feb 2009
+	- Adding support for using a CODE reference in the 'create'
+	  parameter, so that the schema setup can be provided directly
+	  in the ORLite initialisation.
 
 1.18 Wed 14 Jan 2009
 	- Adding an ->orlite method to return the version number of the

Modified: trunk/liborlite-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/META.yml?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/META.yml (original)
+++ trunk/liborlite-perl/META.yml Fri Feb  6 01:44:51 2009
@@ -5,7 +5,7 @@
 build_requires:
   Test::More: 0.47
 distribution_type: module
-generated_by: 'Module::Install version 0.77'
+generated_by: 'Module::Install version 0.78'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,9 +20,9 @@
   DBD::SQLite: 1.14
   DBI: 1.58
   File::Spec: 0.80
-  File::Temp: 0.17
+  File::Temp: 0.20
   Params::Util: 0.33
   perl: 5.6.0
 resources:
   license: http://dev.perl.org/licenses/
-version: 1.18
+version: 1.19

Modified: trunk/liborlite-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/Makefile.PL?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/Makefile.PL (original)
+++ trunk/liborlite-perl/Makefile.PL Fri Feb  6 01:44:51 2009
@@ -1,8 +1,8 @@
-use inc::Module::Install 0.77;
+use inc::Module::Install 0.78;
 
 all_from      'lib/ORLite.pm';
 requires      'File::Spec'   => winlike() ? '3.2701' : '0.80';
-requires      'File::Temp'   => '0.17';
+requires      'File::Temp'   => '0.20';
 requires      'Params::Util' => '0.33';
 requires      'DBI'          => '1.58';
 requires      'DBD::SQLite'  => '1.14';

Modified: trunk/liborlite-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/README?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/README (original)
+++ trunk/liborlite-perl/README Fri Feb  6 01:44:51 2009
@@ -13,8 +13,8 @@
       );
 
 DESCRIPTION
-    SQLite is a light weight single file SQL database that provides an
-    excellent platform for embedded storage of structured data.
+    SQLite is a light single file SQL database that provides an excellent
+    platform for embedded storage of structured data.
 
     However, while it is superficially similar to a regular server-side SQL
     database, SQLite has some significant attributes that make using it like
@@ -33,12 +33,13 @@
     is designed specifically for SQLite and is aligned with its
     idiosyncracies.
 
-    ORLite is an object-relation system specifically for SQLite that follows
-    many of the same principles as the ::Tiny series of modules and has a
-    design that aligns directly to the capabilities of SQLite.
+    ORLite is an object-relation system specifically tailored for SQLite
+    that follows many of the same principles as the ::Tiny series of modules
+    and has a design and feature set that aligns directly to the
+    capabilities of SQLite.
 
     Further documentation will be available at a later time, but the
-    synopsis gives a pretty good idea of how it will work.
+    synopsis gives a pretty good idea of how it works.
 
 How it Works
     In short, ORLite discovers the schema of a SQLite database, and then
@@ -249,6 +250,9 @@
 AUTHOR
     Adam Kennedy <adamk at cpan.org>
 
+SEE ALSO
+    ORLite::Mirror, ORLite::Migrate
+
 COPYRIGHT
     Copyright 2008 - 2009 Adam Kennedy.
 

Modified: trunk/liborlite-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/changelog?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/changelog (original)
+++ trunk/liborlite-perl/debian/changelog Fri Feb  6 01:44:51 2009
@@ -1,3 +1,11 @@
+liborlite-perl (1.19-1) unstable; urgency=low
+
+  * New upstream release
+  * debian/control:  update my email address
+  * debian/copyright: update inc/* copyright years.
+
+ -- Rene Mayorga <rmayorga at debian.org>  Thu, 05 Feb 2009 19:35:01 -0600
+
 liborlite-perl (1.18-1) unstable; urgency=low
 
   [ Brian Cassidy ]

Modified: trunk/liborlite-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/control?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/control (original)
+++ trunk/liborlite-perl/debian/control Fri Feb  6 01:44:51 2009
@@ -9,7 +9,7 @@
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Damyan Ivanov <dmn at debian.org>, Gunnar Wolf <gwolf at debian.org>,
  Brian Cassidy <brian.cassidy at gmail.com>, 
- Rene Mayorga <rmayorga at debian.org.sv>,
+ Rene Mayorga <rmayorga at debian.org>,
  Jaldhar H. Vyas <jaldhar at debian.org>
 Standards-Version: 3.8.0
 Homepage: http://search.cpan.org/dist/ORLite/

Modified: trunk/liborlite-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/debian/copyright?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/debian/copyright (original)
+++ trunk/liborlite-perl/debian/copyright Fri Feb  6 01:44:51 2009
@@ -12,7 +12,7 @@
     under the same terms as Perl itself.
 
 Files: inc/*
-Copyright: © 2002-2008, Brian Ingerson, Audrey Tang and Adam Kennedy.
+Copyright: © 2002-2009, Brian Ingerson, Audrey Tang and Adam Kennedy.
 License: GPL-1+ | Artistic
 
 Files: debian/*

Modified: trunk/liborlite-perl/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install.pm Fri Feb  6 01:44:51 2009
@@ -30,7 +30,7 @@
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 
 	*inc::Module::Install::VERSION = *VERSION;
 	@inc::Module::Install::ISA     = __PACKAGE__;
@@ -250,7 +250,7 @@
 sub load_extensions {
 	my ($self, $path, $top) = @_;
 
-	unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) {
+	unless ( grep { !ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
 		unshift @INC, $self->{prefix};
 	}
 
@@ -366,4 +366,4 @@
 
 1;
 
-# Copyright 2008 Adam Kennedy.
+# Copyright 2008 - 2009 Adam Kennedy.

Modified: trunk/liborlite-perl/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/Base.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/Base.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/Base.pm Fri Feb  6 01:44:51 2009
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.77';
+$VERSION = '0.78';
 
 # Suspend handler for "redefined" warnings
 BEGIN {

Modified: trunk/liborlite-perl/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/Can.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/Can.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/Can.pm Fri Feb  6 01:44:51 2009
@@ -11,7 +11,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: trunk/liborlite-perl/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/Fetch.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/Fetch.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/Fetch.pm Fri Feb  6 01:44:51 2009
@@ -6,20 +6,20 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
 
 sub get_file {
     my ($self, %args) = @_;
-    my ($scheme, $host, $path, $file) = 
+    my ($scheme, $host, $path, $file) =
         $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
 
     if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
         $args{url} = $args{ftp_url}
             or (warn("LWP support unavailable!\n"), return);
-        ($scheme, $host, $path, $file) = 
+        ($scheme, $host, $path, $file) =
             $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
     }
 

Modified: trunk/liborlite-perl/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/Makefile.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/Makefile.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/Makefile.pm Fri Feb  6 01:44:51 2009
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -64,7 +64,7 @@
 	my $self  = shift;
 	my $clean = $self->makemaker_args->{clean} ||= {};
 	  %$clean = (
-		%$clean, 
+		%$clean,
 		FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
 	);
 }
@@ -73,7 +73,7 @@
 	my $self      = shift;
 	my $realclean = $self->makemaker_args->{realclean} ||= {};
 	  %$realclean = (
-		%$realclean, 
+		%$realclean,
 		FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
 	);
 }
@@ -124,7 +124,7 @@
 
 	$self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
 
-	# Generate the 
+	# Generate the
 	my $args = $self->makemaker_args;
 	$args->{DISTNAME} = $self->name;
 	$args->{NAME}     = $self->module_name || $self->name;
@@ -196,7 +196,7 @@
 	my $top_class     = ref($self->_top) || '';
 	my $top_version   = $self->_top->VERSION || '';
 
-	my $preamble = $self->preamble 
+	my $preamble = $self->preamble
 		? "# Preamble by $top_class $top_version\n"
 			. $self->preamble
 		: '';

Modified: trunk/liborlite-perl/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/Metadata.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/Metadata.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/Metadata.pm Fri Feb  6 01:44:51 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -178,8 +178,9 @@
 
 	# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
 	# numbers (eg, 5.006001 or 5.008009).
-
-	$version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d",$1,$2,$3)/e;
+	# Also, convert double-part versions (eg, 5.8)
+
+	$version =~ s/^(\d+)\.(\d+)(?:\.(\d+))?$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
 
 	$version =~ s/_.+$//;
 	$version = $version + 0; # Numify
@@ -451,9 +452,6 @@
 		while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
 			$pattern =~ s{\s+}{\\s+}g;
 			if ( $license_text =~ /\b$pattern\b/i ) {
-				if ( $osi and $license_text =~ /All rights reserved/i ) {
-					print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
-				}
 				$self->license($license);
 				return 1;
 			}
@@ -482,19 +480,4 @@
 	return 1;
 }
 
-sub install_script {
-	my $self = shift;
-	my $args = $self->makemaker_args;
-	my $exe  = $args->{EXE_FILES} ||= [];
-        foreach ( @_ ) {
-		if ( -f $_ ) {
-			push @$exe, $_;
-		} elsif ( -d 'script' and -f "script/$_" ) {
-			push @$exe, "script/$_";
-		} else {
-			die("Cannot find script '$_'");
-		}
-	}
-}
-
 1;

Modified: trunk/liborlite-perl/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/Win32.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/Win32.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/Win32.pm Fri Feb  6 01:44:51 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: trunk/liborlite-perl/inc/Module/Install/With.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/With.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/With.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/With.pm Fri Feb  6 01:44:51 2009
@@ -8,7 +8,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: trunk/liborlite-perl/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/inc/Module/Install/WriteAll.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/inc/Module/Install/WriteAll.pm (original)
+++ trunk/liborlite-perl/inc/Module/Install/WriteAll.pm Fri Feb  6 01:44:51 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.77';
+	$VERSION = '0.78';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: trunk/liborlite-perl/lib/ORLite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/lib/ORLite.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/lib/ORLite.pm (original)
+++ trunk/liborlite-perl/lib/ORLite.pm Fri Feb  6 01:44:51 2009
@@ -7,12 +7,12 @@
 use Carp         ();
 use File::Spec   ();
 use File::Temp   ();
-use Params::Util qw{ _STRING _CLASS _HASH };
+use Params::Util qw{ _STRING _CLASS _HASHLIKE _CODELIKE };
 use DBI          ();
 
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.18';
+	$VERSION = '1.19';
 
 	# DBD::SQLite has a bug that generates a spurious warning
 	# at compile time, so we need to temporarily disable them.
@@ -48,7 +48,7 @@
 			package  => undef, # Automatic
 			tables   => 1,
 		);
-	} elsif ( _HASH($_[1]) ) {
+	} elsif ( _HASHLIKE($_[1]) ) {
 		%params = %{ $_[1] };
 	} else {
 		Carp::croak("Missing, empty or invalid params HASH");
@@ -81,10 +81,16 @@
 
 	# Connect to the database
 	my $file     = File::Spec->rel2abs($params{file});
+	my $created  = ! -f $params{file};
 	my $pkg      = $params{package};
 	my $readonly = $params{readonly};
 	my $dsn      = "dbi:SQLite:$file";
 	my $dbh      = DBI->connect($dsn);
+
+	# Schema creation support
+	if ( $created and _CODELIKE($params{create}) ) {
+		$params{create}->( $dbh );
+	}
 
 	# Check the schema version before generating
 	my $version  = $dbh->selectrow_arrayref('pragma user_version')->[0];
@@ -384,7 +390,7 @@
 
 =head1 DESCRIPTION
 
-L<SQLite> is a light weight single file SQL database that provides an
+L<SQLite> is a light single file SQL database that provides an
 excellent platform for embedded storage of structured data.
 
 However, while it is superficially similar to a regular server-side SQL
@@ -403,12 +409,13 @@
 What this situation would seem to need is an object-relation system that is
 designed specifically for SQLite and is aligned with its idiosyncracies.
 
-ORLite is an object-relation system specifically for SQLite that follows
-many of the same principles as the ::Tiny series of modules and has a
-design that aligns directly to the capabilities of SQLite.
+ORLite is an object-relation system specifically tailored for SQLite that
+follows many of the same principles as the ::Tiny series of modules and
+has a design and feature set that aligns directly to the capabilities of
+SQLite.
 
 Further documentation will be available at a later time, but the synopsis
-gives a pretty good idea of how it will work.
+gives a pretty good idea of how it works.
 
 =head1 How it Works
 
@@ -635,6 +642,10 @@
 
 Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
+=head1 SEE ALSO
+
+L<ORLite::Mirror>, L<ORLite::Migrate>
+
 =head1 COPYRIGHT
 
 Copyright 2008 - 2009 Adam Kennedy.

Modified: trunk/liborlite-perl/t/06_create.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/t/06_create.t?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/t/06_create.t (original)
+++ trunk/liborlite-perl/t/06_create.t Fri Feb  6 01:44:51 2009
@@ -9,16 +9,24 @@
 	$^W = 1;
 }
 
-use Test::More tests => 8;
+use Test::More tests => 19;
 use File::Spec::Functions ':ALL';
 use t::lib::Test;
 
-# Set up the file
-my $file = test_db();
 
-# Create the test package
-eval <<"END_PERL"; die $@ if $@;
-package Foo::Bar;
+
+
+
+#####################################################################
+# Simple Test Creation
+
+SCOPE: {
+	# Set up the file
+	my $file = test_db();
+
+	# Create the test package
+	eval <<"END_PERL"; die $@ if $@;
+package My::Test1;
 
 use strict;
 use ORLite {
@@ -30,15 +38,73 @@
 1;
 END_PERL
 
-ok( Foo::Bar->can('connect'), 'Created read code'  );
-ok( Foo::Bar->can('begin'),   'Created write code' );
+	ok( My::Test1->can('connect'), 'Created read code'  );
+	ok( My::Test1->can('begin'),   'Created write code' );
 
-# Test ability to get and set pragmas
-is( Foo::Bar->pragma('schema_version' ), 0, 'schema_version is zero' );
-is( Foo::Bar->pragma('user_version' ), 0, 'user_version is zero' );
-is( Foo::Bar->pragma('user_version', 2 ), 2, 'Set user_version' );
-is( Foo::Bar->pragma('user_version' ), 2, 'Confirm user_version changed' );
+	# Test ability to get and set pragmas
+	is( My::Test1->pragma('schema_version' ), 0, 'schema_version is zero' );
+	is( My::Test1->pragma('user_version' ), 0, 'user_version is zero' );
+	is( My::Test1->pragma('user_version', 2 ), 2, 'Set user_version' );
+	is( My::Test1->pragma('user_version' ), 2, 'Confirm user_version changed' );
 
-# Test that the schema_version is updated as expected
-ok( Foo::Bar->do('create table foo ( bar int )'), 'Created test table' );
-is( Foo::Bar->pragma('schema_version' ), 1, 'schema_version is zero' );
+	# Test that the schema_version is updated as expected
+	ok( My::Test1->do('create table foo ( bar int )'), 'Created test table' );
+	is( My::Test1->pragma('schema_version' ), 1, 'schema_version is zero' );
+}
+
+
+
+
+
+#####################################################################
+# Complex Test Case
+
+SCOPE: {
+	# Set up the file
+	my $file = test_db();
+
+	# Create the test package
+	eval <<"END_PERL"; die $@ if $@;
+package My::Test2;
+
+use strict;
+use ORLite {
+	file   => '$file',
+	create => sub {
+		my \$dbh = shift;
+
+		# Set up the test database
+		\$dbh->do( 'create table foo ( bar int not null primary key )' );
+		\$dbh->do( 'pragma user_version = 2'      );
+		\$dbh->do( 'insert into foo values ( 5 )'        );
+		\$dbh->do( 'insert into foo values ( ? )', {}, 7 );
+
+		return 1;
+	},
+	user_version => 2,
+};
+
+1;
+END_PERL
+
+	# Transaction basics
+	ok( My::Test2->can('connect'), 'Created read code'  );
+	ok( My::Test2->can('begin'),   'Created write code' );
+
+	# Test ability to get and set pragmas
+	is( My::Test2->pragma('schema_version'), 1, 'schema_version is zero' );
+	is( My::Test2->pragma('user_version'),   2, 'Confirm user_version changed' );
+
+	# Check for the existance of the generated table and objects
+	my @object = My::Test2::Foo->select;
+	is( scalar(@object), 2, 'Found 2 Foo objects' );
+	isa_ok( $object[0], 'My::Test2::Foo' );
+	isa_ok( $object[1], 'My::Test2::Foo' );
+	is( $object[0]->bar, 5, '->foo ok' );
+	is( $object[1]->bar, 7, '->foo ok' );
+
+	# Make sure it's a full readwrite interface
+	my $create = My::Test2::Foo->create( bar => 3 );
+	isa_ok( $create, 'My::Test2::Foo' );
+	is( $create->bar, 3, '->bar ok' );
+}

Modified: trunk/liborlite-perl/t/lib/Test.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liborlite-perl/t/lib/Test.pm?rev=30486&op=diff
==============================================================================
--- trunk/liborlite-perl/t/lib/Test.pm (original)
+++ trunk/liborlite-perl/t/lib/Test.pm Fri Feb  6 01:44:51 2009
@@ -8,7 +8,7 @@
 
 use vars qw{$VERSION @ISA @EXPORT};
 BEGIN {
-        $VERSION = '1.18';
+        $VERSION = '1.19';
 	@ISA     = qw{ Exporter };
 	@EXPORT  = qw{ test_db connect_ok create_ok };
 }




More information about the Pkg-perl-cvs-commits mailing list