The Triumphant Return of Zoidberg -- A Modular Perl Shell
After more than a year of hoping to be able to say this, here goes: Zoidberg
is back!
What is Zoidberg
you ask? Well its a Perl shell, of course. Think of the fun of it all:
mv($_ => lc($_)) for grep /[A-Z]/, <*>
If you use a reserved Perl word first or if you wrap code in a block it is interpreted as Perl, if not then its a shell command. Along with having most of the things you would expect from a shell, it features plenty of extra bells and whistles, like a multiline input system (when Term::ReadLine::Zoid
, part of Bundle::Zoidberg
, is installed) and automatic splitting of variables to arrays like @PATH
which is just $ENV{PATH}
split on :
.
When used as your login shell, it can be used from inside other programs like vim
.
:!cat % | {/^\S/}g | wc -
Further, it is easy to extend with the Zoidberg::Fish plugin system.
Read plenty more about it in a couple of rather old, but still relevant articles:
- From Dr. Dobbs written by Jaap Karssenberg, the original author
- From Linux Journal
Zoidberg had developed a few warts over the years, which have been fixed. I also noticed a few things which needed immediate work, which has been done. There is plenty more to do, but Jaap was close to declaring it stable back in 2006, so it is very usable already.
Some of the TODOs include modernizing parts of the test suite and investigating the viability of using some standard modules, like Devel::REPL
, Moose
, and Getopt::Long
to bring zoid
into the world of Modern Perl.
It is a testament to the stability of Perl that after all these years without maintenance that it took so little work to get it going again. Please enjoy Zoidberg and let me know what you think of it, or of course of any problems you have.
To try it, you can simply install with:
cpanm Bundle::Zoidberg
and the repo is on GitHub, so fork away!
For some more info start at the zoiduser
man page. Then run zoid
to take it for a spin!
++
I have not checked it yet but I hope this works on Windows as well…
@Gabor, I hope that it will. It is pure Perl and implements many of the shell features that way. It does lean on POSIX.pm (I’m not sure how portable that is).
I don’t think Windows was a priority for the original author. I don’t use Windows, but please (everyone!) if there are Windows bugs please let me know, I would love to say that Zoidberg runs as well on Windows as *nix!
Good job! Thanks for that, and I hope to see more. I did not take a very close look at Zoidberg, but I hope to soon. Right now I’m still using Bash.
Note that converting to Moose may not be a good idea in this context, due to its negative effect on the startup time. I’m not sure how much it will matter, but there’s always Mouse and Moo and stuff like that.
Freaking awesome!
I’ve been wanting a more powerful shell (and damned if I’m gonna learn all the nits and picks of obscure Bash syntax).
Thank you to putting much work into it!
I agree with Shlomi that you should consider Mouse (or even Moo) since they take much less in startup, and you probably don’t need full-on Moose. I might be able to help with moving it to that direction.
i could’t install under windows https://gist.github.com/1467050 but it’s very interesting
Hi guys, thanks for the kind words. I will be a while before I get to looking at Mo(o|u)(s?)ing Zoidberg. First on the big list, is getting given/when implemented, since I like that more in a shell than in regular scripts.
After that I want to see if I can get Getopt::Long going, since the hand-rolled GetOpt is too hard for me to grok (though I guess I will have to in order to replace it correctly).
@mishin, thanks, I will see what I can do. I will need a bugfix release anyway because of something that just cropped up from blead, perhaps I can get some MS fixes in for that.
Hmmm I’m running out of numbers before 1.00 …
Just add another digit. :-)
w00t!
Once every few years, I play with the idea of making a Perl shell my main working shell env. The time has come to give it yet another try. :-)
I force installed out of curiosity. It uses a function not available on Windows:
The getpwuid function is unimplemented at C:\Perl-5.14\perl\site\bin/zoid.bat line 101.
Apparently Win32::pwent implements getpwuid(). This will fail to build because of a declared dependency on the obsolete Win32::Registry, but it can be force installed if Win32::TieRegistry is present, and passes all tests.