SPUG: Using ',=' in list context?
Tom Legrady
legrady at earthlink.net
Fri May 3 17:28:58 CDT 2002
I have a module, TEXT::ASED, which provides a functional interface to /// style operators. You might think it counter-productive to take soemthing short and simple and unreadable, and stretch it out
into a long block of self-documenting function calls. On the other hand, if you need to manipulate a set of files which varies depending on localiation and itnernationalization, the functional approach
makes it easier to separate the regional variations from the main line of code, even to place the regional components in seperate files. That way, when the localization experts modify their components,
there's no risk of them damaging your code with a typo.
The module works by saving up a set of directives, and then processing the directives to generate code which is run using eval(). It's essentially a recursive descent parsr. Each routine returns two
values, a chunk of code which is used near the top of the eval()ed code, and a chunk which goes within the loop which processes each line of input ...
( $tmp_decl, $tmp_code ) = gen_X( $params );
$decl .= $tmp_decl;
$code .= code;
Is there any way to overload the way ,= operates in a list context, so I can write ...
( $decl, $code ) .= gen_X( $params );
TomDLux
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list