Thank you very much for your answer Mike. It's an interesting way to do it 
and it gave me some new ideas. :-)

Have you seen phperl.pm? You can google for it. Now, that's being crazy. I 
mean... why in heaven would anyone want to write Perl with the same 
dirtyness as PHP? :-) It's anyway an interesting use to Filters too, though.

Thanks again.


Cheers,

Paco Zarabozo




From: Mike Gillis
Sent: Saturday, March 22, 2008 6:53 PM
To: Zarabozo, Francisco (GE, Corporate)
Cc: Active State Perl Mailing List
Subject: Re: Perl Prototypes


On Mar 22, 2008, at 8:43 AM, Zarabozo, Francisco ((GE, Corporate))
wrote:

> I want to write a sub so I can use it like this:
>
> --------------------------------
> mysub (a => 1, b => 2, c => 3) {
>    # ...CODE...
> };
> --------------------------------

Well, you can't do exactly that. The perl parser as it stands already
gets confused between what is supposed to be a value and what is
supposed to be interpreted, and I think handling the above case would
cause a massive amount of headaches for whoever was brave enough to
try adding support for it.

But you can, if you are adventurous (or crazy), try and do something
like that using a combination of attributes, prototyping, and source
filters. It's a Saturday, and I am either adventurous or crazy
depending on who you ask, so I gave it a shot. :)

It's not perfect, but perhaps it will give you a good place to start
from if you really want to delve into it.

Package, example script and output is attached.

Cheers,
Mike Gillis 

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to