LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-28-2009, 02:59 PM   #1
rwadkins
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Rep: Reputation: 0
Custom Interpreter for Perl


At our company, we do Perl development in self contained sand boxes with independently defined Perl lib directories for modules we're developing. In order to test our scripts we need to run them with a command that sets up the environment for that execution to point to the relevant lib directories for that script, which changes from script to script.

This system works well enough, but I frequently forgot to prefix my operation with this command before executing my script (or code, if using perl -e). What I'd like to have is an alias to "perl" that will automatically set up my environment and then execute my script. But I've never created a custom interpreter before and don't know how it would function.

Any ideas?
 
Old 08-29-2009, 07:47 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Just create a wrapper script and call it instead. Something like:

Code:
#!/bin/bash
/path/to/env/script
/usr/bin/perl $*
 
Old 08-31-2009, 08:30 AM   #3
rwadkins
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the tip.

I completely didn't finish my question. I was hoping to put something together that I could use in the shebang of a script. this would allow me to encapsulate the sandbox functionality without having to remember if I'm in a sandbox or not.
 
Old 08-31-2009, 07:21 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,863

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
If you're going to mess with the shebang, you're going to have to remember you've done that anyway.
Why not have an alias setup at login called sandbox that fixes your env and just call that once at the start of the day, so the current xterm is sandboxed.
If you do that a lot, maybe default that to happen at login (.bash_profile) and create an un-sandbox alias cmd to undo it.
Depends which env you use most.
 
Old 09-01-2009, 07:50 AM   #5
rwadkins
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
If you're going to mess with the shebang, you're going to have to remember you've done that anyway.
Not technically true, the custom interpreter would have the ability to test whether it's being executed in a sandbox and modify it's behavior depending. So I once it's set up, I won't need to think about it again.

Quote:
Originally Posted by chrism01 View Post
Why not have an alias setup at login called sandbox that fixes your env and just call that once at the start of the day, so the current xterm is sandboxed.
Unfortunately, I have many concurrent sandboxes that I work in. And, depending on my boss' whims, I switch back and forth alot. Having to reconfigure my environment every time is a bit of a pain, so I'd rather each execution do it's own sandbox check and modify the running environment on the fly.

Quote:
Originally Posted by chrism01 View Post
If you do that a lot, maybe default that to happen at login (.bash_profile) and create an un-sandbox alias cmd to undo it.
Depends which env you use most.
Not technically necessary, but would make my process a good deal easier.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
custom shell script interpreter is not called on my vserver empgodot Linux - Server 2 05-31-2009 07:40 AM
Where can I locate my perl interpreter? neolithic_psyche Fedora 4 07-05-2007 11:11 AM
Rename perl interpreter cramer Programming 6 08-01-2006 10:38 PM
perl interpreter for smake NonSumPisces Linux - Software 0 06-04-2004 04:58 PM
does Perl interpreter come with red hat rhuser Linux - Software 1 02-17-2003 04:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration