running dot files

Discussion in 'Perl Misc' started by heylow, May 15, 2007.

  1. heylow

    heylow Guest

    Gurus,

    I have a dot file that contains the following.


    $pwd
    /home/oracle
    $cat .edp
    export ORACLE_HOME=/home/oracle/product/10.2.0/db
    export SID=EDP

    I have one line perl script.

    $cat 1.pl
    #!/usr/local/bin/perl
    .. ~/.edp

    $./1.pl

    syntax error at ./1.pl line 2, near "."
    Execution of ./1.pl aborted due to compilation errors.


    How to get rid of this error?

    Thanks
     
    heylow, May 15, 2007
    #1
    1. Advertisements

  2. heylow

    Guest

    On May 15, 12:05 pm, heylow <> wrote:
    > export ORACLE_HOME=/home/oracle/product/10.2.0/db
    > export SID=EDP


    This is a shell environment configuration file. Perl doesn't grok
    such a file. There are several possibilities to configure your
    environment in Perl, including these:

    You could source the file and then run the Perl program (all from a
    bash script); the Perl program will inherit the shell's environment.
    It's kinda ugly, but I do this with cron jobs - the cron invokes a
    ksh, which sources the env and runs the Perl program.

    Or you can import the settings using a module such as
    Shell::EnvImporter (I've never tried this, but it looks like it ought
    to do the trick):
    http://search.cpan.org/~dfaraldo/Shell-EnvImporter-1.04/lib/Shell/EnvImporter.pm

    Or you can configure the environment directly in the Perl program:
    $ENV{'ORACLE_HOME'} = '/home/oracle/product/10.2.0/db';
    $ENV{SID} = 'EDP';

    --
    The best way to get a good answer is to ask a good question.
    David Filmer (http://DavidFilmer.com)
     
    , May 15, 2007
    #2
    1. Advertisements

  3. heylow

    heylow Guest

    On May 15, 3:16 pm, wrote:
    > On May 15, 12:05 pm, heylow <> wrote:
    >
    > > export ORACLE_HOME=/home/oracle/product/10.2.0/db
    > > export SID=EDP

    >
    > This is a shell environment configuration file. Perl doesn't grok
    > such a file. There are several possibilities to configure your
    > environment in Perl, including these:
    >
    > You could source the file and then run the Perl program (all from a
    > bash script); the Perl program will inherit the shell's environment.
    > It's kinda ugly, but I do this with cron jobs - the cron invokes a
    > ksh, which sources the env and runs the Perl program.
    >
    > Or you can import the settings using a module such as
    > Shell::EnvImporter (I've never tried this, but it looks like it ought
    > to do the trick):
    > http://search.cpan.org/~dfaraldo/Shell-EnvImporter-1.04/lib/Shell/Env...
    >
    > Or you can configure the environment directly in the Perl program:
    > $ENV{'ORACLE_HOME'} = '/home/oracle/product/10.2.0/db';
    > $ENV{SID} = 'EDP';
    >
    > --
    > The best way to get a good answer is to ask a good question.
    > David Filmer (http://DavidFilmer.com)



    Thank you.
     
    heylow, May 15, 2007
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. z. f.
    Replies:
    0
    Views:
    413
    z. f.
    Apr 19, 2004
  2. Samuël van Laere

    To dot or not to dot?

    Samuël van Laere, Oct 16, 2003, in forum: HTML
    Replies:
    8
    Views:
    701
    Samuël van Laere
    Oct 16, 2003
  3. Christopher M. Lusardi

    volatile struct in dot h vs dot c

    Christopher M. Lusardi, May 11, 2004, in forum: C Programming
    Replies:
    3
    Views:
    717
    Peter Shaggy Haywood
    May 15, 2004
  4. Nathan Sokalski
    Replies:
    11
    Views:
    938
    AAaron123
    Aug 14, 2009
  5. krishnan

    Dot Net Project Execution without Dot Net and Framework....

    krishnan, Jan 7, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    364
    krishnan
    Jan 7, 2006
  6. Nathan Beyer
    Replies:
    0
    Views:
    218
    Nathan Beyer
    Nov 15, 2009
  7. Pen Ttt
    Replies:
    4
    Views:
    344
    Pen Ttt
    Sep 24, 2010
  8. Replies:
    6
    Views:
    562
    Thomas 'PointedEars' Lahn
    Dec 12, 2005
Loading...