You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Dan Lenski <le...@umd.edu> on 2004/08/20 22:54:45 UTC

changing to working directory of embperl files in 2.0?

Hi, I'm using Embperl 2.0 under Debian.  I just switched from 1.3.  Is
there a way to get the old behavior of having Embperl switch into the
working directory of a file that it processes?

My problem is that I like to use perl modules from the same directory as
the file and this won't work now:
  [- use SuperTable; # SuperTable.pm is in same dir as html file -]

Please let me know if there's a way to do this in 2.0.  I haven't even
been able to figure out a workaround...

Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: changing to working directory of embperl files in 2.0?

Posted by Gerald Richter <ri...@ecos.de>.
> 
> Hi, I'm using Embperl 2.0 under Debian.  I just switched from 
> 1.3.  Is there a way to get the old behavior of having 
> Embperl switch into the working directory of a file that it processes?
> 

$epreq -> commponent -> cwd

returns the directory of the source file


> My problem is that I like to use perl modules from the same 
> directory as the file and this won't work now:
>   [- use SuperTable; # SuperTable.pm is in same dir as html file -]
> 

As long as you module doesn't import anything you can use requiree

[-
require $epreq -> commponent -> cwd . 'SuperTable.pm' ;
-]

Or if you like to use use, make a chdir

[!
BEGIN { chdir $epreq -> commponent -> cwd } 
use SuperTable ;
!]

Of couse you can also put the directory SuperTable.pm is in, into your perl
search path on server startup e.g.

use lib qw{/path/to/modules} ;


Gerald



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org