Hi,

    I am writing a module which wraps the table_info() function in DBI. Clearly it need a working database handle to operate on. I want to write some test scripts for it. These work fine on my system, where I can feed them a working databse handle easily.

    How should I provide tests for other people to use, assuming that anyone else is ever mad enough to use this module? I may be missing something fundamental here, but all advice is gratefully accepted.


(Any comments on the basic idea of this module, and whether there's a better solution also welcome)

Anthony Staines

^^^^^^^^^^^^^^^

SYNOPSIS use DBIx::Information; my $dbinf->new($dbh); # Get a list of tables in the database my @tables = @{ $dbinf->tables()}; # Get a list of variables in the whole database my @variables = @{ $dbinf->variables()}; # Get a list of the variable in the table called $table_name; my @myvariable = @{ $dbinf->variable($table_name)}; # Get two useful hashes- # List keyed by table to anonymous arrays of the names of th +e variables in each table # Index keyed by variable name to anonymous arrays of the na +mes of the table # (or tables) in which each variable occurs. # my %list = %{$dbinf->list()}; my %index = %{$dbinf->index()}; #Does the variable exist in the specified table my $exists = $dbinf->IsVarinTable($variable_name,$table_name); DESCRIPTION This module provides a convenient interface to the contents of a s +ingle database, or (possibly) a singe schema. I only have Mysql, and it +*will* work with this. If you have other databases fell free to test... EXPORT Nothing. don't even try. AUTHOR Anthony.Staines@ucd.ie SEE ALSO the perl manpage.

In reply to Writing tests for modules using database handles by astaines

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.