Hall, Philippe wrote:
> I saw something similar to this in the list archives -- something
> Gerald responded with to someone who was having a similar problem (or
> so it seems), back in 2002.  He said use this:
>
> [- $req = shift -]
> [- $path = $req -> component -> cwd -]
>
> If I use this I would have to:
> open (FILEHANDLE, $path.'sites.txt') or die 'Cannot open sites.txt:
> '.$!;
>
> instead of what I'm using below, right?  I'm not really sure if what
> your $myactualpath will be universally applicable or not(?).  Is it
> common knowledge that in Embperl 2 one cannot access files relative
> to the current file executed, or am I misunderstanding?
>

Embperl 2 does not change the current directory. This was mainly changed for
performance reasons.

Using the above code is the right solution. In the newest version you can
shorten it a little by using $epreq for the Embperl request object:

[-
open (FILEHANDLE, $epreq -> component -> cwd . 'sites.txt') or die 'Cannot
open sites.txt:' ;
-]

This will always work.

Gerald


> Thanks,
> Philippe
>
>
> -----Original Message-----
> From: Carlos Kassab [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 27, 2004 5:06 PM
> To: [EMAIL PROTECTED]
> Cc: Hall, Philippe
> Subject: Re: pwd is '/' ???
>
>
> To get my actual path i am doing this:
> $myactualpath = substr($epreq -> param -> filename,0,length($epreq ->
> param ->
> filename)-9);
>
> I hope this helps
>
> CKG
>
> El Jue 27 May 2004 15:18, Hall, Philippe escribió:
>> Ok I'll say up front that this is my first time setting up EmbPerl 2
>> and
>> Apache 2, but I've used EmbPerl 1.3 for a few years now.  Here's my
>> issue,
>> which I just discovered about an hour ago:
>>
>> I have an .epl, subs.epl, which renders fine.  I have the following
>> line of
>> code that is dying:
>>
>> open (FILEHANDLE, 'sites.txt') or die 'Cannot open sites.txt: '.$!;
>>
>> And 'sites.txt' does exist in the same directory as subs.epl, and the
>> permissions are all good.  The page dies and I get a file not found
>> error
>> from embperl.  So, to debug, I added the following line above my
>> filehandle
>> open:
>>
>> [- print OUT `pwd`; -]
>>
>> Strangely enough, my pwd is '/'.  Since I'm in the process of
>> migrating
>> from my old Embperl 1.3 box to this new box, I added the same print
>> statement to the 1.3 counterpart of subs.epl. The pwd on that box is
>> correct -- the directory containing  subs.epl (as expected).
>>
>> So does anyone know why I'm getting this behavior in Embperl 2.0?
>>
>> Another thing I notice (but presumably unrelated): I can't have more
>> than
>> one statement in a [+ +] block any more... is that right?  I get a
>> syntax
>> error.
>>
>> Thanks in advance,
>> Philippe
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------------
Gerald Richter            ecos electronic communication services gmbh
IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
---------------------------------------------------------------------------
Besuchen Sie uns auf der KOMCOM 2004 in Mannheim
25. bis 27. Mai 2004  Stand K11a   www.komcom.de

ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
---------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to