r33438 - in /branches/upstream/libclass-dbi-plugin-type-perl: ./ current/ current/Changes current/MANIFEST current/META.yml current/Makefile.PL current/README current/Type.pm current/t/ current/t/1.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Thu Apr 16 03:43:02 UTC 2009


Author: ryan52-guest
Date: Thu Apr 16 03:42:57 2009
New Revision: 33438

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=33438
Log:
[svn-inject] Installing original source of libclass-dbi-plugin-type-perl

Added:
    branches/upstream/libclass-dbi-plugin-type-perl/
    branches/upstream/libclass-dbi-plugin-type-perl/current/
    branches/upstream/libclass-dbi-plugin-type-perl/current/Changes
    branches/upstream/libclass-dbi-plugin-type-perl/current/MANIFEST
    branches/upstream/libclass-dbi-plugin-type-perl/current/META.yml
    branches/upstream/libclass-dbi-plugin-type-perl/current/Makefile.PL
    branches/upstream/libclass-dbi-plugin-type-perl/current/README
    branches/upstream/libclass-dbi-plugin-type-perl/current/Type.pm
    branches/upstream/libclass-dbi-plugin-type-perl/current/t/
    branches/upstream/libclass-dbi-plugin-type-perl/current/t/1.t

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/Changes?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/Changes (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/Changes Thu Apr 16 03:42:57 2009
@@ -1,0 +1,11 @@
+Revision history for Perl extension Class::DBI::Plugin::Type.
+
+0.02  Thu Apr  1 17:47:23 BST 2004
+    - Silence warnings about statement handles
+    - Return if already set up.
+    - We don't need 5.8.1
+
+0.01  Mon Mar 15 18:08:00 2004
+	- original version; created by h2xs 1.22 with options
+		-AX -n Class::DBI::Plugin::Type
+

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/MANIFEST?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/MANIFEST (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/MANIFEST Thu Apr 16 03:42:57 2009
@@ -1,0 +1,7 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+Type.pm
+t/1.t
+META.yml                                Module meta-data (added by MakeMaker)

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/META.yml?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/META.yml (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/META.yml Thu Apr 16 03:42:57 2009
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Class-DBI-Plugin-Type
+version:      0.02
+version_from: Type.pm
+installdirs:  site
+requires:
+    Class::DBI:                    0
+    DBI:                           0.94
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.21

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/Makefile.PL?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/Makefile.PL (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/Makefile.PL Thu Apr 16 03:42:57 2009
@@ -1,0 +1,14 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'Class::DBI::Plugin::Type',
+    VERSION_FROM      => 'Type.pm', # finds $VERSION
+    PREREQ_PM         => {
+        DBI => "0.94",
+        Class::DBI => 0
+    }, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'Type.pm', # retrieve abstract from module
+       AUTHOR         => 'Simon Cozens <simon at cpan.org>') : ()),
+);

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/README?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/README (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/README Thu Apr 16 03:42:57 2009
@@ -1,0 +1,38 @@
+Class/DBI/Plugin/Type version 0.01
+==================================
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the
+README file from a module distribution so that people browsing the
+archive can use it get an idea of the modules uses. It is usually a
+good idea to provide version information here so that people can
+decide whether fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  blah blah blah
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2004 Simon Cozens
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself. 
+

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/Type.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/Type.pm?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/Type.pm (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/Type.pm Thu Apr 16 03:42:57 2009
@@ -1,0 +1,82 @@
+package Class::DBI::Plugin::Type;
+
+use strict;
+use warnings;
+
+our $VERSION = '0.02';
+
+sub import {
+    no strict 'refs';
+    my $caller = caller();
+    #if ($caller->isa("Class::DBI::mysql") and
+    #    $caller->can("column_type")) {
+    #    return; # My work here is done
+    #}
+
+    return if $caller->can("sql_dummy");
+    $caller->set_sql(dummy => <<'');
+        SELECT *
+        FROM __TABLE__
+        WHERE 1=0
+
+    $caller->mk_classdata("_types");
+    *{$caller."::column_type"} = sub {
+        my ($self, $column) = @_;
+        if (!$self->_types) {
+            my $sth = $self->sql_dummy;
+            $sth->execute;
+            my %hash;
+            @hash{@{$sth->{NAME}}} = 
+            map { 
+                    my $info = scalar $self->db_Main->type_info($_);
+                    if ($info) { $info->{TYPE_NAME} } 
+                    else { $_ } # Typeless databases (SQLite)
+                }
+                @{$sth->{TYPE}};
+            $sth->finish;
+            $self->_types(\%hash);
+        }
+        return $self->_types->{$column};
+    }   
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Class::DBI::Plugin::Type - Determine type information for columns
+
+=head1 SYNOPSIS
+
+  package Music::Artist;
+  use base 'Class::DBI';
+  use Class::DBI::Plugin::Type;
+  Music::Artist->table('artist');
+  Music::Artist->columns(All => qw/artistid name/);
+
+  print Music::Artist->column_type("artistid"); # integer
+
+=head1 DESCRIPTION
+
+This module allows C<Class::DBI>-based classes to query their columns
+for data type information in a database-independent manner. 
+
+=head1 SEE ALSO
+
+L<Class::DBI::AsForm>
+
+=head1 AUTHOR
+
+Simon Cozens, E<lt>simon at cpan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2004 by Simon Cozens
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself. 
+
+This module was generously sponsored by the Perl Foundation.
+
+=cut

Added: branches/upstream/libclass-dbi-plugin-type-perl/current/t/1.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-dbi-plugin-type-perl/current/t/1.t?rev=33438&op=file
==============================================================================
--- branches/upstream/libclass-dbi-plugin-type-perl/current/t/1.t (added)
+++ branches/upstream/libclass-dbi-plugin-type-perl/current/t/1.t Thu Apr 16 03:42:57 2009
@@ -1,0 +1,32 @@
+package DBI::Test;
+
+use Test::More;
+if (!require DBD::SQLite) {
+    plan skip_all => "Couldn't load DBD::SQLite";
+}
+plan tests => 6;
+
+use base 'Class::DBI';
+
+unlink 't/test.db';
+DBI::Test->set_db("Main", "dbi:SQLite:dbname=t/test.db");
+#DBI::Test->set_db("Main", "dbi:mysql:dbname=beerdb");
+eval { DBI::Test->db_Main->do("DROP TABLE test") };
+DBI::Test->db_Main->do("CREATE TABLE test (
+    id int not null,
+    brewery integer,
+    style integer,
+    name varchar(30),
+    url varchar(120),
+    tasted date,
+    score integer(2),
+    notes text,
+    price decimal(4,2)
+)");
+DBI::Test->table("test");
+use_ok('Class::DBI::Plugin::Type');
+like(DBI::Test->column_type("notes"), qr/text|blob/, "notes is text");
+is(DBI::Test->column_type("tasted"), "date", "tasted is a date");
+like(DBI::Test->column_type("price"), qr/^decimal/, "price is decimal");
+like(DBI::Test->column_type("id"), qr/^int/, "id is integer");
+like(DBI::Test->column_type("name"), qr/^varchar/, "name is varchar");




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