XML, the Perl Way

Home XML::Twig Modules Talks Articles Tutorials Reports Tools PGC mirod Le Blog

Tips and Tricks

24 Feb 2006

Tips and Tricks: Invisible Markup

Did you know that you can include 'invisible' elements and attributes in your documents?

The print methods (print, sprint, flush) will ignore tags or attributes whith a name starting with '#'.

You can use this to store data about elements in invisible attributes (example). You can even store complex data structures attached to an element, if you set the value of the attribute to a reference.

Invisible element names are less useful. The start and end tags of the element are not output, but its content is. You can use this to 'erase' an element tag by prefixing its name with #, but the erase method will do this too, in a cleaner way.

[Tips and Tricks] [permalink]



Comments

Recent

Archives

2006