[15805] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3218 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 31 09:05:29 2000

Date: Wed, 31 May 2000 06:05: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: <959778313-v9-i3218@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 31 May 2000     Volume: 9 Number: 3218

Today's topics:
    Re: @array (Bart Lateur)
    Re: accessing library files in a module <michael.schlueter@philips.com>
        Binary To ASCII <memberjh@yahoo.com>
        CGI.pm!! <arun67@yahoo.com>
    Re: CGI.pm!! <derek@ccil.org>
        conditional ? not working as expected <mcardeiro@yahoo.com>
    Re: conditional ? not working as expected <billy@arnis-bsl.com>
    Re: conditional ? not working as expected <mikecard@my-deja.com>
    Re: conditional ? not working as expected <sweeheng@usa.net>
    Re: conditional ? not working as expected npecca@yahoo.com
    Re: conditional ? not working as expected <ak@dasburo.de>
    Re: conditional ? not working as expected (Peter J. Acklam)
    Re: directory permissions in NT <carvdawg@patriot.net>
        Error in LWP [Bad arg length for Socket::unpack_sockadd <aboy@usa.net>
    Re: hola <webmaster@ostas.lu.se>
    Re: How do I make perl flush? <sweeheng@usa.net>
    Re: How do I make perl flush? (Bart Lateur)
    Re: modify the environment variables permanently via Pe <Petri_member@newsguy.com>
    Re: Modules in modules question <michael.schlueter@philips.com>
    Re: Passing print statements (Bart Lateur)
    Re: Perl unusable as a programming language (Philip 'Yes, that's my address' Newton)
    Re: Perl unusable as a programming language (Simon Cozens)
    Re: Perl unusable as a programming language <ken@forum.swarthmore.edu>
    Re: Perl unusable as a programming language <ariels@compugen.co.il>
    Re: Powered by Perl logo (Neil Kandalgaonkar)
        socket : should I use 'print' to send data ? <am@bocal.cs.univ-paris8.fr>
        use File::Find <bobmerrill@my-deja.com>
        Why this matching/replace is not working? <david@atlantis.bus.ucf.edu>
    Re: Why this matching/replace is not working? <sweeheng@usa.net>
    Re: Why this matching/replace is not working? <red_orc@my-deja.com>
    Re: Why this matching/replace is not working? <billy@arnis-bsl.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 31 May 2000 12:55:02 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: @array
Message-Id: <39390a22.4466281@news.skynet.be>

Todd Anderson wrote:

>I've got 2 arrays and I need to print each element in each array in
>parrallel...
>Can this be done? Thanks for your help.
>@numbers = (0..177);
>@array = ( "r_name0", "r_name1", etc. to 177);
>
>print qq~"$array|$number|=|string";\n~;
>or...
>"r_name0|0|=|string";
>"r_name1|1|=|string";
>etc...

loop from 0 to 177, and print each array item:

	print qq~$array[$_]|$number[$_]|=|string";\n~ for 0 .. 177;

-- 
	Bart.


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

Date: Wed, 31 May 2000 15:35:41 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: accessing library files in a module
Message-Id: <8h30v7$6bs$1@porthos.nl.uu.net>

Zolla,

I could not find mapscript.pm on CPAN. So my first questions are:

* who wrote it?
* where do you have it from?
* is it properly installed via   perl Makefile.PL, make, make test and make
install ?

In which library will you find mapscript.pm? Perhaps you will have to
specify that one via:

    #!/usr/bin/perl -w    # issue warnings
    use lib ".";            # if mapscript.pm is in the same dir.
    use mapscript;

else type:

    use lib "your_path_her";


You can check the library pathes perl will use e.g. by just calling
   perl -V    .
Convention is to use uppercase for modules. So better use:

Mapscript.pm


Michael Schlueter





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

Date: Wed, 31 May 2000 07:34:38 -0400
From: "Jane H." <memberjh@yahoo.com>
Subject: Binary To ASCII
Message-Id: <8h2tce$eko$1@nntp9.atl.mindspring.net>

I have a binary file I am trying to open and save as ASCII.  I know this is
easy,  I just can't figure it out.  Any help is appreciated. Thanks in
Advance, Jane.




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

Date: Wed, 31 May 2000 11:30:04 GMT
From: Arun Mahajan <arun67@yahoo.com>
Subject: CGI.pm!!
Message-Id: <sj9ttsi5pj40@corp.supernews.com>

hi Everybody,

First of all let me thank you everybody who is answering my question. This 
is a great interactive group, where i am always sure to get a good 
positive feedback. thanks once again who ever is contributing.

As I am new to cgi programming and just come to know about the CGI.pm lib. 
i 'll be highly obliged if somebody can provide the good reference site 
for the same.

Thanks in advance for the help.

regards,

arun mahajan

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Wed, 31 May 2000 12:09:06 GMT
From: Derek D'Angelo <derek@ccil.org>
Subject: Re: CGI.pm!!
Message-Id: <8h2vco$384$1@nnrp1.deja.com>

I just asked the same, here is the thread, everyone was very helpful

http://x72.deja.com/viewthread.xp?thitnum=79&mhitnum=0&toffset=0&CONTEXT
=959774714.1560674314&frpage=threadmsg_ct.xp&back=comp.lang.perl.misc&ne
w=0&rok=1

it was posted 5/30 " CGI.pm function list/definitions "

In article <sj9ttsi5pj40@corp.supernews.com>,
  Arun Mahajan <arun67@yahoo.com> wrote:
> hi Everybody,
>
> First of all let me thank you everybody who is answering my question.
This
> is a great interactive group, where i am always sure to get a good
> positive feedback. thanks once again who ever is contributing.
>
> As I am new to cgi programming and just come to know about the CGI.pm
lib.
> i 'll be highly obliged if somebody can provide the good reference
site
> for the same.
>
> Thanks in advance for the help.
>
> regards,
>
> arun mahajan
>
> --
> Posted via CNET Help.com
> http://www.help.com/
>

--
derek@ccil.org


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


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

Date: Wed, 31 May 2000 11:25:08 GMT
From: mike cardeiro <mcardeiro@yahoo.com>
Subject: conditional ? not working as expected
Message-Id: <8h2sq7$1a1$1@nnrp1.deja.com>

hi

I have an array @keys that has 16 elements in it.

why does the following code print 20, it should(i thought) print 0

(@keys < 26)?$y=0:$y=20;
print "$y\n";

mike cardeiro


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


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

Date: Wed, 31 May 2000 11:54:45 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: conditional ? not working as expected
Message-Id: <8h2uhv$2h3$1@nnrp1.deja.com>

In article <8h2sq7$1a1$1@nnrp1.deja.com>,
  mike cardeiro <mcardeiro@yahoo.com> wrote:
> hi
>
> I have an array @keys that has 16 elements in it.
>
> why does the following code print 20, it should(i thought) print 0
>
> (@keys < 26)?$y=0:$y=20;
> print "$y\n";
>

Change it to:

( @keys < 26 ) ? $y=0 : ($y=20);

From perldoc perlop:

--> Because this operator produces an assignable result, using assignments
without parentheses will get you in trouble.

So you really got (( @keys < 26 ) ? $y=0 : $y)   =  20;   #  assigns 20 to $y.

Consult perldoc perlop or http://www.cpan.org/doc/manual/html/pod/perlop.html
for complete explanation.

Good luck.
Ilja.


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


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

Date: Wed, 31 May 2000 12:10:15 GMT
From: mike cardeiro <mikecard@my-deja.com>
Subject: Re: conditional ? not working as expected
Message-Id: <8h2vet$3a6$1@nnrp1.deja.com>

In article <8h2uhv$2h3$1@nnrp1.deja.com>,
  Ilja Tabachnik <billy@arnis-bsl.com> wrote:
> In article <8h2sq7$1a1$1@nnrp1.deja.com>,

>
> Change it to:
>
> ( @keys < 26 ) ? $y=0 : ($y=20);
>
> From perldoc perlop:
>
> --> Because this operator produces an assignable result, using
assignments
> without parentheses will get you in trouble.

thank you very much

mike cardeiro


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


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

Date: Wed, 31 May 2000 20:35:34 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: conditional ? not working as expected
Message-Id: <8h30k1$33u$1@coco.singnet.com.sg>

mike cardeiro <mcardeiro@yahoo.com> wrote in message
news:8h2sq7$1a1$1@nnrp1.deja.com...
> hi
>
> I have an array @keys that has 16 elements in it.
>
> why does the following code print 20, it should(i thought) print 0
>
> (@keys < 26)?$y=0:$y=20;
> print "$y\n";

Read "perldoc perlop".

Since ?: has a higher precedence than =, what happened is that your
expression is interpreted as:
  ((@keys < 26) ? $y=0 : $y) = 20;
Whatever the outcome of (@keys < 26), the $y variable is returned on the
left hand side and subsequently assigned the value of the right hand side,
namely 20.

What you need is:
  (@keys < 26) ? ($y=0) : ($y=20);
or how I usually do it:
  $y = (@keys < 26) ? 0 : 20;

Swee Heng




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

Date: Wed, 31 May 2000 12:21:22 GMT
From: npecca@yahoo.com
Subject: Re: conditional ? not working as expected
Message-Id: <8h303k$3ni$1@nnrp1.deja.com>

  mike cardeiro <mcardeiro@yahoo.com> wrote:
> I have an array @keys that has 16 elements in it.
> why does the following code print 20, it should(i thought) print 0
>
> (@keys < 26)?$y=0:$y=20;
> print "$y\n";

I think you had better use

$y = (@keys < 26)? 0 : 20;   # or ($#keys < 25)...

it works as you could expect...


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


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

Date: Wed, 31 May 2000 14:45:05 +0200
From: Alexander Knack <ak@dasburo.de>
To: mike cardeiro <mcardeiro@yahoo.com>
Subject: Re: conditional ? not working as expected
Message-Id: <39350951.F9BD9778@dasburo.de>

hi,

anyway i would write it as
$y = (@keys < 26) ? 0 : 20;

-- 
+--------------------------------------------------------------------+
| Alexander Knack  ........Entropie erfordert keine Wartung .........|
|  dasburo.de      ..................................................| 
+--------------------------------------------------------------------+


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

Date: 31 May 2000 14:36:19 +0200
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: conditional ? not working as expected
Message-Id: <wkn1l6sxq4.fsf@math.uio.no>

mike cardeiro <mcardeiro@yahoo.com> wrote:

> I have an array @keys that has 16 elements in it.
> 
> why does the following code print 20, it should(i thought) print 0
> 
> (@keys < 26)?$y=0:$y=20;
> print "$y\n";

Ilja Tabachnik <billy@arnis-bsl.com> writes:
 
> Change it to:
> 
> ( @keys < 26 ) ? $y=0 : ($y=20);

Why not

   $y = @keys < 26 ? 0 : 20;

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


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

Date: Wed, 31 May 2000 07:21:05 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: directory permissions in NT
Message-Id: <3934F5A1.421D5D4A@patriot.net>

> The script that I'm playing with goes through directories collecting
> information on file sizes and dates.  The script is running on a Win NT 4
> system and therefore there are directories that I do not have permission to
> view/access.

Okay, so the ACLs are set such that you do not have access.  And you are
running this as a user, not as an administrator.

>   I want my script to then display a message informing me that
> the dir could not be accessed.

Okay, should be easy enough.  Do you want the script to "die" or just display
the
message and then move on?

> My plan was to use one of the file tests to
> check if I have read access to the directory.

Oh, so you're not so much looking to gather statistics of sizes and dates, as
much as you are trying to determine which files/dirs you have access to,
correct?

> >go...http://www.roth.net/perl/perms
>
> OK....thanks....I'll check it out.

Let me know if you need help with the code...Dave wrote some a year
ago that returns the ACLs in a nice, easy-to-read format...



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

Date: Wed, 31 May 2000 18:10:18 +0700
From: "Boy" <aboy@usa.net>
Subject: Error in LWP [Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16]
Message-Id: <8h2rnb$3og$1@news.ksc.co.th>

From my perl program :
----------------------------------------------------------------------------
--------------
#!/usr/bin/perl -Tw

  # Create a user agent object
  use LWP::UserAgent;
  $ua = new LWP::UserAgent;
  $ua->agent("AgentName/0.1 " . $ua->agent);

  # Create a request
  my $req = new HTTP::Request GET => 'http://199.89.201.39/index.html';
  $req->content_type('application/x-www-form-urlencoded');
  $req->content('match=www&errors=0');


  # Pass request to the user agent and get a response back
  my $res = $ua->request($req);


  # Check the outcome of the response
  if ($res->is_success) {
      # Change HREF to be pop-up window
      $tmp = $res->content;
      $tmp =~ s/A HREF/A TARGET\=\"_BLANK\" HREF/gi;
      print "Content-Type:text/html \n\n";
      print $tmp;
  } else {
      print "Content-Type:text/html \n\n";
      print "Unable to connect to the news server!<br>\n";
      print "Error: ". $res->message ."\n";
  }

----------------------------------------------------------------------------
--------------
I will found the error as below:

----------------------------------------------------------------------------
--------------
Use of uninitialized value at
/usr/local/lib/perl5/5.00503/sun4-solaris/Socket.pm line 295.
Content-Type:text/html

Unable to connect to the news server!<br>
Error: Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be
16
----------------------------------------------------------------------------
--------------



What is my mistake?
How can I solve it?




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

Date: Wed, 31 May 2000 13:26:12 +0200
From: Jimmy Lantz <webmaster@ostas.lu.se>
Subject: Re: hola
Message-Id: <3934F6D4.513AA064@ostas.lu.se>

Bastante bien!
Pero este "newsgroup" no era para "chattear".
/ Jaimito de Suecia

oleoleole30@hotmail.com wrote:
> 
> que tal?


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

Date: Wed, 31 May 2000 19:14:23 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: How do I make perl flush?
Message-Id: <8h2rro$pql$1@clematis.singnet.com.sg>

> So, how do I flush the output file (or do whatever) so diff sees a
> fully written file?

perldoc -q flush

select((select(FILE_HANDLE), $|=1)[0]);




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

Date: Wed, 31 May 2000 12:07:51 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How do I make perl flush?
Message-Id: <39360083.2003334@news.skynet.be>

Fearless wrote:

>So, how do I flush the output file (or do whatever) so diff sees a
>fully written file?

Close the file. Explicitely.

-- 
	Bart.


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

Date: 31 May 2000 05:15:04 -0700
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: modify the environment variables permanently via Perl
Message-Id: <8h2vo8$k41@edrn.newsguy.com>

In article <3934BA4E.3C8ACCA3@ieee.org>, Andreas says...
>> ++ I am looking for a way to modify the environment variables permanently
>> ++ via Perl.

>> Easy. Just install VMS.

>What is VMS?

It's an OS from Digital, but Andreas; On what platform do you want to accomplish
this?
Is it NT, then it's possible with system() and 'setx.exe' from NT Server ResKit.
Maybe it's also possible in native Perl with some Win32::modules, but I have
never tried that.
If it's unix/linux you only need to modify your shell config files accordingly
for your specific system, just as you would do without Perl.


Petri Oksanen



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

Date: Wed, 31 May 2000 15:43:43 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: Modules in modules question
Message-Id: <8h31e8$6jj$1@porthos.nl.uu.net>

> The questions:
> -Why does it want to change -title=> to "title" =>  ??
> -Why does it only want to change -title and -meta, but not -author or
>      -BGCOLOR?
>
>

Honestly,
I can not understand this from your code. Sounds like something is wrong
before, like a missing semicolon or such. I would check:

    * removal and rearrangements of use strict;
    * run perl -d and  use common   from the debuggers command line; check
if results change
    * just to be sure I'd put      print $query->header();






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

Date: Wed, 31 May 2000 12:04:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Passing print statements
Message-Id: <3934ff09.1624791@news.skynet.be>

Ron Auer wrote:

>Here is what I would like to do:
>___________________________________________________________
>
>sub test {
>printf $_[0];
>
>}
>
>$format = "%-45s \t%6s \t%-15s\n";
>$print_statement= $format, "Data", "More Data", "And more data";
>test ($print_statement);

Why are you using a scalar when what you want is an array?

p.s. There is a function prototype problem with one of qw(printf
sprintf). One of them requires that the FORMAT is a separate scalar. So
the safest is to do it for both:

      sub test {
           my $format = shift;
           printf $format, @_;
      }

      @print_statement= ($format, "Data", "More Data", "And more data");
      test (@print_statement);

Dare I post this untested? I dare.

-- 
	Bart.


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

Date: Wed, 31 May 2000 07:37:50 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Perl unusable as a programming language
Message-Id: <3934b39d.223817732@news.nikoma.de>

On Tue, 30 May 2000 10:39:22 -0700, Russell Bornschlegel
<kaleja@estarcion.com> wrote:

> I would rather that Perl's competition be, for example, Python, and not 
> Microsoft Visual Perl++.

I suppose you mean ActiveState Visual Python / Visual Perl, which will
integrate into Microsoft's Visual Studio 7.

There's a press release on their web site.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: 30 May 2000 22:15:25 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Perl unusable as a programming language
Message-Id: <slrn8j8fbt.drl.simon@justanother.perlhacker.org>

Ilya Zakharevich (comp.lang.perl.moderated):
>The largest differences are that usually nature does not change under
>your foot, and nature has no malice. 

Will you *please*, for the love of God and all the saints, stop
spreading the malicious and misleading untruth that Perl is
non-deterministic.

Ilya, it's a program. They don't have malice. They do what you tell
them. *Always*.

-- 
After the game the king and the pawn go in the same box.
		-- Italian proverb


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

Date: Tue, 30 May 2000 19:18:05 -0500
From: Ken Williams <ken@forum.swarthmore.edu>
Subject: Re: Perl unusable as a programming language
Message-Id: <300520001918051219%ken@forum.swarthmore.edu>

In article <slrn8j8g3k.drl.simon@justanother.perlhacker.org>, Simon
Cozens <simon@brecon.co.uk> wrote:

>Tushar Samant (comp.lang.perl.moderated):
>>is a feature which is not optional, or seen only by people who venture "out
>>of the box". And the average programmer can only discover it accidentally.
>
>You appear to have carelessly snipped my point that undocumented special
>cases in any language leave you unprotected. 

I think you guys must agree on this - that when the documentation
doesn't tell you what a particular bunch of code should do, but it does
something anyway, it's a problem.  You can either figure out the "real"
behavior by trying a few experiments and considering the matter settled
(probably a bad idea), or by getting someone to document what the
behavior should be (pretty good), or by avioding the construct in the
first place.

>>>> If it's true, no experimentation is going to prove it.
>>>I apparently have a lot to learn about the scientific method.
>>Scientific method is irrelevant here, 
>
>Nope. Earlier you said that you couldn't understand those who abhorred
>cargo cult programming and you praised the empirical method. I think we
>must differ in terms of definition here, but cargo cult programming is
>applying received wisdom without thinking - the empirical method is
>getting out there with a command line and poking around, it's
>independent investigation. They're not just different, they're exact
>opposites.

I disagree.  In both cases someone's using code because they noticed
that it works, not because they necessarily understand it.  In general
it's very dangerous to use methods when all you know about them is that
they "work," because often all cases haven't been considered.  I'm sure
you know this, but I'm not trying to be condescending.

I'm certainly not saying that experimentation is always bad - it's how
we all learned to program.  But ideally when you experiment you're
coming to understand documented behavior.


>
>> A false statement can be disproved in one case; a true statement
>> verified a hundred times will still leave doubt about some special
>> case.
>
>This is true in all cases, not just Perl. Doesn't seem to stop
>scientists making guesses at how the world works. 

Right - but scientists can never prove anything.  

Mathematicians can prove that if you believe a certain set of
assumptions (axioms) and a certain set of rules for getting from one
fact to another (logic), then you must believe a whole bunch of other
things.  But they can't prove that something is simply true or false -
it all depends on your axiom set.

Scientists, by contrast, are interested in knowing whether facts about
the universe are true or false.  But since they don't have the luxury
of knowing what the axioms of the universe are, they can't use actual
methods of proof.  They can come up with plausible theories, then test
those theories against observations, but if some new experiment shows
that nature differs significantly from the current theory, the theory
goes out the window.  Since this can always happen, nothing can ever be
proven true in science.

The role of the scientific method is to increase our belief in the
current theories, or even better, to show that they are wrong.

>We've got the theory - the source code and documentation - and the
>experiment - trying things out with the interpreter. Now, if the results
>of the experiment aren't what theory predicted, we need to update the
>theory.

One of the interesting things about Perl (like other complicated
things) is that its deterministic nature (which necessarily underlies
all of its behavior, as you say) tends to fade into the background
sometimes.  And sometimes the best way to figure out what the
interpreter will do (not what it *should* do, or how you should write
your programs) is by experimentation, not by consulting docs.  Which is
a bit scary sometimes.


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

Date: 31 May 2000 09:12:24 +0300
From: Ariel Scolnicov <ariels@compugen.co.il>
Subject: Re: Perl unusable as a programming language
Message-Id: <yzqvgzvdz93.fsf@compugen.co.il>

Tushar Samant <Tbone@pimpdaddy.com> writes:

> yf110@victoria.tc.ca writes:
> >Perhaps its just me, but that one doesn't seem that bizarre. Perl
> >variables are passed by reference, and your example (implicitly) reuses a
> >global variable before you make a copy of its original value. 
> 
> It doesn't seem very bizarre anymore, I agree. The $1 distracted me;
> it wasn't much to do with it. sub f { $x=2; print shift() }; f($x=1);
> would do the same "bizarre" thing...

You can see a similar effect if you pass $1 to

    sub foo { $_[0]=42 }

However, I'm at a loss to explain this:

  DB<13> sub foo { $_[0] = 42 }

  DB<14> $x = 10

  DB<15> x foo($x+1)
0  42
  DB<16> x $x
0  10

What's the difference here between an *expression* ("foo($x+1)" works,
modifying nothing) and a *constant* ("foo(1)" and "*y=\1; foo($y)"
fail)?

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | ariels@compugen.co.il
Compugen Ltd.          |Tel: +972-2-6795059 (Jerusalem)	\ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels


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

Date: 31 May 2000 10:21:12 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Powered by Perl logo
Message-Id: <8h2p2o$add$1@newsflash.concordia.ca>

In article <200005301646.MAA31514@fozzie.webservepro.com>,
Jimmy Hat <jimmy@jimmy-hat.com> wrote:
>Does anyone know of a "Powered by Perl" logo free
>for use to point back to an advocacy site
>like http://www.perl.org ?
>
>-Jimmy
>

Funny, we don't seem to have any of those. 

There is the old "Programming Republic of Perl" button. 

http://www.pm.org/web_site_frosting.shtml

-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Wed, 31 May 2000 13:51:26 +0200
From: Michelizza Arnauld <am@bocal.cs.univ-paris8.fr>
Subject: socket : should I use 'print' to send data ?
Message-Id: <3934FCBE.60B4@bocal.cs.univ-paris8.fr>

I made a little client and a little server. The client sends a request
and then 
waits for an answer. Here is the client/server tcp interaction :
    S <--- C
    S ---> C

If I use 'Socket' module and if I try to send the request with print,
the server
 never receive the request. I mean that the server blocks because he
waits for a
 request (that was already send by the client). Instead, if the client
sends the
 request with 'send', all works fine.

If I use 'IO::Socket' module, I can send any datas with 'print' and all
works fi
ne.

I do not understand why the server doesn't seem to receive any data in
the first
 case.

Any explanation ?

Arnauld


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

Date: Wed, 31 May 2000 12:08:43 GMT
From: Dr. Bob <bobmerrill@my-deja.com>
Subject: use File::Find
Message-Id: <8h2vc2$382$1@nnrp1.deja.com>

Is there something "different" about the variable $File::Find::name in
the File::Find module?

I wanted to use this variable (following the example 9.7 in "Perl
Cookbook" in this sort of fashion:

 ...
$newd=cwd();
find sub { push @fillist, $File::Find::name unless -d }, $newd;
foreach $file (@fillist) {
   ...  do some stuff (open, close, s/.../.../ in files
}

and I couldn't.  The program ran (and some debug print's showed that the
names were correct), but the statements:

$tmpfil="tmpfil.out";
 ...
     rename $file, $tmpfil || die "cannot rename $file to $tmpfil\n";
     open INP, "$tmpfil" || die "cannot open tmpfil\n";
     open OUT, ">$file"  || die "cannot re-open $file\n";

didn't work (judging from modtimes and results).

HOWEVER, if I took the following, extremely in-elegant, route, things
worked fine:

find sub { push @fillist, $File::Find::name unless -d }, $newd;
open TMP,">tmpfilist.out";
foreach $joe (@fillist) {
   print TMP "$joe\n";
}
close TMP;

open TMP, "tmpfilist.out";
$tmpfil='oldfil.out';
while (<TMP>) {
  print "Fixing file $_";
  chomp;
  unless (/\.tar$/ || /\.gz$/ || /\.pla/) {
     $file=$_;
     rename $file, $tmpfil || die "cannot rename $file to $tmpfil\n";
     open INP, "$tmpfil" || die "cannot open tmpfil\n";
     open OUT, ">$file"  || die "cannot re-open $file\n";
 ...

Note the use of a temporary file (tmpfilist.out) to store the names to
storage, and then the closing/reopening of this text file to retrieve
the file names.

It worked, I finished that project.  But the experience left me thinking
that there was something different about $File::Find::name.

Any thoughts?



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


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

Date: 31 May 2000 11:29:19 GMT
From: David Collantes <david@atlantis.bus.ucf.edu>
Subject: Why this matching/replace is not working?
Message-Id: <8h2t2f$79p$1@news.cc.ucf.edu>


I have the following:

	$sub_post =~ s/\s+/&nbsp;\+/;

What I am trying to accomplish is to replace any number of SPACES for the same ammount of &nbsp;. What I am missing
there? Help anyone?!

Thanks in advance,


-
David


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

Date: Wed, 31 May 2000 20:05:04 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Why this matching/replace is not working?
Message-Id: <8h2uqv$2ts$1@coco.singnet.com.sg>

David Collantes <david@atlantis.bus.ucf.edu> wrote in message
news:8h2t2f$79p$1@news.cc.ucf.edu...
>
> I have the following:
>
> $sub_post =~ s/\s+/&nbsp;\+/;
The \+ symbol does not make Perl replace all occurrence. It just means the
'+' character literally. Read "perldoc perlop" to learn how one uses s///
properly.

> What I am trying to accomplish is to replace any number of SPACES for the
same
> ammount of &nbsp;. What I am missing there? Help anyone?!
The \s symbol includes TABs too. Do you want to replace a TAB with a &nbsp?

I think what you are after is this:

$sub_post =~ s/ /&nbsp;/g;





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

Date: Wed, 31 May 2000 12:25:07 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Why this matching/replace is not working?
Message-Id: <8h30ak$3or$1@nnrp1.deja.com>

In article <8h2t2f$79p$1@news.cc.ucf.edu>,
  David Collantes <david@atlantis.bus.ucf.edu> wrote:
>
> I have the following:
>
> 	$sub_post =~ s/\s+/&nbsp;\+/;

use the global indicator:

$sub_post =~ s/\s/&nbsp;/g;

<note>
remember that a 'tab' is a single whitespace character
</note>


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


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

Date: Wed, 31 May 2000 12:29:35 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Why this matching/replace is not working?
Message-Id: <8h30j0$430$1@nnrp1.deja.com>

In article <8h2t2f$79p$1@news.cc.ucf.edu>,
  David Collantes <david@atlantis.bus.ucf.edu> wrote:
>
> I have the following:
>
> 	$sub_post =~ s/\s+/&nbsp;\+/;
>
> What I am trying to accomplish is to replace any number of SPACES for the same ammount of &nbsp;. What I am missing
> there? Help anyone?!
>

$sub_post =~ s/\s/&nbsp;/g;

or

$sub_post =~ s/(\s+)/'&nbsp;' x length($1)/ge;

Hope this helps.
Ilja.



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


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

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 3218
**************************************


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