delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/14/10:34:24

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Mon, 14 Apr 2003 10:33:58 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Greg Matheson <lang AT ms DOT chinmin DOT edu DOT tw>
cc: cygwin AT cygwin DOT com
Subject: Re: Exim, .forward and DBD::Oracle
In-Reply-To: <20030414135338.A22573@ms>
Message-ID: <Pine.GSO.4.44.0304141026300.26381-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

On Mon, 14 Apr 2003, Greg Matheson wrote:

> On Sun, 13 Apr 2003, Igor Pechtchanski wrote:
>
> > It might be interesting to try writing a dummy perl module with a "print"
> > in its initialization subroutine, trying to "use" it after a "print" in
> > the main script, and seeing which print comes out first...  I haven't
> > really written perl modules, so I can't perform the experiment myself
> > without a learning curve, but will do so if noone else does it first and
> > when time permits.
> >       Igor
>
>         greg AT 7106 ~
>         $ echo 'print "hello from module\n";' > Module.pm

Wow, that easy, huh?

>         greg AT 7106 ~
>         $ perl -e 'print "hello from program\n";use Module;'
>         hello from module
>         hello from program
>
> I don't know if this carries over for setting $PATH, however.

This kind of proves my point (that use statements are executed before the
rest of the code).  Also, the BEGIN block *is* executed before the
modules.  See below:

$ echo 'print "ORACLE_HOME=$ENV{ORACLE_HOME}\n";' > Module.pm
$ perl -e '$ENV{ORACLE_HOME}="aaa bbb ccc";use Module;'
ORACLE_HOME=
$ perl -e 'BEGIN{$ENV{ORACLE_HOME}="aaa bbb ccc";}use Module;'
ORACLE_HOME=aaa bbb ccc

Hope this helps the OP.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019