[18668] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 836 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 4 18:06:09 2001

Date: Fri, 4 May 2001 15:05:08 -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: <989013908-v10-i836@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 4 May 2001     Volume: 10 Number: 836

Today's topics:
    Re: Active perl problem <steve_dob@totalise.co.uk>
    Re: Active perl problem nobull@mail.com
    Re: Active perl problem <steve_dob@totalise.co.uk>
    Re: Active perl problem (Randal L. Schwartz)
    Re: Allocating people like in a cinema <iltzu@sci.invalid>
    Re: Allocating people like in a cinema (Abigail)
    Re: Alorithm ? addendum <dkoleary@ro05-24-29-232-217.ce.mediaone.net>
    Re: Alorithm ? addendum <dkoleary@ro05-24-29-232-217.ce.mediaone.net>
    Re: Am I in the perl Debugger? (Peter Scott)
    Re: Compare 2 arrays (Abigail)
    Re: Debugging Perl (Peter Scott)
        Doc about sockets <evelio.martinez@testanet.com>
        Form with post method <jorge.sanmartin@corp.terra.cl>
    Re: Form with post method (Eric Bohlman)
    Re: Form with post method <godzilla@stomp.stomp.tokyo>
    Re: Hacker Challenge. Can you break this script for me? <newspost@coppit.org>
        HELP - Please <vbook@americasm01.nt.com>
    Re: leftover Close Wait sockets <skilchen@swissonline.ch>
    Re: Problem with "require" in server <djberge@uswest.com>
    Re: Problem with "require" in server (Anno Siegel)
    Re: Problem with the subroutine (closure?) for the "sor <joe+usenet@sunstarsys.com>
    Re: Recursing a directory tree (Dave Bailey)
    Re: Removing attributes <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: Rename subdirectories and files (Gwyn Judd)
    Re: Rename subdirectories and files <iltzu@sci.invalid>
    Re: Rename subdirectories and files (Abigail)
        unicode support in perl 5.6 -- I'm trying to get it to  ("Resnick, David")
        UPPERCASE to "Sentence Case" <nospam@newsranger.com>
    Re: use Apache::Htpasswd <murat.uenalan@gmx.de>
        Using Modem::Vgetty <dj@syntaxerror.crazydj.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 04 May 2001 18:16:19 GMT
From: "Stephen Dobinson" <steve_dob@totalise.co.uk>
Subject: Re: Active perl problem
Message-Id: <TlCI6.160$Cf.69101@news1.cableinet.net>

> comp.lang.perl does not exist - ask your newserver provider to fix
> their server.

Serious question - why do people keep saying clp does not exist?
Maybe it SHOULDN'T but, given that postings apparently get
there, .........
--
Stephen Dobinson
http://www.a2zcomms.com/index.shtml




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

Date: 04 May 2001 19:38:12 +0100
From: nobull@mail.com
Subject: Re: Active perl problem
Message-Id: <u9pudpq7sa.fsf@wcl-l.bham.ac.uk>

"Stephen Dobinson" <steve_dob@totalise.co.uk> writes:

> > comp.lang.perl does not exist - ask your newserver provider to fix
> > their server.
> 
> Serious question - why do people keep saying clp does not exist?

Because it is a convient short-short hand for "exists only as a
misconfiguration of servers".

If I say there's no such word as "manuplexity" or "whipuptitude" then
I mean that these are not an accepted and documented part of the
language.  Clearly in some sense these words do exist, if only because
I just used them.  And I was definitely not the first.

And Usenet (other than alt.*) is not like English, it's more like
French.  A newsgroup does not exist just because a lot of people use
it.  It only exits if it has been decided that it exits.

> Maybe it SHOULDN'T but, given that postings apparently get
> there, .........

Usenet is decentrailised there is no one "there" to get to.  

Bogus newsgroups exist on misconfigured servers. Post to bogus
newsgroups will only be propagated by correctly configured servers if
they are cross-posted to a real group.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 04 May 2001 19:15:34 GMT
From: "Stephen Dobinson" <steve_dob@totalise.co.uk>
Subject: Re: Active perl problem
Message-Id: <qdDI6.276$Cf.107969@news1.cableinet.net>

> And Usenet (other than alt.*) is not like English, it's more like
> French.  A newsgroup does not exist just because a lot of people use
> it.  It only exits if it has been decided that it exits.

It exists if people use it - the rest is ivory tower wishful thinking :-)
People will use what people choose to use - whether French or Usenet.
--
Stephen Dobinson
http://www.stonedbovines.com/




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

Date: 04 May 2001 13:10:29 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Active perl problem
Message-Id: <m1snikan9m.fsf@halfdome.holdit.com>

>>>>> "Stephen" == Stephen Dobinson <steve_dob@totalise.co.uk> writes:

>> And Usenet (other than alt.*) is not like English, it's more like
>> French.  A newsgroup does not exist just because a lot of people use
>> it.  It only exits if it has been decided that it exits.

Stephen> It exists if people use it - the rest is ivory tower wishful
Stephen> thinking :-) People will use what people choose to use -
Stephen> whether French or Usenet.

Sure, and people can drive the wrong way down a parking lot roadway.
We're just telling you how the lines are actually painted, so you
don't get into an accident soon.

print "Just another Perl hacker," # and Usenet user and manager since 1980!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 4 May 2001 20:03:16 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Allocating people like in a cinema
Message-Id: <989005349.6778@itz.pp.sci.fi>

In article <slrn9f5bmv.7cj.abigail@tsathoggua.rlyeh.net>, Abigail wrote:
>
>     The second way first collects all demands for tickets, and then
>     assigns all seats. This leads to an optimal placement; if such
>     a placement exists. However, this is NP-complete, so it will run
>     for a while.

Is it really, given the OP's constraint that groups may contain no more
than 3 people?  I'm not going to try actually proving it, not without
getting some sleep first anyway, but it would seem that a simple greedy
algorithm -- seat any groups of 3 first, then groups of 2, and single
people last -- ought to produce an optimal placement.

(No, wait.  I'm wrong.  Try seating two groups of 3 and four groups of 2
on two rows of seven seats.  But that bug can only happen if the row
length mod 3 is 1, and there aren't enough single people.  I think it
can be special cased..)

To put this thread back on topic, can anyone suggest a regexp solution?
I think it could be done using embedded Perl code, but I'm not familiar
enough with that to try it myself right now.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.


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

Date: Fri, 4 May 2001 21:06:02 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Allocating people like in a cinema
Message-Id: <slrn9f66dp.hrt.abigail@tsathoggua.rlyeh.net>

Ilmari Karonen (iltzu@sci.invalid) wrote on MMDCCCIII September MCMXCIII
in <URL:news:989005349.6778@itz.pp.sci.fi>:
()  In article <slrn9f5bmv.7cj.abigail@tsathoggua.rlyeh.net>, Abigail wrote:
() >
() >     The second way first collects all demands for tickets, and then
() >     assigns all seats. This leads to an optimal placement; if such
() >     a placement exists. However, this is NP-complete, so it will run
() >     for a while.
()  
()  Is it really, given the OP's constraint that groups may contain no more
()  than 3 people?  I'm not going to try actually proving it, not without
()  getting some sleep first anyway, but it would seem that a simple greedy
()  algorithm -- seat any groups of 3 first, then groups of 2, and single
()  people last -- ought to produce an optimal placement.
()  
()  (No, wait.  I'm wrong.  Try seating two groups of 3 and four groups of 2
()  on two rows of seven seats.  But that bug can only happen if the row
()  length mod 3 is 1, and there aren't enough single people.  I think it
()  can be special cased..)

Try seating 1 group of 3 and 4 groups of 2 on two rows, one of length 8,
one of length 3. No row has length mod 3 == 1, yet if you put the group
of 3 on the row of 8, you will fail to seat them.

I would like to see your algorithm for the special case. Because it's the
special case that makes it hard. If there are "enough" groups of 1, even
a random assignment will work.

However, if the groups are limited to at most 3 people, I doubt it's NP
complete.


Abigail
-- 
:$:=~s:$":Just$&another$&:;$:=~s:
:Perl$"Hacker$&:;chop$:;print$:#:


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

Date: Fri, 04 May 2001 18:45:40 GMT
From: Doug O'Leary <dkoleary@ro05-24-29-232-217.ce.mediaone.net>
Subject: Re: Alorithm ? addendum
Message-Id: <oNCI6.1007$qPc.97386752@news.randori.com>

Bart Lateur <bart.lateur@skynet.be> wrote:
> Er... "print", does that not involve a filehandle?

Yea - stdout - not the input file from which I was reading the information.

Doug

-- 
------------------------
Douglas K. O'Leary
Senior System Administrator
dkoleary@mediaone.net


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

Date: Fri, 04 May 2001 18:48:59 GMT
From: Doug O'Leary <dkoleary@ro05-24-29-232-217.ce.mediaone.net>
Subject: Re: Alorithm ? addendum
Message-Id: <vQCI6.1008$qPc.85066040@news.randori.com>

Samuel Kilchenmann <skilchen@swissonline.ch> wrote:
>>
> The problem with the output has nothing to do with how you read the input.
> In the child processes you are concurrently writing to a shared output
> channel. Thats the problem. 

Now that puts a completely different light on the issue.  Fortunately,
the final program won't be writing to stdout or to the same file, but
it'd be nice to figure out the right way to handle this in case it 
ever comes up again.  

Thanks alot for the information, I appreciate it.

Doug


-- 
------------------------
Douglas K. O'Leary
Senior System Administrator
dkoleary@mediaone.net


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

Date: Fri, 04 May 2001 19:32:39 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Am I in the perl Debugger?
Message-Id: <rtDI6.27681$q51.262975@news1.gvcl1.bc.home.com>

In article <9cc5pl$eh4$1@mozo.cc.purdue.edu>,
 Broc Seib <bseib@jade.cc.purdue.edu> writes:
>Does anyone know for certain that $^P will always be zero when running
>normal, and non-zero if in the debugger?


If you want something a little more direct, test to see if anything's in the 
DB package.  $DB::OUT and $DB::IN will be there, for instance, or you can just

	perl -dle 'print "Disembugging" if %DB::'

-- 
Peter Scott
http://www.perldebugged.com


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

Date: Fri, 4 May 2001 21:07:28 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Compare 2 arrays
Message-Id: <slrn9f66gg.hrt.abigail@tsathoggua.rlyeh.net>

Daniel W. Burke (dwb1@home.com) wrote on MMDCCCIII September MCMXCIII in
<URL:news:Pine.LNX.4.20.0105041020240.4345-100000@ethyl.addictmud.org>:
??  
??  I have an irritating problem.

This group has an irritating problem too. It consists of people who
cannot be bothered to read the FAQ. 

You are part of that problem.


Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: Fri, 04 May 2001 19:11:19 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: Debugging Perl
Message-Id: <r9DI6.27674$q51.262975@news1.gvcl1.bc.home.com>

In article <%oWF6.6399$QV4.535643@www.newsranger.com>,
 Jaime Suarez-Murias (jaime.suarez-murias@icn.siemens.com) writes:
>Is there a book that discusses--with examples--the use of
>Perl's debugger?

Why, yes: "Perl Debugged," by Peter Scott and Ed Wright.  Addison-Wesley, 2001.

:-)

>Is there a GUI debugger available?

Several.  I lean towards ptkdb myself.

-- 
Peter Scott
http://www.perldebugged.com


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

Date: Fri, 04 May 2001 20:24:16 +0200
From: Evelio Martinez <evelio.martinez@testanet.com>
Subject: Doc about sockets
Message-Id: <3AF2F3D0.ED993E70@testanet.com>


Where can I find doc about the distinct values por socket parameters
functions ?

,LEVEL,OPTNAME,OPTVAL etc

--
Evelio Martínez



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

Date: Fri, 4 May 2001 17:03:31 -0400
From: "news.terra.cl" <jorge.sanmartin@corp.terra.cl>
Subject: Form with post method
Message-Id: <uPEI6.3904$cy3.81509@maule>

Hi,
    I need send data from a HTML form to two different cgi programs, one is
remote and the other is local, but both use Post method (I can't modify the
local cgi).
   With get method is so easy send data in the URL, but I dont't know how
the POST method works to send the information.

   Can you help me?

    Thank you

Saludos

        Jorge




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

Date: 4 May 2001 21:49:16 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Form with post method
Message-Id: <9cv84s$dnc$1@bob.news.rcn.net>

news.terra.cl <jorge.sanmartin@corp.terra.cl> wrote:
> Hi,
>     I need send data from a HTML form to two different cgi programs, one is
> remote and the other is local, but both use Post method (I can't modify the
> local cgi).
>    With get method is so easy send data in the URL, but I dont't know how
> the POST method works to send the information.

LWP::UserAgent ought to do the trick; read the LWP Cookbook that comes 
with LWP for examples.



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

Date: Fri, 04 May 2001 15:03:56 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Form with post method
Message-Id: <3AF3274C.4A84B324@stomp.stomp.tokyo>

"news.terra.cl" wrote:

(snipped)
 
> I need send data from a HTML form to two different cgi programs, one is
> remote and the other is local, but both use Post method...

* snaps her fingers *

It's that easy. You state both scripts use a post method
which, in turn, means both have form actions for use.
Replicate both form actions on your html page, with
appropriate URL changes as needed, you are done.
Enter your information, click, wallah! Your browser
handles it from there.

Simple, yes?

Godzilla!


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

Date: Fri, 4 May 2001 14:49:21 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <Pine.SUN.4.33.0105041443330.26945-100000@mamba.cs.Virginia.EDU>

Sorry for being a late-comer...

After all this discussion, I'm still left wondering... WHY?

Is there a documented (and necessary) performance increase in
stripping comments? Has anyone put forth a reasoned argument that
removing comments helps hide IP? Or is there some other reason I'm
missing?

Far be it for me to tell someone else how to spend their time, but I
find this less exciting than spending a man-year trying to get a CPU
cache to be 1% more efficient. (Which plenty of people do, by the
way.) It seems to me that this solution solves none of the real
problems with developing software.

On the other hand, I guess it's a great way to learn Perl. :)

--
David



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

Date: Fri, 04 May 2001 17:51:36 -0400
From: "Methods, Verification [SKY:1G20:EXCH]" <vbook@americasm01.nt.com>
Subject: HELP - Please
Message-Id: <3AF32468.7C6BBAE7@americasm01.nt.com>

Hello Perl wizards...
I'm writting a Perl script, which is supposed to search through a text
file for a specific line, cut it out, and paste it into a new text file.
However, I'm stuck. :( and I was wondering if any of you Perl gurus out
there could lend me a hand with my pathetic problem (by your standards).
Thank you very much.

P.S. How would I stirp out 2 distinct lines and paste them into another
text file (for future reference).

Thank's a lot, and here's what I have so far, and I don't know where to
go from here.

#! /usr/bin/perl

$srcdir = "/home/vbook/perl";

$src = "updates"                        # Source file, one to be
manipulated
$dst = "destination"                    # Destination file, one to be
written to

open(DESTFILE, ">$srcdir/$dst.txt");            # Open destination file

open(SRCFILE, "$srcdir/$src.txt");              # Open source file
@contents = <SRCFILE>;
close(SRCFILE);

$updnum = 1;

while ($contents[$linenum]) {                           # Identify the
starting
      if (($contents[$linenum] =~ /^UPD: \S+$/))        # line, to be
cut, "UPD: "
        &StartLine($updnum);
        $updnum++;
      } else {
        $linenum++;
      }
}



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

Date: Fri, 4 May 2001 23:11:16 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: leftover Close Wait sockets
Message-Id: <9cv67g$fuvpn$1@ID-13368.news.dfncis.de>

"Spork Boy" <sporkboy@Spork.na> wrote in:
news:slrn9f5pvn.rst.sporkboy@Spork.na...
> I'm using perl to access a WinampRC running on a windows machine from my
> Linux machine. It works great, with the exception that it's leaving
> "Close Wait" sockets open on the windows machine. The original windows
> client for the server doesn't send any kind of a goodbye command to
> disconnect as far as I can tell, nor does it leave the Close Wait
> sockets open. Anybody know what could be causing this?
>
But sockets in CLOSE_WAIT state is exactly what you should expect when you
close a socket without sending the goodbye command expected by the peer.
The sockets on the Linux machine are most likely in FIN_WAIT_2 state,
right?
You need to find out, what goodbye command the WinampRC expects.



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

Date: Fri, 04 May 2001 13:45:32 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: Problem with "require" in server
Message-Id: <3AF2F8CC.50D5F4CC@uswest.com>

> According to Mr. Sunray <djberge@uswest.com>:
> > Ok - figured out my own problem.  As per advice from Lincoln Stein's NPWP,
> > I set the current working directory to '/' once the server starts.   I
> > forgot about that.  Once that happened, it was then looking in the root
> > directory rather than the Server's directory for the module.
>
> This doesn't sound like a solution.  Are you saying the the server
> (whatever it is) will always have the directory it resides in for its
> current directory?  This is not something to rely on.  You should
> consider the module FindBin, which gives you the directory of your
> script, independent of the quirks of the operating system.
>
> Anno

The server will always be in a directory called "Brain" and the related modules
in a subdirectory called "BrainModule".

I ended up doing this...

use Cwd;

BEGIN{
   use vars qw($libDir);
   $libDir = getcwd();
   if($libDir =~ /^(.*?)$/){ $libDir = $1 }    # For taint-checking
}

use lib $libDir;        # Looks in server's directory from now on
use blahblah;    # Would always fail here without taint-check

Hopefully there isn't some hidden "gotcha" with this. :)

Thanks.

Mr. Sunray



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

Date: 4 May 2001 21:26:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem with "require" in server
Message-Id: <9cv6pg$134$1@mamenchi.zrz.TU-Berlin.DE>

According to Mr. Sunray <djberge@uswest.com>:
> > According to Mr. Sunray <djberge@uswest.com>:
> > > Ok - figured out my own problem.  As per advice from Lincoln Stein's NPWP,
> > > I set the current working directory to '/' once the server starts.   I
> > > forgot about that.  Once that happened, it was then looking in the root
> > > directory rather than the Server's directory for the module.
> >
> > This doesn't sound like a solution.  Are you saying the the server
> > (whatever it is) will always have the directory it resides in for its
> > current directory?  This is not something to rely on.  You should
> > consider the module FindBin, which gives you the directory of your
> > script, independent of the quirks of the operating system.
> >
> > Anno
> 
> The server will always be in a directory called "Brain" and the related modules
> in a subdirectory called "BrainModule".
> 
> I ended up doing this...
> 
> use Cwd;
> 
> BEGIN{
>    use vars qw($libDir);
>    $libDir = getcwd();

Here you assume that your working directory is also the directory
the executable file you're running resides in.  This assumption
may be justified in some circumstances, but it's no law of nature,
and it's certainly not portable.

[rest of code snipped]

Anno


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

Date: 04 May 2001 15:51:05 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Problem with the subroutine (closure?) for the "sort"
Message-Id: <m3lmoc3nbq.fsf@mumonkan.sunstarsys.com>

nobull@mail.com writes:

> "Alexander Farber (EED)" <eedalf@eed.ericsson.se> writes:
> 
> > Joe Schaefer wrote:
> > > 
> > >   if ($path =~ /\/(\w+)$/) {
> > >     my $match = $1;
> > >     return sub { $hohref->{$a}->{$match} cmp $hohref->{$b}->{$match} };
> > >   }
> > 
> > Thank you, it has finally explained what happens to me.
> > I didn't realize, that sub { ... } evaluates only the
> > lexical (and not dyn.) variables during the compile time.
> 
> No sub { ... } does not cause any variables to evaluated.
> 
> An anonymous[1] subroutine behaves as a _closure_ with respect to
> lexically scoped variable.  That is to say that in the above code each
> time execution passes the statement "my $match=$1" a new variable
> called $match is created.  The anonymous subroutine remebers which
> particular varaible is referred to by the name $match at the time.
> It does not remember the contents of the variable.

Right- I wasn't able to think of simple explanation in just one
paragraph; thanks for clearing up the role of the "my $match=$1" 
line.  Here's some code that demonstrates why just having a lexical 
around isn't really enough to be a "true closure" (not looking to 
start a long and silly about what I mean by that, but I hope it's 
self-evident from the POV of OP's code).

#!/usr/bin/perl -wl
use strict;
{
  my $calls;
  sub factory {
    $calls = 0;             # resets $calls
    return sub { ++$calls } # all closures share the same $calls var!
  }
}

my $foo = factory();

$foo->() for 1..3;
print $foo->();           # 4

my $bar = factory();      # $calls is reset
print $foo->(), $bar->(); # 12

__END__

If you want the final line to print "51", you must move
the "my $calls" declaration inside the factory() sub (but
outside the closure construction) so the declaration can
create a new $calls variable for each new closure.

(Guess I still can't explain it in a single paragraph :)

-- 
Joe Schaefer        "Education consists mainly in what we have unlearned."
                                               --Mark Twain


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

Date: 04 May 2001 18:24:06 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: Recursing a directory tree
Message-Id: <slrn9f5im0.c6g.dave@sydney.daveb.net>

On Fri, 04 May 2001 21:38:19 +1000, Jfreeman <jfreeman@tassie.net.au> wrote:
[I wrote]
>> [...] For example, my home directory has 253
>> subdirectories which begin with "." (recursively counting subdirs
>> of my dot-directories):
>>
>> [dave@sydney dave]$ find . -type d | grep "\.\/\." | wc
>>     253     292    7549
>> [dave@sydney dave]$
>
>If the argument is that you should really have:
>
>>  next if m/^\.{1,2}$/; # skip the dot files
>
>So that you only skip the . and .. files fine.

That is my argument.  The regular expression you used would have 
skipped, for example, a directory named ".gnome" or ".netscape",
and hence all subdirectories thereof.  

>Which directory will list with this?
>
>dir .\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.   (ls ./././././././././././././.)

The directory with that name, if it exists.  Try making a directory
with that name and see for yourself.

--
Dave Bailey
davidb54@yahoo.com


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

Date: 04 May 2001 20:17:53 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Removing attributes
Message-Id: <86oft8kgwe.fsf@jon_ericson.jpl.nasa.gov>

"Philippe Hamel" <hamel@hotmail.com> writes:

[Newsgroups narrowed]
[de-jeopardized]
> "Jon Ericson" <Jonathan.L.Ericson@jpl.nasa.gov> wrote in message
> news:864rv1lrea.fsf@jon_ericson.jpl.nasa.gov...
> > "Philippe Hamel" <hamel@hotmail.com> writes:
> >
> > > I'm trying to delete attributes from an LDAP entry using perl
> > > and associated modules.  I've figured out how to remove whole
> > > entries, but if I just want to delete attributes from an entry,
> > > how do I do that?
> >
> > I don't know the first thing about LDAP (except that I once got
> > Netscape mail to search the jpl.nasa.gov LDAP server).  I know even
> > less how the protocol works.  I don't know the name of the perl module
> > that speaks LDAP.  You didn't give me any perl code to work with.  You
> > didn't give me an error message to parse.  You didn't give me any
> > hints as to what your problem is.  I see you cross-posted to an LDAP
> > group, but this is pretty much off-topic there too (unless there is
> > something about the protocol that makes deleting attributes
> > impossible).  Please consider posting some code.
>
> Well, I did give you an idea of what my problem is.  I'm trying to remove an
> attribute from an entry.  No, there's no error message to parse, because
> there's no code to give an error.  That's the same reason why there's no
> code included in my post.  I'm not getting an error trying to remove an
> attribute with faulty code, I just plain don't know how to do it.

But I didn't know _why_ you "don't know how to do it".  Perhaps
it's impossible because of a protocol limitation.  Perhaps the module
you are using doesn't support it.  Perhaps you didn't read the
documentation of the module you are using.  Perhaps you are misusing
the module.  I'm not a mind-reader.

> Using Net::LDAP's "delete" function, I'm able to remove an entry, but not an
> attribute.  Can an attribute be removed using that function or is there
> another one?
> 
> I'm sure there's a way to do it, since I'm using an LDAP browser that can do
> just that.  Too bad I don't have access to the code of the browser.

Ok, now we're getting somewhere.  LDAP supports deleting an attribute
from an entry and you are using Net::LDAP.  Your question is "using
Net::LDAP how does one delete an attribute from an entry?"  In other
words, you asked hundreds of people to read the module documentation,
instead of doing basic research yourself.

From Net::LDAP:

modify ( DN, OPTIONS )

  Modify the contents of DN on the server. DN May be a string or a
  Net::LDAP::Entry object.

  dn
    This option is here for compatibility only, and may be removed in
    future. Previous releases did not take the DN argument which
    replaces this option.

  add
    The add option should be a reference to a HASH. The values of the
    HASH are the attributes to add, and the values may be a string or
    a reference to a list of values.

  delete
    A reference to an ARRAY of attributes to delete or a reference to
    a HASH (as in add) if only specific values should be deleted. If
    the value for any attribute in the HASH is a reference to an empty
    ARRAY the all instances of the attribute will be deleted.

 ...

Jon


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

Date: Fri, 04 May 2001 20:21:24 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Rename subdirectories and files
Message-Id: <slrn9f63q3.2jc.tjla@thislove.dyndns.org>

"mein Luftkissenfahrzeug ist voll von den Aalen"
said Arun Horne (a.b.horne@exeter.ac.uk) in 
<9cug54$1ujv7$1@athena.ex.ac.uk>:
>Hi I want to rename an entire directory tree in one go such that:
>
>all whitespace is replaced by _'s
>each word in the filename is correctly capitalised, i.e. HeLLo becomes
>Hello and jOb -> Job

find . -print0 | rename -0 's/ /_/g; $_ = ucfirst lc'

You'll need Tom Christiansen's version of rename though. It was posted
here a while back, search on dejagoogle.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Take your work seriously but never take yourself seriously; and do not
take what happens either to yourself or your work seriously.
		-- Booth Tarkington


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

Date: 4 May 2001 20:47:41 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Rename subdirectories and files
Message-Id: <989006760.12453@itz.pp.sci.fi>

In article <9cug54$1ujv7$1@athena.ex.ac.uk>, Arun Horne wrote:
>Hi I want to rename an entire directory tree in one go such that:
>
>all whitespace is replaced by _'s
>each word in the filename is correctly capitalised, i.e. HeLLo becomes
>Hello and jOb -> Job
>
>Can anyone provide me with such code?

  #!/usr/bin/perl -w
  use strict;

  for (reverse split /\0/, scalar `find root_dir -print0`) {
      my ($path, $name) = m!(.*/|)(.*)!s;

      $name =~ s/\s/_/g;
      $name =~ s/([^\W_]+)/\u\L$1/g;
      $path .= $name;

      next if $_ eq $path;
      warn "'$_' -> '$path': file exists\n" and next if -e $path; 
      rename $_, $path or warn "'$_' -> '$path' failed: $!\n";
  }

I tried rewriting it to use File::Find and discovered that at least the
version that comes with perl 5.005_03 breaks when exposed to filenames
with newlines in them.  Sigh.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.


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

Date: Fri, 4 May 2001 21:10:14 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Rename subdirectories and files
Message-Id: <slrn9f66lm.hrt.abigail@tsathoggua.rlyeh.net>

Arun Horne (a.b.horne@exeter.ac.uk) wrote on MMDCCCIII September MCMXCIII
in <URL:news:9cug54$1ujv7$1@athena.ex.ac.uk>:
`'  Hi I want to rename an entire directory tree in one go such that:
`'  
`'  all whitespace is replaced by _'s
`'  each word in the filename is correctly capitalised, i.e. HeLLo becomes
`'  Hello and jOb -> Job


So, what do you do if a directory contains files 'foo bar', 'foo_bar',
'FOO BAR' and 'fOo_BaR'?

Which three will be sacrificed?


Abigail
-- 
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail


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

Date: Fri, 4 May 2001 21:10:17 +0000 (UTC)
From: David.Resnick@comverse.com ("Resnick, David")
Subject: unicode support in perl 5.6 -- I'm trying to get it to work like
Message-Id: <CD0BA48D13A9D311A274009027C5B4B1017C96F6@intm1.btrd.bostontechnology.com>

I'm trying to investigate the unicode support in Perl 5.6 to see if
we can get it to do what we want.  I've been doing the following testing
with these perl builds:
NT-4.0: perl 5.6.0 (from Activestate Binary build 623)
Solaris: perl 5.6.0 built for sun4-solaris

The brief "C" program that I'm trying to emulate in perl:
/***********************************************************/
#include <stdio.h>
#include <locale.h>
#include <wchar.h>

#if _WIN32
static const char* locale_str = "english-us_usa.1252";
#else /* Following works on solaris */
static const char* locale_str = "en_US.UTF-8";
#endif

int
main(void)
{
  wchar_t w;
  char *result;
  int walpha, wdigit, wprint;

  result = setlocale(LC_CTYPE, locale_str);

  if (!result) {
    fprintf(stderr, "setlocale with arg '%s' failed!\n\n",
	    locale_str ? locale_str : "<NULL>");
    return 1;
  }

  w = 0, walpha=wdigit=wprint=0;
  do {
    if (iswalpha(w)) walpha++;
    if (iswdigit(w)) wdigit++;
    if (iswprint(w)) wprint++;
  } while (w++ != 0xFFFF);
  
  printf ("totals:\nisprint\t%d\nisdigit\t%d\nisalpha\t%d\n\n", wprint,
	  wdigit, walpha);
  return 0;
}
/***********************************************************/
The results of this are as follows:
        Solaris  NT
isprint 45271    38888
isdigit 20         192
isalpha 36121    36150

While the differences between these 2 OSs are intriguing (e.g. winnt thinks
that
U+0660 ARABIC-INDIC DIGIT ZERO is a digit, solaris doesn't for the locale
settings used), that isn't really what I'm concerned about.  I think that
the
following perl program should yield roughly the same results.  And it really
doesn't.

###############################################################
#!/usr/local/bin/perl5.6.0 -w  # for solaris, where we have 5.005_03 as
default
#!/usr/local/bin/perl -w       # for NT, it is 5.6.0, switch top two lines
for it

use POSIX qw(locale_h isalpha isprint isdigit);
use locale;
use utf8;
require 5.6.0;

my ($locale_str);

if ($^O =~ /win/i) { $locale_str = qw(english-us_usa.1252);}
else { $locale_str = qw(en_US.UTF-8);}

my ($result) = setlocale(LC_CTYPE, $locale_str);
if ($result) {
    my ($i, $letter, $alpha, $print, $digit);
    for ($i=0x0, $alpha=$print=$digit=0; $i<=0xffff; $i++) {
	$letter = chr($i);
	$alpha++ if (isalpha($letter));
	$print++ if (isprint($letter));
	$digit++ if (isdigit($letter));
    }
    printf("\ntotals:\nisprint\t%d\nisdigit\t%d\nisalpha\t%d\n\n", $print,
	   $digit, $alpha);
}
else {	
    print ("\n$locale_str setlocale failed***\n");
}
############################################################################
I get the following results:
        Solaris  NT
isprint 86       55974
isdigit 10       13
isalpha 52       1298

Irk.  What am I doing wrong here?  I feel like I have some basic thing I'm
missing in understanding perl's unicode support.  I've prowled the
obvious documentation sources (perldoc, camel book, web searching, etc), and
not found enlightenment.  Why are my results so different between perl and
C?
I thought that functions like isalpha in perl were supposed to behave a bit
Do I need to be using utf-8 encoding rather than unicode (not what I'd
gathered
looking at, e.g., the chr() documentation)???

I should note that the results don't appear to depend on the locale (I can
comment out the
locale pragma and setlocale with no effect on these results).

Any suggestions would be most welcome.  These include suggestions to RTFM
(of
course, telling me which one to R would be particularly useful).  My goal is
to roughly be able to reproduce my "C" program...

-David



-- 
Posted from ns2.comverse.com [63.64.185.39] 
via Mailgate.ORG Server - http://www.Mailgate.ORG


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

Date: Fri, 04 May 2001 22:03:11 GMT
From: Dan <nospam@newsranger.com>
Subject: UPPERCASE to "Sentence Case"
Message-Id: <zGFI6.1700$vg1.142294@www.newsranger.com>

Can someone point me to a resource that has information on converting text that
is all uppercase into "sentence case".  All uppercase will need to be converted
to lowercase except for the first word of a sentence will need to remain
uppercase.  The text I need to convert often contains ellipses, so the word
after an ellipsis will need to be capitalized, also.

Also, certain words not at the beginning of the sentence will need to be
capitalized and I would assume that will require some sort of list of words and
the code will have to check for those words.  

If someone could direct me to a resource with information on this topic, I would
greatly appreciate it.

Thanks,
Dan




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

Date: Fri, 4 May 2001 21:31:47 +0200
From: "Murat Uenalan" <murat.uenalan@gmx.de>
Subject: Re: use Apache::Htpasswd
Message-Id: <9cv01v$fu6b0$1@ID-71895.news.dfncis.de>

"Mike Song" <Mike.Song@usa.net> schrieb im Newsbeitrag
news:3AF2EA84.60B1FE9F@usa.net...
> Hello;
>
> I know very little about Perl and want to set a web page with
> password protection. I already installed module use Apache::Htpasswd

the modules name is "Apache::Htpasswd" and the 'use' statement is a perl
function

> on my Linux box.
>
> Anyone know of a complete example of using use Apache::Htpasswd?

nearly every perl-module has a "builtin" documentation called 'pod
documentation'. It often contains a complete explanation of the functions
and often some example code how to use it. To access it, just type

"perldoc Apache::Htpasswd" into your shell to read the documentation.

>
> Thanks
> Mike
>

You are wellcome,
Murat





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

Date: Fri, 04 May 2001 22:28:55 +0200
From: "Perl Lover" <dj@syntaxerror.crazydj.de>
Subject: Using Modem::Vgetty
Message-Id: <20010504.222855.968338082.2945@Syntaxerror.crazydj.de>

Hello.
Can anyone of you explain how to use the module Modem::Vgetty to use my
voice modem as an dial-in-server?
I have read the documentation, but it doesn't work. Also the examples
like answering-machine.pl does't work...
Or maybe you know a better module or way of programming to solve my
problem.
Thanks a lot.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 V10 Issue 836
**************************************


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