in reply to XML::Maker
package XML::AUTOLOAD; use vars qw($AUTOLOAD); sub new {bless{},shift}; sub DESTROY {} sub AUTOLOAD { my ($self,$attr,@data) = @_; my ($tag) = $AUTOLOAD =~ /:(\w+)$/; my $out = "<$tag"; if (ref $attr eq 'HASH') { $out .= qq| $_="$attr->{$_}"| for keys %$attr; } elsif (defined $attr) { unshift @data,$attr; } $out .= @data ? ">@data</$tag>" : " />"; } 1; =head1 NAME XML::AUTOLOAD - Generates XML =head1 SYNOPSIS #!/usr/bin/perl use strict; use warnings; my $xml = XML::AUTOLOAD->new; print $xml->xml( $xml->foo({baz => 'qux'}, $xml->bar(0), $xml->baz({foo=>'bar'}), ), $xml->qux, ); =cut
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Maker
by Aristotle (Chancellor) on Oct 06, 2003 at 10:46 UTC | |
|
Re: Re: XML::Maker
by vadim_t (Acolyte) on Oct 06, 2003 at 14:23 UTC |