[16591] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4003 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 13 18:12:45 2000

Date: Sun, 13 Aug 2000 15:10:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <966204613-v9-i4003@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 13 Aug 2000     Volume: 9 Number: 4003

Today's topics:
        rmdir works with Xitami/w95 but not with MS-IIS/NT <bGhassemlou@home.com>
    Re: Size of a directory (Gwyn Judd)
        Slightly off topic vod@writemail.com
    Re: Slightly off topic (fvw)
    Re: Thanks for your help (Abigail)
    Re: timing out evals (Colin Keith)
    Re: undef multiple variables (Abigail)
    Re: undef multiple variables <abe@ztreet.demon.nl>
    Re: undef multiple variables <uri@sysarch.com>
    Re: utime Function Not Working (Colin Keith)
    Re: uuuuuuuAaron Kulkis is a Communist Buttfucker <idonthinkso@NOPE.com>
    Re: warning/var weirdness (or is it?) (Colin Keith)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 13 Aug 2000 20:01:09 GMT
From: "bjg" <bGhassemlou@home.com>
Subject: rmdir works with Xitami/w95 but not with MS-IIS/NT
Message-Id: <98Dl5.18093$c5.796812@news2.rdc1.on.home.com>

My developped several Perl programs and it was tested and was working under
xitami webserver/Win95.  Now I am installing the same code under
MS-IIS/Win-NT  and rmdir does not work any more and does not remove the
corresponding directory
hereis the code!
can anyone help?

Thanks for suggestions.

opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
$thisfile = readdir(DIR);
print "Deleting:$some_dir/$thisfile,***\n";
while( $thisfile ne '' ) {
   print "Deleting:$some_dir/$thisfile,***\n";
   if ($thisfile ne '.' && $thisfile ne '..' ){
      if ( unlink("$some_dir/$thisfile") > 0) {
          print "delted:$thisfile ,".' unlink('." $some_dir/$thisfile )" }
      else {
            print "failed:$thisfile ,".' unlink('." $some_dir/$thisfile )" }
      }
      $thisfile = readdir(DIR);
 }
closedir(DIR) ;
rmdir($some_dir);

P.S.
also have problem with:

 -d $subdir     It does not yield true when checking on a subdirectory?





------------------------------

Date: Sun, 13 Aug 2000 15:50:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Size of a directory
Message-Id: <slrn8pdh3l.2tr.tjla@thislove.dyndns.org>

I was shocked! How could jimmy_mcnamara@my-deja.com <jimmy_mcnamara@my-deja.com>
say such a terrible thing:
>Hi Folks,
>
>Just wondering is there a function in Perl that will tell me the
>size of a directory(i.e. the total size of all the files in it) rather
>than using the unix shell commands to access this info.

Something like:

$dir = ".";
opendir DIR, $dir or die "Cannot open $dir: $!";
$size += (-f() ? -s : 0) for readdir DIR;
closedir DIR;
print $size;

Will count the size of all the files in the current directory. I suggest
you read:

perldoc -f -X
perldoc -f opendir
perldoc -f readdir

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
When you have to kill a man it costs nothing to be polite.
-Winston Churchill, on formal declaration of war


------------------------------

Date: Sun, 13 Aug 2000 19:00:28 GMT
From: vod@writemail.com
Subject: Slightly off topic
Message-Id: <8n6r8a$g6e$1@nnrp1.deja.com>

Hi there,

I wanted  to find a web-hosting    company that has the
Perl module WWW::Search installed on it and allows the
hosted sites to use it.
Or is there any way using Perl to be able to
get results from other search  engines like
Yahoo or AltaVista etc..

I know this may be  a bit off-topic but i figured as here
a lot of ppl might be using Perl to maintain and build
web-sites they may have knowledge of such a kind.


Thanks
V0D


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sun, 13 Aug 2000 19:16:36 GMT
From: fvw+usenet@var.cx (fvw)
Subject: Re: Slightly off topic
Message-Id: <966194486AIJ.fvw@var.cx>

<8n6r8a$g6e$1@nnrp1.deja.com> (vod@writemail.com):
>I wanted  to find a web-hosting    company that has the
>Perl module WWW::Search installed on it and allows the
>hosted sites to use it.
>Or is there any way using Perl to be able to
>get results from other search  engines like
>Yahoo or AltaVista etc..

Does it matter? If they don't have it installed, ask them
to install it and if they won't, install it yourself in your
homedir. I don't know how big it is, but it can't be so
big that it'd cost significantly more because of diskspace
quota...

-- 

                        Frank v Waveren
                        fvw@var.cx
                        ICQ# 10074100


------------------------------

Date: 13 Aug 2000 15:33:45 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Thanks for your help
Message-Id: <slrn8pdftp.tj3.abigail@alexandra.foad.org>

Jim_Kearman (jkearmanNO@mindspring.com) wrote on MMDXXXVI September
MCMXCIII in <URL:news:8mufqq$3qv$1@nntp9.atl.mindspring.net>:
-: Guess no one here knows much about Perl installation. I'll stick to ASP.


Good for you!


Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


------------------------------

Date: Sun, 13 Aug 2000 17:17:53 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: timing out evals
Message-Id: <5LAl5.117$DT4.3525541@nnrp2.clara.net>

In article <Pine.LNX.4.21.0008121714230.14937-100000@aura.title14.com>, Pat Trainorh <ptrainor@title14.com> wrote:
>

>sub timed { my $command = shift; 
>my $result;
>$SIG{ALRM} = sub {die "timeout" }; eval {
>        alarm(5); # I know 5 is unreasonable, just a test...
>        $result = eval $command;
>        alarm(0);
>};

Right, this is all groovy, except ... the inner eval. 

DOH! I finally figured this out (I've posted replies to 3 other messages 
whilst I've been puzzling over this one:) Right... of course.. you're using 
eval. I couldn't figure out why the signal handler was called, but putting a 

  print "\$@ = $@\n" 

after the eval {} block showed $@ had no value. Even though I was getting 
values printed from the handler ... Then it dawned on me, that the problem 
occurs because the inner eval is catching the 'die', because that's where 
the execution of the program is when the program dies. I don't quite 
understand why $@ is reset coming out of the outer eval block but:

  sub timed {
    my $command = shift;
    my $result;
    $SIG{ALRM} = sub { die "timeout" };
    eval {
          alarm(5); # I know 5 is unreasonable, just a test...
          $result = eval "$command";
          print "Inner eval errmsg: $@\n";
          alarm(0);
    };
    print "Outer eval errmsg = $@\n";
  }


maia% ./x
Inner eval errmsg: timeout at ./x line 11.
Outer eval errmsg = 

So you just push all the $@ checks up into your eval block, because its the 
inner eval that you're testing.

*sigh* I can't believe how long it took me to figure that out and you 
woudln't believe what I tried :)

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: 13 Aug 2000 15:36:41 GMT
From: abigail@foad.org (Abigail)
Subject: Re: undef multiple variables
Message-Id: <slrn8pdg39.tj3.abigail@alexandra.foad.org>

Decklin Foster (decklin+usenet@red-bean.com) wrote on MMDXXXVII September
MCMXCIII in <URL:news:kEJk5.15986$f_5.78408@news1.rdc1.ct.home.com>:
:} Sanjay Krishna <krishnasanjay@hotmail.com> writes:
:} 
:} > ex: undef($a, $b,$c,$d);
:} > doesn't work. Is there an alternative ?
:} 
:} You can see from perldoc -f undef that you must use just 'undef', or
:} 'undef EXPR'. Since undef is therefore expecting a scalar,
:} ($a,$b,$c,$d) is evaluated as a comma expression, causing only $d to
:} be undefined.
:} 
:} One alternative is:
:} 
:} ($a,$b,$c,$d) = ();


TMTOWTDI:  map {undef $_} $a, $b, $c, $d;   # Look, no parens!



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


------------------------------

Date: Sun, 13 Aug 2000 19:38:51 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: undef multiple variables
Message-Id: <9vmdpskdtl6991ib5lcvdg1ntmr973ojg1@4ax.com>

On 13 Aug 2000 15:36:41 GMT, abigail@foad.org (Abigail) wrote:

> Decklin Foster (decklin+usenet@red-bean.com) wrote on MMDXXXVII September
> MCMXCIII in <URL:news:kEJk5.15986$f_5.78408@news1.rdc1.ct.home.com>:
> :} Sanjay Krishna <krishnasanjay@hotmail.com> writes:
> :} 
> :} > ex: undef($a, $b,$c,$d);
> :} > doesn't work. Is there an alternative ?
> :} 
> :} You can see from perldoc -f undef that you must use just 'undef', or
> :} 'undef EXPR'. Since undef is therefore expecting a scalar,
> :} ($a,$b,$c,$d) is evaluated as a comma expression, causing only $d to
> :} be undefined.
> :} 
> :} One alternative is:
> :} 
> :} ($a,$b,$c,$d) = ();
> 
> 
> TMTOWTDI:  map {undef $_} $a, $b, $c, $d;   # Look, no parens!

or even:
	map undef $_ => $a, $b, $c, $d;	# No curlies either

-- 
Good luck,
Abe


------------------------------

Date: Sun, 13 Aug 2000 18:08:51 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: undef multiple variables
Message-Id: <x7em3tyqx9.fsf@home.sysarch.com>

>>>>> "AT" == Abe Timmerman <abe@ztreet.demon.nl> writes:

  AT> On 13 Aug 2000 15:36:41 GMT, abigail@foad.org (Abigail) wrote:
  >> Decklin Foster (decklin+usenet@red-bean.com) wrote on MMDXXXVII September
  >> MCMXCIII in <URL:news:kEJk5.15986$f_5.78408@news1.rdc1.ct.home.com>:
  >> :} Sanjay Krishna <krishnasanjay@hotmail.com> writes:
  >> :} 
  >> :} > ex: undef($a, $b,$c,$d);
  >> :} > doesn't work. Is there an alternative ?
  >> :} 
  >> :} You can see from perldoc -f undef that you must use just 'undef', or
  >> :} 'undef EXPR'. Since undef is therefore expecting a scalar,
  >> :} ($a,$b,$c,$d) is evaluated as a comma expression, causing only $d to
  >> :} be undefined.
  >> :} 
  >> :} One alternative is:
  >> :} 
  >> :} ($a,$b,$c,$d) = ();
  >> 
  >> 
  >> TMTOWTDI:  map {undef $_} $a, $b, $c, $d;   # Look, no parens!

  AT> 	map undef $_ => $a, $b, $c, $d;	# No curlies either

	$_ = undef for $a, $b, $c, $d;	# no map in void context

also i hate seeing undef used as a function with args. it is different
than assigning undef to a scalar. and it leads newbis to do undef @foo
when they should be using @foo = ().

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Sun, 13 Aug 2000 17:38:25 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: utime Function Not Working
Message-Id: <l2Bl5.118$DT4.3528119@nnrp2.clara.net>

In article <8n56qa$etc$1@nnrp1.deja.com>, centelec@my-deja.com wrote:
>On a Windows NT server, I uploaded a file and tried to timestamp it.
>After the script, I checked the modified date of the file with -M and
>its zero's. The code follows:

Where's the -M check? 'nyway, -M is not the modification time of the file. 
Its the modification time of the file *since your program started in days*

I have never understood why days is useful, but if you played with this file 
recently then it will probably be very small so don't  forget to *3600 to 
see an 'in seconds' value. If that's a pain, go for stat() and get the time 
since epoch from that.

>
>utime ($ctime,$ctime,'$path');

I'm confused why you're doing this having just written the file as your OS 
will do this anyway. But most notably why you're timestamping a file called 
$path. If this is your code and not retyped, take out the single quotation 
marks around $path, you're using a value of "$path" not the value *in* 
$path. I.e.

  print '$path';
  print $path;    or print "$path";

If you still want to timestamp it and check it:

  @_ = stat($path);
  print "Atime = ", scalar(localtime($_[8])), "\n";
  print "Mtime = ", scalar(localtime($_[9])), "\n";

Col.                                      


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: Sun, 13 Aug 2000 19:32:58 GMT
From: "the_master" <idonthinkso@NOPE.com>
Subject: Re: uuuuuuuAaron Kulkis is a Communist Buttfucker
Message-Id: <KJCl5.56364$07.1776111@news1.rdc1.on.wave.home.com>

haa haaaa

"Odious" <Odious@home.com> wrote in message
news:3988E346.2E6BF2C6@home.com...
>
>
> No User wrote:
> >
> > uuuuuuu  He is, man. What more can I say?
> >
>
>
> Hey now, come on....aaron is not a communist.
>
> --
> The Spiffy Page: Home of the Ask Odious seduction advice column.
> http://members.home.net/odious




------------------------------

Date: Sun, 13 Aug 2000 17:41:31 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: warning/var weirdness (or is it?)
Message-Id: <f5Bl5.119$DT4.3528697@nnrp2.clara.net>

In article <jJel5.97359$A%3.1306770@news1.rdc2.pa.home.com>, "Ben Kennedy" <bkennedy99@home.com> wrote:
>I got the scoop on {} -
*plops icecream in it* :)

>if the {} contains a scalar, it does a symbolic ref lookup, so
>$bleh = 'x';
>${$bleh}, ${'x'} are the same since 'x' is a scalar (not a bareword)

Unless you're using strict checking in which case this facility is disabled. 
To enable it for a block you have to use "no strict 'refs'".

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4003
**************************************


home help back first fref pref prev next nref lref last post