ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: Creating a web templating engine
by B=C1RTH=C1ZI_Andr=E1s other posts by this author
Jun 14 2005 9:25AM messages near this date
Re: Creating a web templating engine | Creating a web templating engine
Hi,

> > $wte = new WTE;
> > $wte.register('input', &my_input_widget);
> >
> > I don't prefer it, to be 20-30 register line in my programs, that does
> > nothing, just register.
> 
>  maybe something like this?
> 
>   class MyWTE is WTE {
>     method input (...) {...}
>     method some_other_thing_you_would_have_had_to_register (...) {...}
>     ...;
>   }

And how the WTE class will be able to call these methods?

> > new_widget :input => {
> >  my $name = _something_{'id'};
> >  return '<input name="' ~ $name ~ '" />';
> > }
> 
>   new_widget :input => -> Str $id {
>     return '<input name="' ~ $id ~ '" />';
>   };  # or
> 
>   new_widget :input => sub (Str $id) {
>     return '<input name="' ~ $id ~ '" />';
>   }

Hmm. It's still good, isn't it?

new_widget :input =>  sub($id) {
 	...
}

I think I like it. :) I would choose a bit more compact form if it's 
possible (I think, it isn't) - so if somebody has any idea, please let me 
know. :) But it's quite OK.

Thanks,
   Andras
Thread:
Ingo Blechschmidt
B=C1RTH=C1ZI_Andr=E1s

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved