HTML-Spry-DataSet

 view release on metacpan or  search on metacpan

lib/HTML/Spry/DataSet.pm  view on Meta::CPAN

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
my $self = shift;
 
# Open the file
my $file = shift;
my $html  = IO::File->new( $file, "w" );
unless ( defined $html ) {
        Carp::croak("Failed to open '$file' for write");
}
 
# Write the file
$html->say('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
$html->say('<html>');
$html->say('<head>');
$html->say('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
$html->say('</head>');
$html->say('<body>');
foreach my $id ( sort keys %$self ) {
        $html->say("<table id='$id'>");
        foreach my $row ( @{ $self->{$id} } ) {
                $html->say('  <tr>');
                foreach my $cell ( @$row ) {

t/02_main.t  view on Meta::CPAN

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Write out to the HTML file
ok( $dataset->write('dataset.html'), '->write returns ok' );
 
# Read the file back in
open( FILE, '<', 'dataset.html');
local $/ = undef;
my $buffer = <FILE>;
close FILE;
 
is_string( $buffer, <<'END_HTML', '->write creates the correct file' );
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<table id='ds1'>
  <tr>
    <td>Rank</td>
    <td>Dependencies</td>
    <td>Author</td>



( run in 1.750 second using v1.01-cache-2.11-cpan-95122f20152 )