in reply to Re: Re: simpliest way to add "language" to my app
in thread simpliest way to add "language" to my app

Pass raw data to parsing sub

Well, he said the simplest way...

If match not found, give user a list of currently supported commands

Now, that would certainly be a worthwhile enhancement. And easy enough to do, too.

Force lower case

I almost included that... but for some reason I didn't. Perhaps I should have.

Allow synonyms such as halt for shutdown

That may be the best argument for the named subs you mention, actually.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

Replies are listed 'Best First'.
Re: Re: simpliest way to add "language" to my app
by smackdab (Pilgrim) on Oct 05, 2003 at 04:38 UTC
    Thanks these are helpful to look at.

    I am currently using one big switch in a ParseCmd() fn, which is easier for me as each "response" is short.

    What is a mess is validating that each command has the correct number of parameters before I call it. Come to think about it I guess each command fn could exit with an "invalid command" error if there are missing params...I see that your approach handles this much better that what I am doing...just pass an array for the "rest" of the params (if any)

    Still a little wordy if I add 50 commands in the future...but simple!

    thanks