[Catalyst] HTML::Widget and output into a html table

Matt S Trout dbix-class at trout.me.uk
Fri Feb 10 01:03:44 CET 2006


On Thu, Feb 09, 2006 at 05:37:32PM -0500, John Lifsey - Contractor - wrote:
> Seeing those two lines of code is about the best thing thats happened to 
> my life with Catalyst since HTML::Widget.
> ++

Also bear in mind there's a Catalyst::View::XSLT (though it's a 0.01 and
you need a Build.PL-aware CPAN.pm - it's the author's first ever CPAN dist
though so it's fair enough), and I just checked a module called XML::Declare
into bast trunk which lets me do (for e.g.)

  my @columns = $self->source->columns;
  my @results = $self->source->resultset->search->all;
  my @labels = map { $self->source->column_info($_)->{label} } @columns;
  {
    package XML::Declare;
    $c->res->body(
      _html(
        _body(
          _table(
            _tr(map { _th($_) } @labels),
              map { my $obj = $_; _tr(map { _td($obj->$_) } @columns) } @results
      )))->toString(1)
    );
  }

for quick-and-dirty XML generation to throw at a stylesheet.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list