To tired to focus on code at the moment, yet much to awake to sleep \o/. Been tinkering with an old project: tpsh. Mostly I've been polishing the codebase and doing a bit of refactoring; there's no a debug mode, which reduces some of the cruft that's crept in from testing. Sometime I also need to import the test scripts lol.
One of the changes, is adding support for running off the Strawberry Perl distribution rather than ActiveStates Perl distrio for Windows. The downside is, most of tpsh biggest problems have to do with Perls portability, namely Windows quirks. Gotta love'em.
Since the merge of the "Code generator", tpsh has supported a very limited subset of sh script. Not very usefully however, since the shell doesn't have a real concept of $? yet. Likewise there needs to be some changes in the handling of environment variables. Most ideal IMHO, is a tied hash wrapping $ENV (a magicly tied hash of environment variables) with the ability to hook reads and writes, etc. Preferably in a user-exposabe way that can be extended by shell functions, rather than being limited to the scripts own Perl code.
It's the more general case however, of having to build up the language rather than use its building blocks. The problemo isn't in maintainability, but in portability and development time.
Having reactored a chunk of the shells initialization code, I know that I'll have to retackle the readline stuff. To say that I hate Term::ReadLine would be an understatement. I've no love for the GNU Readline API either (I would use linenoise), but the GRL C API isn't as nasty in practice as the plugable Term::ReadLine system Perl uses. The only good thing I can say is that there is a semi-useless stub version included. Licensing issues of just having a GRL backend aside >_>. In my experience, mileage varies quite a lot between Perl readline pacakges, even within the scope of the fscking manual. It's just a load of crap.
Actually if there's a way of accessing the API functions needed for unix termios / windows console, I would be tempted to throw out the fucking thing and just write a Term::ReadLine::SANE module based on linenoise (A C library). I'm more familiar with the unix parts of that.
No comments:
Post a Comment