[7969] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1594 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 7 11:28:48 1998

Date: Wed, 7 Jan 98 08:00:31 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 7 Jan 1998     Volume: 8 Number: 1594

Today's topics:
     Re: "shift @array" question (Peter J. Schoenster)
     Re: Advanced Perl Programming book <mgm@gxn.net>
     Anybody Wants A CGI/PERL Programmer? <chunhoh@pc.jaring.my>
     Date of the inclusion of CGI into the HTTP server? albuquer@ill.fr
     file glob restrictions?! <jakob@ermine.ox.ac.uk>
     how does hashes work in angle brackets ? <gand@vtsoft.hu>
     Re: how does hashes work in angle brackets ? (M.J.T. Guy)
     Re: how does hashes work in angle brackets ? <gand@freemail.c3.hu>
     Re: Lexical scope and embedded subroutines. (Chip Salzenberg)
     Re: Lexical scope and embedded subroutines. (Chip Salzenberg)
     Re: Looking for way to download files to browsers using (Clay Irving)
     Re: Looping through hashes (M.J.T. Guy)
     Markees <svetter@ameritech.net>
     Re: Newbie: Problem with file handling under WindozeNT  <Richard.Locke@sni.nl>
     orange - script to send a message to an orange phone (Neil Bowers)
     Re: orange - script to send a message to an orange phon (Neil Bowers)
     Perl program transfer <svetter@ameritech.net>
     Re: Perl program transfer (Clay Irving)
     Precompiled binaries [DateCalc|DateManip] for WinNT <bodemann@do.isst.fhg.de>
     Re: printing quotes with print command <jacklam@ulrik.uio.no>
     Re: printing quotes with print command (Malcolm Hoar)
     Re: Processnumber $$ on NT <bjorn.elstad@sds.no>
     Re: Processnumber $$ on NT (Keith Willis)
     Re: Q: search matching "(" and ")" tobez@plab.ku.dk
     Re: Querying info from other server (Phil Buckley)
     Re: Querying info from other server (Clay Irving)
     Running Perl off a portable drive? (John Robson)
     Re: sending email (Net::SMTP).. problem <gbarr@ti.com>
     Re: serious post about gmtime and year-1900 (was Re: Pe (Chip Salzenberg)
     Re: Sinking STDOUT and STDERR (M.J.T. Guy)
     Re: Sinking STDOUT and STDERR (Jean-Damien Durand)
     socket help needed... <boschini@mail.cilea.it>
     Re: socket help needed... (M.J.T. Guy)
     Re: socket help needed... (Keith Willis)
     TEST IF A VALUE EXISTS IN AN ARRAY (Smellymama)
     Trimming blanks <canugi@hotmail.com>
     Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP! (Peter N Lewis)
     Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP! (Sean O'Dwyer)
     Unix perl shell ??? <eat@joes.nospam.deli>
     unlink return value <barnett@houston.Geco-Prakla.slb.com>
     Re: unlink return value (Keith Willis)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 07 Jan 1998 11:15:13 GMT
From: pschon@baste.magibox.net (Peter J. Schoenster)
Subject: Re: "shift @array" question
Message-Id: <34b36321.92020848@chaos.magibox.net>

[cc to author]
Jerry Lineberry <jerryl@connecti.com> wrote:

>Hello,
>	Ok, I have a script that works fine. However, I feel that it could
>have been done better. For instance, at one point I have to use the shift
>command three times in a row. Can this be done with one command?

>@users = `$finger$list$domain`;
>shift @users;             # How can I remove the first three lines
>shift @users;             # without doing this?
>shift @users;

Assume that @users contains three elements. You can get those 3 in the
following way:

($0,$1,$3) = @users;


This is covered in "Learning Perl" and "Programming Perl" from ORA.

Peter




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

Date: 7 Jan 1998 09:23:11 GMT
From: "Mark Morgan" <mgm@gxn.net>
Subject: Re: Advanced Perl Programming book
Message-Id: <01bd1b4e$3ddd8a50$86507ec2@simont>

I found the book quite useful...it does go into many areas of interest for
me, such as PerltK, network programming, very good chapters on OOP, as well
as tie'ing scalars/arrays/hashes.  The section on closures, which
previously had me stumped was useful also.

Mark.

Thomas Charron <twolf@sampo.creighton.edu> wrote in article
<68tdgk$nmk3@biko.telecom.ups.com>...
> Definatly am enjoying it..
> 
> Allen Choy wrote in message <349848E6.E0D54461@us.oracle.com>...
> >Hi.
> >
> >Does anyone have any opinions, good and bad, re: the Advanced Perl
> >Programming book?
> >I'm considering purchasing it, but don't know much about it.
> >
> >Thanks!
> >
> >Allen
> >
> 
> 
> 


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

Date: Wed, 07 Jan 1998 16:44:08 -0730
From: "Chun-Hoh, KOH" <chunhoh@pc.jaring.my>
Subject: Anybody Wants A CGI/PERL Programmer?
Message-Id: <34B41A50.65DF96F1@pc.jaring.my>

Dear Sir/Madam,

I am a CGI/PERL programmer doing various projects for companies from
different countries. I have just completed the projects and is currently
looking for new ones.

I am experienced in PERL and have done many applications for the
Internet including guestbook, bulletin board, chat (licensed by various
sites), free home page secure accounts system, search engine, user
tracking utility etc..... I've also designed a few commercial sites
which consists of jobs application, resume / jobs ad management,
interactive classifieds, cyber pals, articles management, cyber cards
etc......

I am familiar with handling databases of both plain text and RDBMS
including experience with Msql, Mysql, Sybase SQL and Postgres.

If you are looking for a CGI/PERL programmer, please contact me asap at
chunhoh@pc.jaring.my

Cya & Thanx
Chun Hoh



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

Date: Wed, 07 Jan 1998 04:32:00 -0600
From: albuquer@ill.fr
To: albuquer@ill.fr
Subject: Date of the inclusion of CGI into the HTTP server?
Message-Id: <884168206.1220018189@dejanews.com>

Is anybody know the date of the inclusion of CGI script into the CERN and
the NCSA http servers?

Thanks ...
Albuquerque.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 7 Jan 1998 13:57:20 +0000
From: Jakob Fix <jakob@ermine.ox.ac.uk>
Subject: file glob restrictions?!
Message-Id: <Pine.OSF.3.95.980107135322.10991C-100000@ermine.ox.ac.uk>


I try this

@files = <*.sgm>;  

to read almost 2000 file names in this array, but it doesn't work.
However, if I do

@files = <a*.sgm>;

which are about 200 or so, it works.  Is there, after all, a size limit
in Perl, or is this just my ignorance and I am doing sth wrong?

CC to me appreciated. TIA,

Jakob.



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

Date: Wed, 07 Jan 1998 10:18:33 +0100
From: Bela Garzo <gand@vtsoft.hu>
Subject: how does hashes work in angle brackets ?
Message-Id: <34B34869.7F9D@vtsoft.hu>

Hi,

I still have problem with using stored filehandles in angle brackets.
This only happens when I try to store in a hash, arrays and scalars
works well. Could anybody help ? 

thanks,
     gand.

#!/usr/bin/perl -w
use FileHandle;
$fd{'in'} = new FileHandle "text";
while ( <$fd{'in'}> ) {
        print;
}


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

Date: 7 Jan 1998 11:46:58 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: how does hashes work in angle brackets ?
Message-Id: <68vpvi$8gr$1@lyra.csx.cam.ac.uk>

In article <34B34869.7F9D@vtsoft.hu>, Bela Garzo  <gand@vtsoft.hu> wrote:
>Hi,
>
>I still have problem with using stored filehandles in angle brackets.
>This only happens when I try to store in a hash, arrays and scalars
>works well. Could anybody help ? 

See my reply to your previous question on this subject.  Does that cover it?


Mike Guy


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

Date: Wed, 07 Jan 1998 15:54:39 +0100
From: Bela Garzo <gand@freemail.c3.hu>
Subject: Re: how does hashes work in angle brackets ?
Message-Id: <34B3972F.47C9@freemail.c3.hu>

Hi Mike,

yes I read it, but it doesn't cover that problem.
If I used scalars or arrays to store filehandles, everything ok.
I've stored fh in a hash ( old or new style doesn't differ ), and
used in <>, something goes wrong ( not syntactically )
Please try out the code. 

Thanks for your help
-------------->gand.


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

Date: Wed, 07 Jan 1998 15:25:19 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Lexical scope and embedded subroutines.
Message-Id: <6906nl$2c6$1@cyprus.atlantic.net>

According to mjtg@cus.cam.ac.uk (M.J.T. Guy):
>In almost all lexically scoped languages (i.e. those in the Algol60
>tradition), named subroutines are also lexically scoped.   So the scope
>of the subroutine is necessarily contained in the scope of any external
>variable referred to inside the subroutine.   So there's an obvious
>answer to the "which instance?" problem.
>
>But in Perl, named subroutines are globally scoped.

Yup, that's the fact.  A nested subroutine can be called from anywhere:

   sub foo {
      my $x = 'hello';
      sub bar { defined($x) }
   }
   foo();
   print bar() ? "Impossible\n" : "Necessary\n";

In the meantime, here's a workaround:

   sub foo {
      my $x = 'hello';
      *bar = sub { defined($x) };
   }
   foo();
   print bar() ? "Clever\n" : "Not a chance\n";

Note that a forward declaration of &bar ("use subs 'bar'") may be
useful in the latter case.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
** Perl Training from Stonehenge Consulting Services:  (503) 777-0095 **
 "I stopped that bus and I saved them kids!" "All except one -- the one
you let drive!" "He showed me his license..." "He was seven!!!" // MST3K


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

Date: Wed, 07 Jan 1998 15:26:10 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Lexical scope and embedded subroutines.
Message-Id: <6906p8$2cr$1@cyprus.atlantic.net>

According to mjtg@cus.cam.ac.uk (M.J.T. Guy):
>The consensus was that an incomplete solution was unacceptable, so
>the simple rule "Use the first instance" was adopted instead.

Not quite.  AFAIK, "first instance" was an accident of implementation.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
** Perl Training from Stonehenge Consulting Services:  (503) 777-0095 **
 "I stopped that bus and I saved them kids!" "All except one -- the one
you let drive!" "He showed me his license..." "He was seven!!!" // MST3K


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

Date: 7 Jan 1998 09:25:49 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Looking for way to download files to browsers using PERL
Message-Id: <69039d$2k3@panix.com>

In <34b2dc66.0@poobah.olywa.net> chigh@vallier.com (Cliff High) writes:

>There are several ways to get this to occur (like you thought that there was 
>only ONE way to do anything in perl). One method is to use the return value 
>from the CGI script to return URI which was an ftp point. THis will trigger 
>the desired response. Alternatively, the CGI could return some form of dynamic 
>html page in which was a URL which was the desired *.exe. And then there are 
>the new http terminology including the chunked encode function. It will depend 
>on the browser and which version(s) of http is being supported. 

>Have a look at hetmons treatment of the subject at:
>http://www.manning.com/Hetmon/311.html

>It is the best reference that I have found to this moving target. 

It appears to be a moving target itself:

   File Not Found

   The requested URL /Hetmon/311.html was not found on this server.

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 7 Jan 1998 11:55:16 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Looping through hashes
Message-Id: <68vqf4$8qt$1@lyra.csx.cam.ac.uk>

Andrew M. Langmead <aml@world.std.com> wrote:
>
>and of course, if you are going to add one element and then exit out
>of the loop, you might as well just add it and break out, the messing
>up of the iterator only happens on the next iteration.
>
>while(($key,$val) = each %myhash) {
>  if($somecondition) {
>    $myhash{parrot} = 'silly bird';
>    last;
>  }
>}

Beware.   That will leave the iterator for %myhash in a mess.   When
using each(), always make sure that you iterate to the end of the hash.
(Unless of course you don't plan to iterate over the hash ever again.)

For this reason, I avoid the use of each() except for the very simplest
of loops, or where the hash is so humungous that the alternatives are
impractical (e.g. tied databases).


Mike Guy


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

Date: Wed, 07 Jan 1998 08:45:44 -0500
From: Scott Vetter <svetter@ameritech.net>
Subject: Markees
Message-Id: <34B38708.5515@ameritech.net>

Is there a Perl program out there that will put out a markee to the
netscape/I.E. browser?  This markee would be shown on the browser line
that shows "Document: Done" in Netscape.


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

Date: Wed, 07 Jan 1998 13:16:00 +0100
From: Richard Locke <Richard.Locke@sni.nl>
Subject: Re: Newbie: Problem with file handling under WindozeNT and UNIX
Message-Id: <34B37200.608B@sni.nl>

Hi again,

I forgot to mention what the problem is. The problem occurs at this line

"         } elsif (($words{$somename} || "groucho") eq $someguess) {"

Under I run this under NT and use the name of 'fred' and enter the
correct secret word of 'camel', everything is fine. Under UNIX, when I
enter 'fred' and the secret word 'camel' I get the 'Wrong answer' string
and can only enter 'groucho' (which is the default secret word for names
other than richard, fred or barney) as the secret word.

Richard


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

Date: Wed, 7 Jan 1998 11:39:48 GMT
From: neilb@cre.canon.co.uk (Neil Bowers)
Subject: orange - script to send a message to an orange phone
Message-Id: <EMEwEC.B2y@cre.canon.co.uk>

Orange (the cell phone people) have a form on their web site which
lets you send a message to an Orange phone. You have to register
first to get a username and password.

I've hacked together a Perl script which talks to the form, so
you can send a message with:

	% orange -to andy -message "make some damn coffee!"

The script can be found at:

	http://www.cre.canon.co.uk/~neilb/orange/

I have nothing to do with Orange, just some colleagues who use
their service.

neilb
--
God is really another artist.  He invented the giraffe, the elephant and the
cat.  He has no real style.  He just goes on trying other things.
							-- Pablo Picasso


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

Date: Wed, 7 Jan 1998 15:39:17 GMT
From: neilb@cre.canon.co.uk (Neil Bowers)
Subject: Re: orange - script to send a message to an orange phone
Message-Id: <EMF7HH.L9s@cre.canon.co.uk>

In uk.telecom Neil Bowers <neilb@cre.canon.co.uk> wrote:
: I've hacked together a Perl script which [sends a message to an Orange phone]
: [...]
: The script can be found at:
: 	http://www.cre.canon.co.uk/~neilb/orange/

I have just put a new version (1.8) there. This has proper support for
proxies, lets you specify your email address (to go in the HTTP request
header), and has a pointer to the LWP distribution.

neilb
--
My definition of an expert in any field is a person who knows enough about
what's really going on to be scared.	-- P.J. Plauger


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

Date: Wed, 07 Jan 1998 08:43:27 -0500
From: Scott Vetter <svetter@ameritech.net>
Subject: Perl program transfer
Message-Id: <34B3867E.15F4@ameritech.net>

I transfer Perl programs between my OS/2 system and a UNIX system. 
>From OS/2 to UNIX the Perl program has a "^M" on the end of each line. 
And from UNIX to OS/2, lines run together.  Is there a Perl program out
there that will strip the "^M"'s at the end of each line and put it back
on the OS/2 system?


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

Date: 7 Jan 1998 10:32:50 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Perl program transfer
Message-Id: <690772$9c5@panix.com>

In <34B3867E.15F4@ameritech.net> Scott Vetter <svetter@ameritech.net> writes:

>I transfer Perl programs between my OS/2 system and a UNIX system. 
>From OS/2 to UNIX the Perl program has a "^M" on the end of each line. 
>And from UNIX to OS/2, lines run together.  Is there a Perl program out
>there that will strip the "^M"'s at the end of each line and put it back
>on the OS/2 system?

I went to Deja News and created a filter for newsgroup: comp.lang.perl.misc

Then I searched on: "end of each line"

This subject sure seems to come up on a regular basis in this newsgroup:

 1. 97/12/16 072 Re: CR/LF Text-File          comp.lang.perl.misc   Remove xx  
 2. 97/12/09 072 Re: Help with line substitut comp.lang.perl.misc   Frank     
 3. 97/12/11 070 A ^M question.               comp.lang.perl.misc   T. Jones
 4. 97/12/16 068 Re: CR/LF Text-File          comp.lang.perl.misc   Tad McClel
 5. 97/12/09 068 Help with line substitution  comp.lang.perl.misc   John Robson
 6. 97/12/03 068 Re: Perl editor needed       comp.lang.perl.misc   James Ludlo
 7. 97/12/16 067 Re: CR/LF Text-File          comp.lang.perl.misc   John Moreno
 8. 97/12/16 067 Re: CR/LF Text-File          comp.lang.perl.misc   Chip Salze
 9. 97/12/09 067 Re: Help with line substitut comp.lang.perl.misc   Tom Phoenix
10. 97/12/16 065 Re: Perl editor needed       comp.lang.perl.misc   J. Masters
11. 97/12/12 065 Re: A ^M question.           comp.lang.perl.misc   Gabor    
12. 97/12/16 064 Re: CR/LF Text-File          comp.lang.perl.misc   Tad McClel
13. 97/09/30 064 Re: chopping second to last  comp.lang.perl.misc   brian d foy
14. 97/09/30 064 Re: chopping second to last  comp.lang.perl.misc   Brandon S.
15. 97/12/11 063 Re: A ^M question.           comp.lang.perl.misc   Mark S. Rei
16. 97/12/09 063 Re: Help with line substitut comp.lang.perl.misc   James Ludl
17. 97/12/04 063 Re: Perl editor needed       comp.lang.perl.misc   Kent Schei
18. 97/12/03 063 Re: Perl editor needed       comp.lang.perl.misc   Henry Hart
19. 97/10/01 063 Re: chopping second to last  comp.lang.perl.misc   Doug Seay
20. 97/02/05 063 FTP Client                   comp.lang.perl.misc   A MAGIC S
21. 96/12/18 063 How to insert End of Line ch comp.lang.perl.misc   Brad Melen
22. 97/12/09 062 Re: Help with line substitut comp.lang.perl.misc   brian d foy
23. 97/09/23 062 Re: Need bulk Unix <-> PC fi comp.lang.perl.misc   Aaron    
24. 97/09/18 062 Re: Need bulk Unix <-> PC fi comp.lang.perl.misc   Greg Zevin
25. 97/07/12 062 help-print using labels give comp.lang.perl.misc   Clay Doxey

Followed by 60 more...


-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Wed, 07 Jan 1998 13:50:52 +0100
From: Joern Bodemann <bodemann@do.isst.fhg.de>
Subject: Precompiled binaries [DateCalc|DateManip] for WinNT
Message-Id: <34B37A2C.D0EC5853@do.isst.fhg.de>

I want to use DateCalc or DateManip, but I cannot install them
under WinNT 4 because I have no C compiler avaible.

Are precompiled .dll files or whatever is needed out there?

Thanks, Joern



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

Date: Wed, 07 Jan 1998 16:01:46 +0100
From: "Peter J. Acklam" <jacklam@ulrik.uio.no>
Subject: Re: printing quotes with print command
Message-Id: <34B398DA.167E@ulrik.uio.no>

Glen Bell wrote:
> 
> I am trying to do this
>
> print NEWFILE "  <body bgcolor="#FFFFFF" background="../backgrounds/ruff.jpg">";

print NEWFILE "  <body bgcolor='#FFFFFF'
background='../backgrounds/ruff.jpg'>";

IMHO it is simpler than both backslashing the double
quotes and using generalized quotes.

Peter


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

Date: Wed, 07 Jan 1998 15:18:17 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: printing quotes with print command
Message-Id: <6906bn$pl1$1@nntp1.ba.best.com>

In article <34B398DA.167E@ulrik.uio.no>, "Peter J. Acklam" <jacklam@ulrik.uio.no> wrote:
>Glen Bell wrote:
>> 
>> I am trying to do this
>>
>> print NEWFILE "  <body bgcolor="#FFFFFF"
> background="../backgrounds/ruff.jpg">";
>
>print NEWFILE "  <body bgcolor='#FFFFFF'
>background='../backgrounds/ruff.jpg'>";

Not really on-topic here but:

1. Using single quotes in tags is not in compliance with
   the HTML specs and:

2. Simply doesn't work with all browsers (e.g. Netscape 1.2).

Try:

print NEWFILE qq~<body bgcolor="#FFFFFF"> 
background="../backgrounds/ruff.jpg">~;

-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar           "The more I practice, the luckier I get". |
| malch@malch.com                                     Gary Player. |
| http://www.malch.com/               Shpx gur PQN.                |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: 7 Jan 1998 14:36:56 GMT
From: "Bjxrn Elstad" <bjorn.elstad@sds.no>
Subject: Re: Processnumber $$ on NT
Message-Id: <01bd1b79$af633870$3840698b@belpcnt>

Problem with using process number to generate temporary files on NT.

Keith Willis <keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com> wrote

> Use IO::File::new_tmpfile() instead.

In my case, it cannot be used. I need a file name for a
report file for a "spawned program". The output of the file 
shall afterwards be treated by the perl script. 


A possible solution is to use Win32::GetTickCount. 
It shall have fine resolution. (milliseconds ..?) 

$tm = Win32::GetTickCount;
$fn = 'c:\temp\R';
$fn .= $tm;

open (LU, ">$fn") or .....

Any better solutions?

- bjxrn





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

Date: Wed, 07 Jan 1998 15:40:09 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: Processnumber $$ on NT
Message-Id: <34b4a0c8.1395879999@readnews.bbn.hp.com>

On 7 Jan 1998 14:36:56 GMT, "Bjxrn Elstad" <bjorn.elstad@sds.no>
wrote:

>Problem with using process number to generate temporary files on NT.
>
>Keith Willis <keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com> wrote
>
>> Use IO::File::new_tmpfile() instead.
>
>In my case, it cannot be used. I need a file name for a
>report file for a "spawned program". The output of the file 
>shall afterwards be treated by the perl script. 
>...
>Any better solutions?

OK, try this (I am assuming that the POSIX module is implemented for
Perl on Win-32):

use POSIX;

$fn = 'c:\temp\' . POSIX::tmpnam();
open (LU, ">$fn");

I still don't entirely understand why this is any different from my
last suggestion...
----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: Wed, 07 Jan 1998 13:34:43 +0100
From: tobez@plab.ku.dk
Subject: Re: Q: search matching "(" and ")"
Message-Id: <34B37663.F53@plab.ku.dk>

Ilya Zakharevich wrote:

> > : Q: How can I  easily find  the matching parir for "(" and ")" for A1?
> >
> > You can't do it 'easily' (at least accordning to my own 'easiness'
> > metric).  Just to save you some pointless hacking, you can't do it for
> > arbitrary levels of nesting using regexes
> 
> Yes you can with the latest RE engine, one of the tests in t/op/pat.t
> is doing exactly this.  But this is still not "easily" - though very
> quick.  To make it "easy" several other changes to RE engine should
> materialize first.

8-O
t/op/pat.t from which version of Perl?
And which particular test?  I could not find it in my copy
from 5.004_04...

Anton.


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

Date: Wed, 07 Jan 1998 13:06:15 GMT
From: !pbuckley@tiac.net (Phil Buckley)
Subject: Re: Querying info from other server
Message-Id: <34b37d9d.6662398@News.Varian.COM>

Thanks for the help, but I'm just a newbie. Can you offer a little
more info?

Phil

On Wed, 07 Jan 1998 00:51:52 GMT, jkugler@inreach.com (Joshua J.
Kugler) wrote:

>On Tue, 06 Jan 1998 16:44:03 GMT, !pbuckley@tiac.net (Phil Buckley)
>wrote:
>
>()How would I go about querying stock prices from Yahoo or another
>()similar repository of stock info?
>
>Look in CPAN for the libwww or LWP modules and retrieve them via HTTP.
>
>()remove the "!" before replying via e-mail
>
>Remove the "!" before posting.
>
>j----- k-----
>
>I read this group. Sometimes my ISP doesn't. Please e-mail too.
>
>Joshua J. Kugler
>Computer Consultant--Web Developer
>jkugler@inreach.com
>http://www.cwebpages.com/jkugler
>Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
>

Phil Buckley
pbuckley@tiac.net
http://www.greatwebdesign.com/

remove the "!" before replying via e-mail


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

Date: 7 Jan 1998 10:24:54 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Querying info from other server
Message-Id: <6906o6$8mb@panix.com>

In <34b37d9d.6662398@News.Varian.COM> !pbuckley@tiac.net (Phil Buckley) writes:

>>()How would I go about querying stock prices from Yahoo or another
>>()similar repository of stock info?

>Thanks for the help, but I'm just a newbie. Can you offer a little
>more info?

See: 

  libwww-perl
  http://www.linpro.no/lwp/

>From lwpcook - libwww-perl cookbook:

  It is very easy to use this library to just fetch documents from the
  net.  The LWP::Simple module provides the get() function that return
  the document specified by its URL argument:

    use LWP::Simple;
    $doc = get 'http://www.sn.no/libwww-perl/';

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: 7 Jan 1998 12:42:31 GMT
From: as646@FreeNet.Carleton.CA (John Robson)
Subject: Running Perl off a portable drive?
Message-Id: <68vt7n$9b6@freenet-news.carleton.ca>


Has anyone ran or tried to run Perl (for DOS or Windows) right off a
portable drive ??

I have an Avatar Shark 250 portable drive which can pack 250 megs in one
cartridge.  (By the way, the Avatar Shark is quite fast, small, fits in my
palm and very portable!...come to think of it, it's like Perl!).  I was
able to run various applications off it without too much fuss where speed
was not absolutely critical.

This may be difficult to do with Perl (and other major software for that
matter) since Perl's installation process adds something to the registry
and maybe install files to the Windows directory(?).  But I don't know
precisely what and where, so I couldn't tweak the Perl on my portable
drive, or manually copy those files to the Shark.
I just want to install the minimum core of Perl, not necessarily all the
libraries or modules, documentation or whatever.  Just the bare minimum.

If anyone has been able to INSTALL Perl, tweak, hack and run Perl off a
portable drive, please let me know!  (even if it is for DOS, I would think
it would be easy to do for DOS).  Any suggestions or other info are very much
appreciated.  Thanks!



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

Date: Wed, 07 Jan 1998 08:15:39 -0600
From: Graham Barr <gbarr@ti.com>
Subject: Re: sending email (Net::SMTP).. problem
Message-Id: <34B38E0B.A3BBFBFC@ti.com>

Eli the Bearded wrote:
> I've been having thoughts of replacing sendmail on my box with a perl
> smtpd. Near as I can tell none of your code in Net:: or Mail:: adds a
> Received header, you seem to be counting on some non-perl code to do
> that. So if I want to remove sendmail from the loop on my system, I
> either have to rewrite your code for sending mail, or expect you to
> ignore my mail. Probably it is just rather skeletal code that just
> needs a header processing package between the perl script equivilent
> of "sendmail -oi -t" and Net::SMTP, but it still seems wrong.

Well you can rewrite it if you wish, that is up to you,
but why should any of these modules add Received lines ??

Net::SMTP implements the SMTP protocol, the header lines are not
part of the protocol itself, although they are part of the
standard for sending mail.

Mail::* are libraries for processing Mail in all kinds of ways,
so why should they add the received lines ??

A sendmail replacement can be written quite easily using these
libraries, but they will not do it all for you. You will need
to write a bit of "glue" code. That is generally the way to use
libraries.

You are obviously trying so hard to flame people you are not thinking
straight.

-- 
Originality is the ability to conceal your source.


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

Date: Wed, 07 Jan 1998 15:19:07 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: serious post about gmtime and year-1900 (was Re: Perl not Y2K compliant)
Message-Id: <6906c0$2b0$1@cyprus.atlantic.net>

According to Russell Schulz <Russell_Schulz@locutus.ofB.ORG>:
>it does all depend on the underlying C runtime supplying the correct
>number -- and we all know there are no errors in the C runtime, right?

Well, the C runtime is an issue with your C compiler vendor, not
Perl's maintainers.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
** Perl Training from Stonehenge Consulting Services:  (503) 777-0095 **
 "I stopped that bus and I saved them kids!" "All except one -- the one
you let drive!" "He showed me his license..." "He was seven!!!" // MST3K


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

Date: 7 Jan 1998 09:05:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Sinking STDOUT and STDERR
Message-Id: <68vghn$3l1$1@lyra.csx.cam.ac.uk>

Joseph N. Hall <joseph@5sigma.com> wrote:
>Selecting (with the select operator) a filehandle and then setting
>$| to a non-zero value puts that filehandle in AUTOFLUSH mode.  Each
>time Perl writes to that filehandle it flushes it.
>
>There is no precise equivalent to flush in Perl.

What about IO::Handle->flush?

And in modern Perls (can't remember if this came in before or after 5.004)
this sequence will flush FH:

my $oldselect = select FH;
my $oldflush = $|;
$| = 1;
$| = $oldflush;
select $oldselect;


Mike Guy


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

Date: 7 Jan 1998 09:03:15 GMT
From: ddurand@hpplus05.cern.ch (Jean-Damien Durand)
To: joseph@5sigma.com
Subject: Re: Sinking STDOUT and STDERR
Message-Id: <68vgcj$nki$1@sunnews.cern.ch>


  The IO::Handle module's autoflush can also be useful.

  Cheers,                        Jean-Damien.


> Selecting (with the select operator) a filehandle and then setting
> $| to a non-zero value puts that filehandle in AUTOFLUSH mode.  Each
> time Perl writes to that filehandle it flushes it.
> 
> There is no precise equivalent to flush in Perl.
> 
> 	-joseph
> 	 http://www.effectiveperl.com
> 
> Mark Hattarki wrote:
>  In c++,
> > 
> > there is a flush command that you can send to a file class, is there
> > 
> > something similar for perl?
--
       *******************************************************
       *   Jean-Damien Durand (Jean-Damien.Durand@cern.ch)   *
       *        www : http://wwwinfo.cern.ch/~ddurand/       *
       *******************************************************


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

Date: Wed, 07 Jan 1998 14:04:31 -0800
From: Boschini Matteo <boschini@mail.cilea.it>
Subject: socket help needed...
Message-Id: <34B3FBEF.3915@mail.cilea.it>

Hi everybody, 
I'm a newbie in socket stuff, so I decided I'd try the Camel book
examples (2n Ed.).
Everythink ok (+/-) with tcp sockets, but I keep getting errors on unix 
sockets. 
Error is 

Value of <HANDLE> construct can be "0"; test with defined() at
unix_client.pl line 24.
connect error: No such file or directory 

can someone of you gurus help me ?

already thanking you, 

Matteo Boschini


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

Date: 7 Jan 1998 13:52:12 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: socket help needed...
Message-Id: <6901ac$cam$1@lyra.csx.cam.ac.uk>

Boschini Matteo  <boschini@mail.cilea.it> wrote:
>Error is 
>
>Value of <HANDLE> construct can be "0"; test with defined() at
>unix_client.pl line 24.
>connect error: No such file or directory 
>
>can someone of you gurus help me ?

perldiag can help you.   perldiag is your friend.

(And if you put "use diagnostics;" at the top of your script, it'll even
help you automatically.)

"perldoc perldiag" and searching for that message, I find

     Value of %s can be "0"; test with defined()
         (W) In a conditional expression, you used <HANDLE>, <*>
         (glob), each(), or readdir() as a boolean value.  Each
         of these constructs can return a value of "0"; that
         would make the conditional expression false, which is
         probably not what you intended.  When using these
         constructs in conditional expressions, test their values
         with the defined operator.


Mike Guy


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

Date: Wed, 07 Jan 1998 14:27:22 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: socket help needed...
Message-Id: <34b38f7b.1391451331@readnews.bbn.hp.com>

On Wed, 07 Jan 1998 14:04:31 -0800, Boschini Matteo
<boschini@mail.cilea.it> wrote:

>Everythink ok (+/-) with tcp sockets, but I keep getting errors on unix 
>sockets. 
>Error is 
>
>Value of <HANDLE> construct can be "0"; test with defined() at
>unix_client.pl line 24.
>connect error: No such file or directory 

To quote ('cause I can't be bothered to do all that retyping) from
Clay Irving <clay@panix.com> who responded to a very similar question
recently....

-------------------------------8<-----------------------------------
Read about 'defined' in your pod or at:

http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc/defined.html

Basically:

Many operations return undef to indicate failure, end of file, system
error, uninitialized variable, and other exceptional conditions. This
function allows you to distinguish undef from other values. (A simple
Boolean test will not distinguish among undef, zero, the empty string,
and ``0'', which are all equally false.)
-------------------------------8<-----------------------------------

----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: 7 Jan 1998 15:12:26 GMT
From: smellymama@aol.com (Smellymama)
Subject: TEST IF A VALUE EXISTS IN AN ARRAY
Message-Id: <19980107151201.KAA13309@ladder02.news.aol.com>

Need to to test user input to determine if it exists in a prdefined array

thanks in advance


tcasulli@microsNYC.com
smellymama@aol.com or
Thanks and Have A Pleasant Tomorrow
smellymama@aol.com


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

Date: Wed, 07 Jan 1998 15:54:30 -0800
From: canugi Yorugua <canugi@hotmail.com>
Subject: Trimming blanks
Message-Id: <34B415B6.4124@hotmail.com>

I used to "trim" strings (get rid of surrounding blanks) by using

$str =~ s/^\s*(.*?)\s*$/$1/;   # Get rid of surrounding blanks

in our Sequent box.
Now we have ported to a HP box and the @#!?&#&!! is not working properly 
anymore. It trims *only* blanks preceding the string but not those after 
the after.

WHY!

thanx


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

Date: Wed, 07 Jan 1998 16:20:11 +0800
From: peter@stairways.com.au (Peter N Lewis)
Subject: Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP!
Message-Id: <peter-ya02408000R0701981620110001@news.iinet.net.au>

In article <sean-0601981701050001@p5.ts1.white.ny.tiac.com>, sean@dcdX.net
(Sean O'Dwyer) wrote:

>I need to be able to set executability of scripts in my cgi-bin, using
>commands like chmod, but I can't do that using Anarchie or Fetch (that I
>know of).
>
>Is there a way to do this from my Mac?

You can ask Anarchie to change the permissions using a raw FTP command. 
Changing permissions is not a standard FTP protocol command, so you'll have
to figure out what command to send on a site by site basis.  Perl code to
ask Anarchie to send a raw command is:

sub sendcommand {
  local($basesite,$command) = @_;

&MacPerl'DoAppleScript(<<"END_SCRIPT");
tell application "Anarchie"
  set c to 0
  set err to -1
  repeat until err is 0 or c > 10
    if c is not 0 then
      close
    end if
    set c to c + 1
    with timeout of 600 seconds
      set err to sendcommand url "$basesite$command"
    end timeout
  end repeat
end tell
END_SCRIPT
}

And to ask NetPresenz to change permissions, you would do something like:

sub NetPresenzChangePerm {
  local($path) = @_;
  local( $basesite, $basepath );

  ($basesite, $basepath) = &splitsite( $url );
  &sendcommand( $basesite, "site c p rwxr-xr-x $basepath$path" );
}

Enjoy,
   Peter.
-- 
Web: <http://www.stairways.com/stairways/>
FTP: <ftp://mirrors.aol.com/pub/peterlewis/>
Email: <mailto:peter@stairways.com.au>


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

Date: Wed, 07 Jan 1998 09:31:56 -0500
From: sean@dcdX.net (Sean O'Dwyer)
Subject: Re: UNIX commands via FTP on a MACINTOSH -- HAY-ELP!
Message-Id: <sean-0701980931560001@p11.ts6.newyo.ny.tiac.com>

In article <peter-ya02408000R0701981620110001@news.iinet.net.au>,
peter@stairways.com.au (Peter N Lewis) wrote:

>You can ask Anarchie to change the permissions using a raw FTP command. 
>Changing permissions is not a standard FTP protocol command, so you'll have
>to figure out what command to send on a site by site basis.  Perl code to
>ask Anarchie to send a raw command is:
>
>sub sendcommand {
>  local($basesite,$command) = @_;
>
>&MacPerl'DoAppleScript(<<"END_SCRIPT");
>tell application "Anarchie"
>  set c to 0
>  set err to -1
>  repeat until err is 0 or c > 10
>    if c is not 0 then
>      close
>    end if
>    set c to c + 1
>    with timeout of 600 seconds
>      set err to sendcommand url "$basesite$command"
>    end timeout
>  end repeat
>end tell
>END_SCRIPT
>}

Holey, moley, complicated for me. But thanks! I'm not an AppleScript head,
so maybe I should get myself a shell account?

Sean

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
DIGITAL COOKIE DESIGN: graphic design for web and print
http://www.dcd.net/





(remove x to reply via email)


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

Date: Wed, 7 Jan 1998 10:19:08 -0500
From: "Robert Jenks" <eat@joes.nospam.deli>
Subject: Unix perl shell ???
Message-Id: <69069p$klu$1@winter.news.erols.com>

Anyone written or writing a UNIX perl shell?

Robert Jenks
rjenks@animefest.com
http://www.animefest.com




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

Date: Wed, 07 Jan 1998 08:05:54 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: unlink return value
Message-Id: <34B38BC2.9A685125@houston.Geco-Prakla.slb.com>

I'm a bit confused.  If I understand things correctly, I would expect
that this statement (assuming all variables are assigned--they are)

unlink ("$::logFile") or 
	&interrupt("Error on $::systemName","Cannot remove
file","$::logFile","$!");

should unlink the file specified in $::logFile.  If that returns 0, the
subroutine interrupt should be called.  The interrupt subroutine either
emails an error (non-interactive mode) or prints to STDERR in
interactive mode.

What I'm seeing is that the job appears to be completing normally, AND
is issuing the following error message through email:

Cannot remove file
/opt/workSpaceCheck/logs/error_log
No such file or directory

An ls -al shows:
es10a:barnett [22] l /opt/workSpaceCheck/logs/error_log
-rw-r--r--   1 root     other       7568 Jan  7 02:00
/opt/workSpaceCheck/logs/error_log


This file does exist.  The script is run from cron, as root.  I'm left
with a few questions.

1.  What is the return value of unlink on success?  On Failure?
2.  Is there a special variable that returns the error number given by
the system (rather than the verbose wording)?
3.  Does unlink have to be checked like a system call:  system(command)
== 0 or die?

Help greatly appreciated.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Wed, 07 Jan 1998 15:44:12 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: unlink return value
Message-Id: <34b5a25b.1396283379@readnews.bbn.hp.com>

On Wed, 07 Jan 1998 08:05:54 -0600, Dave Barnett
<barnett@houston.Geco-Prakla.slb.com> wrote:

>unlink ("$::logFile") or 
>	&interrupt("Error on $::systemName","Cannot remove
>file","$::logFile","$!");
>
>should unlink the file specified in $::logFile.  If that returns 0, the
>subroutine interrupt should be called.  The interrupt subroutine either
>emails an error (non-interactive mode) or prints to STDERR in
>interactive mode.

>1.  What is the return value of unlink on success?  On Failure?

Had you simply done 'man unlink' you would realize the answer.

 RETURN VALUE
      unlink() returns the following values:

            0   Successful completion.
           -1   Failure.  errno is set to indicate the error.

For Grud's sake, doesn't anyone read a man page these days?
----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1594
**************************************

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