Well, it's a special case and the ability is going to need to be coded into the parser itself (like the 4 special char codes). One of the older versions specifically the one currently in use on my sites, has just such a routine built in. I will make sure it's done by the time I put out the first release.
As for making a custom plugin, it's very simple.
Lets say you want to add a plugin called foo which takes two attributes called bar and baz, and some meta data.
In the aXML doc --------------- <foo bar="hello" baz="world"> good to be here </foo> In your sites private subs module --------------------------------- my $plugins = { foo => sub { my $args = $_[0]; #a hashref my $data = $_[1]; #good to be here $args->{'tag_name'}; #foo $args->{'bar'}; #hello $args->{'baz'}; #world #do some stuff with the args and data here return 'some result'; } };
In the case where your plugin does not need to return any value to the document, you can just return '<null>'. This is to prevent the parser from throwing a warning about doing a substitution on an empty string, and is automatically removed from the document in the post processing stage.
Also you could create a plugin called "lt" with the following code:
lt => sub { return '<'; } or lt => sub { '<' } #golfed :P
However it wouldn't achieve anything and would result exactly the same as just putting a < into the document to begin with.
In reply to Re^26: aXML vs TT2
by Logicus
in thread aXML vs TT2
by Logicus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |