Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Shell style line-editing without benefit of CPAN modules

by samtregar (Abbot)
on Nov 18, 2006 at 15:03 UTC ( [id://584877]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Shell style line-editing without benefit of CPAN modules

Is there a way to get a line editing function using the arrow keys just using POSIX (or some other standard approach) without access to any of the extended functionality provided by CPAN modules?

Of course. How do you think the author of Term::ReadLine and friends did it? Of particular interest to you might be Term::ReadLine::Zoid, a pure-perl Term::ReadLine implementation.

So perhaps you've guessed by now: There is no functional Term::Readline or Term:Readkey on these systems, and I cannot install one.

Bullshit. You just haven't figured out how to install one yet! Hell, if you succeed in your attempt to reinvent Term::ReadLine you'll have done it via the hardest possible route - recode it by hand! Here's a few easier possibilities:

  • See if you can get PAR to work in your environment. PAR lets you bundle scripts with the modules they need. Might work, depending on how crippled your Perl is.
  • Copy code from useful modules directly into your scripts. Some modules will need massaging to work like this (if they use __DATA__ or AutoLoader, for example) but many will work just fine. If the module you need has XS pieces you'll need to cross-compile them and ship the built shared-libs with your script.
  • Do a detailed estimate of how much time you're expecting to waste working around the lack of a reasonable Perl development environment. Present this estimate to The-Great-and-Powerful-Code-Image-Builder-Who-Cannot-Be-Argued-With's boss. Explain in excruciating detail exactly how much money is being lost due to his policy on Perl module installs. Who knows, maybe he's not so powerful!
  • Find a new job. Coding in Perl without CPAN is a foolish waste of time with very little to recommend it.

-sam

  • Comment on Re: Shell style line-editing without benefit of CPAN modules

Replies are listed 'Best First'.
Re^2: Shell style line-editing without benefit of CPAN modules
by SirBones (Friar) on Nov 18, 2006 at 17:27 UTC
    Find a new job. Coding in Perl without CPAN is a foolish waste of time with very little to recommend it.

    True enough. Although I'd still like Perl even without CPAN. ;-)

    I should make it clear however that this is a very unusual situation; this restriction is definitely not business as usual, and everyone understands that.

    Thanks for the pointers, I think that will get me going.

    -Ken

    "This bounty hunter is my kind of scum: Fearless and inventive." --J.T. Hutt
      True enough. Although I'd still like Perl even without CPAN. ;-)

      To be honest, I don't. If CPAN weren't a factor I'm sure I'd have switched long ago - Scheme, Python and TCL all have syntax that makes more sense to me. CPAN, both as a place to find code and a place to share it, is what makes Perl my language of choice.

      Re-reading, I realized I forgot to throw in a link to Krang. Krang is a big hairy Apache/mod_perl app that can be distributed and installed without requiring any external modules. It packages the CPAN modules it needs and has a build system that allows you to build on one machine and install on another. Overkill for a little script, perhaps, but another take on the problem.

      -sam

        Hmm, wonder then how CPAN got so big in the first place... Yes, given Perl is rather old, but still. Perl 5 came 1994, Python came 1990, and Ruby 1995...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://584877]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.