HELLO WORLD!!use abstractor; #there is no real name yet my $output = abstractor->new(); $output->load_definitions( # dirpath to definitions dir ); #or $output->add_definitions ( { a => 'print "HELLO"', b => 'print "WORLD"', c => 'print "!!"' } ) $output->compute("<a></a> <b></b> <c></c>");
Output :$output->add_definitions ( { a => '$result = "HELLO"', b => '$result = "$data WORLD"', c => '$result = "$data!!"' } ) #$data is the string inside the tag so if you have a #tag <b> which contains the string "HELLO", then $data #will be equal to "HELLO" when the tag is being computed print $output->compute("<html> <head></head> <body> <c><b><a></a></b></c> </body> </html>"); #the interpreter ignores tags that it does not have #definitions for
<html> <head></head> <body> HELLO WORLD!! </body> </html>
HELLO HELLO HELLO$output->add_definitions ( { a => '$result = "HELLO"' }); print $output->compute("<a></a> <a></a> <a></a>\n"); print $output->compute("<a><a><a></a></a></a>\n");
Does it start to make any sort of sense yet? What I'm talking about here is not a framework, altho I have built a framework out of it (it's too slow using my naive methods)$output->add_definitions ( { a => '$result = "<html>$data</html>"', b => '$result = "<body>$data</body>"', c => '$result = "HELLO WORLD!!!"' }); print $output->compute("<a><b><c></c></b></a>\n"); <code> Output : <code> <html><body>HELLO WORLD!!</body></html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC : Abstraction Markup
by dHarry (Abbot) on Jun 29, 2011 at 07:43 UTC | |
|
Re: RFC : Abstraction Markup
by Anonymous Monk on Jun 29, 2011 at 06:42 UTC | |
|
Re: RFC : Abstraction Markup
by luis.roca (Deacon) on Jun 30, 2011 at 02:06 UTC | |
|
Re: RFC : Abstraction Markup
by metaperl (Curate) on Jul 01, 2011 at 16:42 UTC | |
|
Re: RFC : Abstraction Markup
by locked_user sundialsvc4 (Abbot) on Jun 30, 2011 at 03:42 UTC | |
|
Re: RFC : Abstraction Markup
by locked_user sundialsvc4 (Abbot) on Jul 02, 2011 at 19:40 UTC | |
by simonodell (Acolyte) on Jul 11, 2011 at 12:32 UTC | |
by Anonymous Monk on Jul 11, 2011 at 13:09 UTC | |
by yitzchak (Sexton) on Jul 13, 2011 at 01:53 UTC | |
by Anonymous Monk on Jul 13, 2011 at 10:24 UTC | |
by yitzchak (Sexton) on Jul 13, 2011 at 18:03 UTC | |
|