Skip Menu |

This queue is for tickets about the XML-LibXML-PrettyPrint CPAN distribution.

Report information
The Basics
Id: 96000
Status: resolved
Priority: 0/
Queue: XML-LibXML-PrettyPrint

People
Owner: Nobody in particular
Requestors: ALTREUS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Utility function, pretty_file
The procedure to pretty-print a file is too long for a tweet: perl -MXML::LibXML -MXML::LibXML::PrettyPrint -e'print XML::LibXML::PrettyPrint->new()->pretty_print(XML::LibXML->new->parse_file(...))' A utility method to construct that object and pretty it would be awesome. So I can tweet it. More utility than being able to tweet it is of course the reduced complexity of parenthesis balancing and quote matching and putting arrows in the right place.
Agreed. Though you should already be able to do something like this: perl -MXML::LibXML::PrettyPrint=print_xml -MFile::Slurp=slurp -e'print_xml scalar slurp "myfile.xml"' ... which ain't too bad.
In fact, even this works: perl -MXML::LibXML::PrettyPrint=print_xml -e'print_xml <>' myfile.xml
On Mon Jun 23 07:39:36 2014, TOBYINK wrote: Show quoted text
> In fact, even this works: > > perl -MXML::LibXML::PrettyPrint=print_xml -e'print_xml <>' myfile.xml
Ah, I don't think I discovered that while reading the docs. Functional version would benefit from being in the synopsis, I think - my presumption was that, because it wasn't in the synopsis, the functionality wasn't there. Or rather, the stuff in the synopsis was the only way to do it, so I didn't seek another way.
I've bundled an "xml-pretty" command-line script with 0.005, so I'm calling this issue closed now.