M
Mothra
Hi All,
I need some help formatting text output using Text table.
Is there a way to increase the space between the columns?
The output from what I have is:
Date Sunset Time
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
What I would like is:
Date Sunset Time
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
(I hope the newsreader does not screw this up)
I need to increase the space between the columns.
Also, Is there a way to add an overall title?
like:
Covenant Christian School location
Date Sunset Time
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
Have the main title ( Coventant Christian school location) the
main center then Date (centered) Sunset Time (centered).
I hope this makes sense.
Thanks
Mothra
#!/app/perl5.8.0/bin/perl
use strict;
use warnings;
use Text::Table;
use DateTime;
use DateTime::Event::Sunrise;
my $dt = DateTime->new( year => 2003,
month => 12,
day => 01,
time_zone => 'America/Los_Angeles',
);
my $dt2 = DateTime->new( year => 2003,
month => 12,
day => 31,
time_zone => 'America/Los_Angeles',
);
my $sunset = DateTime::Event::Sunrise ->sunset(
longitude =>'-117.82399' ,
latitude => '33.80525',
);
my $dt_span = DateTime::Span->new( start =>$dt, end=>$dt2 );
my $set = $sunset->intersection($dt_span);
my $iter = $set->iterator;
my $tb = Text::Table->new(
{ title => 'Date', align_title => 'center' },
{ title => 'Sunset Time', align_title => 'center' }
);
for (1..32) {
my $tmp = $iter->next;
$tb->load(
[ $tmp->mdy('/'), $tmp->hms(':') ]
);
}
print $tb;
I need some help formatting text output using Text table.
Is there a way to increase the space between the columns?
The output from what I have is:
Date Sunset Time
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
What I would like is:
Date Sunset Time
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
(I hope the newsreader does not screw this up)
I need to increase the space between the columns.
Also, Is there a way to add an overall title?
like:
Covenant Christian School location
Date Sunset Time
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
Have the main title ( Coventant Christian school location) the
main center then Date (centered) Sunset Time (centered).
I hope this makes sense.
Thanks
Mothra
#!/app/perl5.8.0/bin/perl
use strict;
use warnings;
use Text::Table;
use DateTime;
use DateTime::Event::Sunrise;
my $dt = DateTime->new( year => 2003,
month => 12,
day => 01,
time_zone => 'America/Los_Angeles',
);
my $dt2 = DateTime->new( year => 2003,
month => 12,
day => 31,
time_zone => 'America/Los_Angeles',
);
my $sunset = DateTime::Event::Sunrise ->sunset(
longitude =>'-117.82399' ,
latitude => '33.80525',
);
my $dt_span = DateTime::Span->new( start =>$dt, end=>$dt2 );
my $set = $sunset->intersection($dt_span);
my $iter = $set->iterator;
my $tb = Text::Table->new(
{ title => 'Date', align_title => 'center' },
{ title => 'Sunset Time', align_title => 'center' }
);
for (1..32) {
my $tmp = $iter->next;
$tb->load(
[ $tmp->mdy('/'), $tmp->hms(':') ]
);
}
print $tb;