X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FTranslator%2FProducer%2FHTML.pm;h=dad440d394c573e9e2265c9bdfca2afd9f23f293;hb=b4414534f4fb5bfa82073f0768d36914340175e9;hp=9a5bc3da321cc4fbfcc2ce81a644e19abf06b57f;hpb=da06ac74ada30aacf656943306679a28605ad5c8;p=dbsrgits%2FSQL-Translator.git
diff --git a/lib/SQL/Translator/Producer/HTML.pm b/lib/SQL/Translator/Producer/HTML.pm
index 9a5bc3d..dad440d 100644
--- a/lib/SQL/Translator/Producer/HTML.pm
+++ b/lib/SQL/Translator/Producer/HTML.pm
@@ -1,34 +1,13 @@
package SQL::Translator::Producer::HTML;
-# -------------------------------------------------------------------
-# $Id: HTML.pm 1445 2009-02-07 17:50:03Z ashberlin $
-# -------------------------------------------------------------------
-# Copyright (C) 2002-2009 SQLFairy Authors
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; version 2.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA
-# -------------------------------------------------------------------
-
use strict;
+use warnings;
use Data::Dumper;
-use vars qw($VERSION $NOWRAP $NOLINKTABLE $NAME);
-
-$VERSION = '1.99';
-$NAME = __PACKAGE__;
-$NOWRAP = 0 unless defined $NOWRAP;
-$NOLINKTABLE = 0 unless defined $NOLINKTABLE;
+our $VERSION = '1.59';
+our $NAME = __PACKAGE__;
+our $NOWRAP = 0 unless defined $NOWRAP;
+our $NOLINKTABLE = 0 unless defined $NOLINKTABLE;
# Emit XHTML by default
$CGI::XHTML = $CGI::XHTML = 42;
@@ -59,7 +38,7 @@ sub produce {
import CGI::Pretty;
CGI::Pretty->new }
: do { require CGI;
- import CGI;
+ import CGI;
CGI->new };
my ($table, @table_names);
@@ -74,7 +53,7 @@ sub produce {
$q->hr;
}
- @table_names = grep { length $_->name } $schema->get_tables;
+ @table_names = grep { length $_->name } $schema->get_tables;
if ($linktable) {
# Generate top menu, with links to full table information
@@ -82,7 +61,7 @@ sub produce {
$count = sprintf "%d table%s", $count, $count == 1 ? '' : 's';
# Leading table of links
- push @html,
+ push @html,
$q->comment("Table listing ($count)"),
$q->a({ -name => 'top' }),
$q->start_table({ -width => '100%', -class => 'LinkTable'}),
@@ -98,7 +77,7 @@ sub produce {
for my $table (@table_names) {
my $table_name = $table->name;
- push @html,
+ push @html,
$q->comment("Start link to table '$table_name'"),
$q->Tr({ -class => 'LinkTableRow' },
$q->td({ -class => 'LinkTableCell' },
@@ -140,15 +119,15 @@ sub produce {
$q->start_table({ -border => 1 }),
$q->Tr(
$q->th({ -class => 'FieldHeader' },
- [
- 'Field Name',
- 'Data Type',
- 'Size',
- 'Default Value',
- 'Other',
- 'Foreign Key'
+ [
+ 'Field Name',
+ 'Data Type',
+ 'Size',
+ 'Default Value',
+ 'Other',
+ 'Foreign Key'
]
- )
+ )
);
my $i = 0;
@@ -157,7 +136,7 @@ sub produce {
$name = qq[$name];
my $data_type = $field->data_type || '';
my $size = defined $field->size ? $field->size : '';
- my $default = defined $field->default_value
+ my $default = defined $field->default_value
? $field->default_value : '';
my $comment = $field->comments || '';
my $fk = '';
@@ -166,7 +145,7 @@ sub produce {
my $c = $field->foreign_key_reference;
my $ref_table = $c->reference_table || '';
my $ref_field = ($c->reference_fields)[0] || '';
- $fk =
+ $fk =
qq[$ref_table.$ref_field];
}
@@ -193,11 +172,11 @@ sub produce {
# Indices
#
if ( my @indices = $table->get_indices ) {
- push @html,
+ push @html,
$q->h3('Indices'),
$q->start_table({ -border => 1 }),
$q->Tr({ -class => 'IndexRow' },
- $q->th([ 'Name', 'Fields' ])
+ $q->th([ 'Name', 'Fields' ])
);
for my $index ( @indices ) {
@@ -216,14 +195,14 @@ sub produce {
#
# Constraints
#
- my @constraints =
+ my @constraints =
grep { $_->type ne PRIMARY_KEY } $table->get_constraints;
if ( @constraints ) {
- push @html,
+ push @html,
$q->h3('Constraints'),
$q->start_table({ -border => 1 }),
$q->Tr({ -class => 'IndexRow' },
- $q->th([ 'Type', 'Fields' ])
+ $q->th([ 'Type', 'Fields' ])
);
for my $c ( @constraints ) {
@@ -334,7 +313,7 @@ insignificant whitespace and be generally smaller.
=head1 AUTHORS
-Ken Y. Clark Ekclark@cpan.orgE,
+Ken Youens-Clark Ekclark@cpan.orgE,
Darren Chamberlain Edarren@cpan.orgE.
=cut