Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

CLASSPATH via Perl $EVN or eval?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
static_void
n00b
n00b
User avatar
Posts: 74
Joined: Mon Jan 20, 2003 1:18 pm
Location: San Francisco, CA
Contact:
Contact static_void
Website

CLASSPATH via Perl $EVN or eval?

  • Quote

Post by static_void » Mon Jul 25, 2005 10:02 pm

I need to set the JAVA class path via a perl-script. $ENV set's the variables of child-processes, how can I do something equivalent to export CLASSPATH=foo and have it stick. I did a perldoc -q enviroment, and it mentioned something about eval, I tinkerd with eval some but with no joy.

Any Help would be great.
Travel, without movement.
Top
Unne
l33t
l33t
User avatar
Posts: 616
Joined: Mon Jul 21, 2003 4:23 pm
Contact:
Contact Unne
Website

  • Quote

Post by Unne » Mon Jul 25, 2005 10:32 pm

From perldoc perlfaq8:

Code: Select all

       I {changed directory, modified my environment} in a perl script.  How come the
       change disappeared when I exited the script?  How do I get my changes to be vis-
       ible?


       Unix
           In the strictest sense, it can't be done--the script executes as a different
           process from the shell it was started from.  Changes to a process are not
           reflected in its parent--only in any children created after the change.
           There is shell magic that may allow you to fake it by eval()ing the script's
           output in your shell; check out the comp.unix.questions FAQ for details.
I think they mean printing stuff to STDOUT from your Perl script that your shell will eval itself, i.e. running your Perl script like this (using bash):

Code: Select all

chester ~ $ cat script.pl
print qq|export TEST=yep|;
chester ~ $ echo $TEST

chester ~ $ eval `perl script.pl`
chester ~ $ echo $TEST
yep
See also http://www.faqs.org/faqs/unix-faq/faq/part2/ perhaps. (Part 2 has stuff about environment variables.)
Obligatory hompage link.
Top
static_void
n00b
n00b
User avatar
Posts: 74
Joined: Mon Jan 20, 2003 1:18 pm
Location: San Francisco, CA
Contact:
Contact static_void
Website

  • Quote

Post by static_void » Mon Jul 25, 2005 10:39 pm

That works perfectly, thanks for clearing that up~
Travel, without movement.
Top
Post Reply

3 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic