On Mon, Jul 29, 2002 at 09:38:20AM +0800, Gerardo Schimpf wrote:
> Hi,
>         I'm trying deleting some files whith the unlink perl command, under a 
> perl script works pefect, but under embperl it's not working...
> This is my example code, copy works, rename works, but unlink no...
> I can't figure out what it's going on... Can someone help me? Thanks 
> :+)  

Sorry, if this is something, you've already tested, but you didn't
mention it in you mail:

This happens very often, if the file hasn't the correct rights for
write access or is owned by another user or group. E.g. the user,
you're testing with as a script is able to write (and therefore
delete) to /var/www/html/interface/mail, but the user Apache runs
under (usually httpd, nobody or something similar) isn't. The Apache
seems to have read access to /var/www/html/interface/mail and write
access to /var/www/html/interface/mail/home/dirvol though, because the
copy and rename works.

> [-
> use File::Copy;
> $imbox="/var/www/html/interface/mail";
> $home="/var/www/html/interface/mail/home";
> $vol="dirvol2";
> $file="1017708295.5733.nono";
> $tmp="$file.tmp";
> copy ("$imbox/$file","$home/$vol/$tmp");
> rename ("$home/$vol/$tmp", "$home/$vol/$file");
> unlink ("$imbox/$file");
> -]

You may also try using 

  unlink ("$imbox/$file") or warn "Can't delete $imbox/$file: $!";

instead of a simple but non-responsive 

  unlink ("$imbox/$file");

This should give a good clue, what's going wrong. Hope, this helps.

BTW: I assume a Unix derivative like Linux or BSD according to the
file and directory names, you used. :-)

            Kind regards, Axel Beckert
-- 
-------------------------------------------------------------
Axel Beckert      ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 926530
WWW:        http://www.ecos.de/     Fax:      +49 6133 925152
-------------------------------------------------------------

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

Reply via email to