[8215] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1833 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 8 19:07:30 1998

Date: Sun, 8 Feb 98 16:00:24 -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           Sun, 8 Feb 1998     Volume: 8 Number: 1833

Today's topics:
        Being Nice 2 Nice Beings [Was: Reading The FAQ's etc.:  <dgoddard@us.oracle.com>
    Re: Debuggin Tips for beginners (w/o shell) (Andy Lester)
        foreach and my() <rjk@coos.dartmouth.edu>
    Re: Good perl editor? (Pedro Branco)
        Help with simple file search, please. email@business-links.co.uk
    Re: Help with simple file search, please. (Craig Berry)
    Re: Help with simple file search, please. (Martin Vorlaender)
        Help: Problems with new modules <dale@dcwebdesign.com>
    Re: Inverse of a regex <rootbeer@teleport.com>
    Re: Is Perl 5 year 2000 compliant? <rootbeer@teleport.com>
        Killing Child Processes <kennedym@spectranet.ca>
        New Perl book reviews (Andy Lester)
    Re: Perl Question (Martien Verbruggen)
    Re: Quickie: regexp for valid e-mail addresses <rootbeer@teleport.com>
    Re: Quickie: regexp for valid e-mail addresses <rootbeer@teleport.com>
    Re: Quickie: regexp for valid e-mail addresses (Craig Berry)
        regular expressions (Mike Binkley)
    Re: Sending EOF to an opened pty <fglenn@notforspam.dnai.com>
    Re: solution for multiline comments??? <rjk@coos.dartmouth.edu>
    Re: Syntax-coloring editor for NT (Andy Lester)
    Re: Using flock? <rootbeer@teleport.com>
    Re: White Hats and Black (Martien Verbruggen)
    Re: Year 2000 Compliance: Lawyers, Liars, and Perl <wblynch@worldnet.att.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 08 Feb 1998 14:38:07 -0800
From: Denis Goddard <dgoddard@us.oracle.com>
Subject: Being Nice 2 Nice Beings [Was: Reading The FAQ's etc.: a teacher's perspective...]
Message-Id: <34DE33CF.832D0A92@us.oracle.com>

This individual raises some points that I agree with and would like to address.
Bear with me or delete me, at your discretion...   :)

[courtesy copy forwarded to the original author]
Lynchqvctc wrote:

> (heck! I'm an anthropologist, not a computer programmer!).

Good point #1.
One reason that Perl is a great language is that a non-programmer can become
effective very rapidly.

Even though Micro$oft would love you to believe that Visual basic is easier and
better, we know it
just ain't so. Keep in mind, please, that the number of users of Perl positively
correlates to the
long-term pervasiveness of Perl that Larry, Tom, and so many others have worked so
hard to foster.

Imagine if you had to be able to rebuild the carburetor in order to drive a Ford,
but a Honda you
could just press the gas pedal and go. Which will you end up driving, do ya
think....?
Oh, and don't forget Bucky Fuller: "Overspecialization leads to species
extinction".

> "Didn't you read the manpages?" or "Hey..that's a
> CGI question, not a perl question"... when someone posts a request for help,

Good point #2.
If you're annoyed that somewone asked a question too simple for Your Wizardship to

answer, please be kind enough to simply not answer, okay?

Maybe there are people just a little more experienced than the poster who would
like to actually
provide a clear, detailed, easy-to-digest response. When a Wizard says, "RTFM, you
moron",
not only the original poster, but also these would-be helpful replies are
discouraged.
And this is true not just at the newbie level, but at many stages of Perl
Understanding.

> Keep it light...  this perl stuff is great, and so are the folks who work/play
> so hard to keep it that way...

 Amen, brother!

-Denis




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

Date: 8 Feb 1998 21:50:46 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Debuggin Tips for beginners (w/o shell)
Message-Id: <6bl9bm$g9t$2@usenet88.supernews.com>

: privacy of your own home, before loading it onto the server.  You can
: put up a current copy of CGI.pm, and even compare it to that on your
: ISP's box...and urge the ISP to upgrade if necessary.

Better still, keep your own copy of CGI.pm in the source directory, and
force your program to include that one, not the one in the path.  No point
in letting your ISP be your source code control.

xoxo,
Andy



--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: Sun, 08 Feb 1998 18:43:36 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: foreach and my()
Message-Id: <34DE432A.C08C107D@coos.dartmouth.edu>

I'm a little confused by these two bits of code:

~> perl
$a = 0;
foreach $a (1..3) {
  print "$a\n";
  &foo();
}
sub foo {
  print "$a\n";
}
__END__
1
1
2
2
3
3
~> perl
my($a) = 0;
foreach $a (1..3) {
  print "$a\n";
  &foo();
}
sub foo {
  print "$a\n";
}
__END__
1
0
2
3
0


Even though $a has been declared with my() in the second example, it
should still be lexically scoped to the package level.  I don't understand
why it becomes lexically scoped to the foreach loop.

The perlsyn manpage reads:
  The foreach loop iterates over a normal list value and sets the variable VAR
  to be each element of the list in turn. If the variable is preceded with the
  keyword my, then it is lexically scoped, and is therefore visible only within
  the loop. Otherwise, the variable is implicitly local to the loop and regains
  its former value upon exiting the loop. If the variable was previously declared
  with my, it uses that variable instead of the global one, but it's still
  localized to the loop. (Note that a lexically scoped variable can cause
  problems with you have subroutine or format declarations.) 

Which seems to imply that the values should still be visible outside the foreach
loop.  It says the variable is *localized* to the loop, i.e. the original value
will be restored when the loop exits, not that the variable is lexically scoped
to the loop, with the value only being visible inside the loop.

So, what's going on here?

Chipmunk


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

Date: Sun, 08 Feb 1998 19:55:11 GMT
From: f.branco@mail.telepac.pt (Pedro Branco)
Subject: Re: Good perl editor?
Message-Id: <34df0cd4.660386@news>

On Sat, 7 Feb 1998 14:02:21 -0800, "Don O'Neil" <don@whtech.com>
wrote:

>Does anyone know of a good windows or unix (X-Windows) based perl editor w/
>context sensitive coloring, auto indent, etc...??? I've tried Win Edit, but
>it does not have built in Perl syntax, I could add it, but that's a pain.
>I'm looking for something along the order of the editors that come w/ MS C
>and Borland C.
>
>Thanks!!
>
>


I use XWPE

xwpe is a X-window programming environment designed  to  use
     on UNIX-systems. It is similar to 'Borland C++ or Turbo Pas-
     cal' environment.

xwpe has syntax highlighting, and you can easly set it up for perl.

I don't remember the url, search 'xwpe' over the net and 
you'll find it.

I've already built a full perl sintax highlighting for it
if you decide to use it, I will send it to you or anybody else
interested.

happy coding

	Pedro Branco
____________________________________________________________________
Pedro Feliciano Branco                        ISEL . AE -Portugal-
Email: pedrofb@aeisel.aeisel.pt               
       f.branco@mail.telepac.pt
http://www.aeisel.pt/~pedrofb


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

Date: Sun, 08 Feb 1998 18:34:05 GMT
From: email@business-links.co.uk
Subject: Help with simple file search, please.
Message-Id: <34ddf6af.20769037@news.skynet.co.uk>

Hello again,

Can I start by saying thanks to all those who tried to help me with
this problem before - Thanks. But I'm still having a few problems.

Here's what I want to do:

I've got a file with is tab delimited (example below), I'd like
visitors to be able to search this file via a simple form. They enter
a string eg. AA and a URL is displayed (see text file).


 Here is the Perl subroutine I've got so far: the problem is that only
the last matched search string is displayed eg. AA on line 4.

Can you help! (Perl 4 or Perl5 with on modules, please).

Thanks in advance :)


SUBROUNTINE
sub open_file 
{
-e "file1.txt" || &error_message ("Search option off line for
upgrades");

open (datafile, "file1.txt");
$form_data{'search'} =~ tr/a-z/A-Z/;
$find = $form_data{'search'};
$matched =0;

while ($line = <datafile>)

($a,$b,$c,$d,$link) = split("\t",$line);
if ($a eq $find)	{@url=$link;}
if ($b eq $find)	{@url=$link;}
if ($c eq $find)	{@url=$link;}
if ($d eq $find)	{@url=$link;}
}

if (@url)	{	$matched=1;}
else	{	close (datafile); &error_message ("No match found. Please try
again");}

	print "Content-type: text/html", "\n\n";
	print "<html><head><title>Message.</title></head><BODY>";
	print "Searching for: <B>",$find,"</B><BR>";
	foreach $found (@url)
	{
	print "Found1: ",$link,"<BR>";
	print "Found2: ",$found,"<BR>";

	}
	print "</body></html>";
	close (datafile);
}



TEXT FILE EXAMPLE
AA		BB		CC		DD	http://www.website1.com
EE		FF		GG		HH		http://www.website2.com
II		AA		PP		QQ		http://www.website3.com
YY		XX		AA		ZZ		http://www.website4.com


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

Date: 8 Feb 1998 20:08:32 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help with simple file search, please.
Message-Id: <6bl3c0$irt$1@marina.cinenet.net>

email@business-links.co.uk wrote:
: I've got a file with is tab delimited (example below), I'd like
: visitors to be able to search this file via a simple form. They enter
: a string eg. AA and a URL is displayed (see text file).
: 
:  Here is the Perl subroutine I've got so far: the problem is that only
: the last matched search string is displayed eg. AA on line 4.

[most code snipped, other than places where I have comments]

: -e "file1.txt" || &error_message ("Search option off line for
: upgrades");
: 
: open (datafile, "file1.txt");

By convention, file handles are all uppercase; like most conventions, this
is arbitrary but useful when others try to read your code.  Also, why not
just combine these as

  open DATAFILE, 'file1.txt' or error_message("...");

: $form_data{'search'} =~ tr/a-z/A-Z/;
: $find = $form_data{'search'};

Rather than modifying the form data in place, why not just do it in the
copy you're going to search on, like this? 

  ($find = $form_data{search}) =~ tr/a-z/A-Z/;

Or, even better:

  $find = uc $form_data{search};

which will respect locale information about what constitutes an uppercase 
letter, and is also easier to understand.

: $matched =0;
: 
: while ($line = <datafile>)

You're missing a { here.  I strongly suggest that you copy and paste 
source examples you post directly from your actual source to avoid this 
kind of problem.  Also,

  while (defined($line = <DATAFILE>))

is a safer eof test.

: ($a,$b,$c,$d,$link) = split("\t",$line);

I'd suggest using the more standard /\t/ form for the pattern.

: if ($a eq $find)	{@url=$link;}
[and several more like this]

Look what you're doing, here...assigning a scalar to a list.  What that 
does is set @url to a one-element list containing the scalar $link -- 
*wiping out* @url's previous contents!  That's why you always get either 
zero matches, or the last match.  You probably really want:

  if ($a eq $find) { push @url, $link; }

Hope this helps!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sun, 08 Feb 1998 20:29:49 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Help with simple file search, please.
Message-Id: <34de07ad.524144494f47414741@radiogaga.harz.de>

email@business-links.co.uk wrote:
: if ($a eq $find)	{@url=$link;}
: if ($b eq $find)	{@url=$link;}
: if ($c eq $find)	{@url=$link;}
: if ($d eq $find)	{@url=$link;}

No wonder that only the last match is reported... You're _overwriting_
@url on each match. Look up the push() function in the perlfunc POD.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Sun, 08 Feb 1998 20:06:13 +0000
From: Dale Churchett <dale@dcwebdesign.com>
Subject: Help: Problems with new modules
Message-Id: <34DE1035.AFD41E1B@dcwebdesign.com>

I am trying to add some new modules for Perl5.004 running on a RedHat
5.0 linux machine, but always get the following error at the 'make'
stage. If anyone can take a look at the output and suggest what's wrong,
I'd greatly appreciate it.

Many thanks,
	Dale

<----begin screen output from 'make' command after 'perl
Makefile.PL'---->


# make
cc -c  -Dbool=char -DHAS_BOOL -O2    -DVERSION=\"1.7\"
-DXS_VERSION=\"1.7\" -fpic -I/usr/lib/perl5/i386-linux/5.00401/CORE
-DPERL_BYTEORDER=1234 MD5.c
In file included from /usr/include/sys/param.h:25,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:223,
                 from MD5.xs:20:
/usr/include/linux/param.h:4: asm/param.h: No such file or directory
In file included from /usr/include/sys/socket.h:34,
                 from /usr/include/netinet/in.h:24,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:361,
                 from MD5.xs:20:
/usr/include/socketbits.h:218: asm/socket.h: No such file or directory
In file included from /usr/include/errnos.h:24,
                 from /usr/include/errno.h:36,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:414,
                 from MD5.xs:20:
/usr/include/linux/errno.h:4: asm/errno.h: No such file or directory
In file included from /usr/include/sys/ioctl.h:27,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:459,
                 from MD5.xs:20:
/usr/include/ioctls.h:23: asm/ioctls.h: No such file or directory
In file included from /usr/include/ioctls.h:24,
                 from /usr/include/sys/ioctl.h:27,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:459,
                 from MD5.xs:20:
/usr/include/linux/sockios.h:21: asm/sockios.h: No such file or
directory
In file included from /usr/include/sys/ioctl.h:30,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:459,
                 from MD5.xs:20:
/usr/include/ioctl-types.h:24: asm/ioctls.h: No such file or directory
In file included from /usr/include/signal.h:267,
                 from
/usr/lib/perl5/i386-linux/5.00401/CORE/unixish.h:85,
                 from /usr/lib/perl5/i386-linux/5.00401/CORE/perl.h:911,
                 from MD5.xs:20:


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

Date: Sun, 8 Feb 1998 12:43:08 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Genovese <mikeg@slpma8.ed.ray.com>
Subject: Re: Inverse of a regex
Message-Id: <Pine.GSO.3.96.980208124218.15943S-100000@user2.teleport.com>

On Wed, 4 Feb 1998, Michael Genovese wrote:

> $line =~ s/.*(\<.*?\>).*/$1/g;

Or you could wirte to my friends at the address below. For some reason,
that code displeases them. :-)

    "Fred>&<Barney" <"fred>&<barney"@redcat.com>

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 8 Feb 1998 13:12:29 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tiberius <Abraxas@hell.com>
Subject: Re: Is Perl 5 year 2000 compliant?
Message-Id: <Pine.GSO.3.96.980208131148.15943X-100000@user2.teleport.com>

On Thu, 5 Feb 1998, Tiberius wrote:

> > RTFM...
> 
> Why do perl-ers so often insist on posting this worthless response,

Because it's not worthless. When the answer is in TFM, it's right to say
RTFM.

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 8 Feb 1998 19:46:03 GMT
From: "Michael Kennedy" <kennedym@spectranet.ca>
Subject: Killing Child Processes
Message-Id: <01bd34c9$e41823a0$0101010a@kennedym>

Question:

I have a PERL script that starts a child process (tail command) in order to
retrieve some data, now this script runs continuously and is re-run every
night at midnight (so it can re-run the tail on the new log to capture the
data I need.) ... sooo.  How do I kill the child process of the previously
run script ?

Source follows:

#!/usr/bin/perl

# let's kill the last instance... if there was one.
open(PID,"</logs/program.pid");
while(<PID>) {
  system('kill -TERM '.$_);
}
close(PID);
#let's write our own death-certificate..
open(PID,">/logs/program.pid");
print PID "$$\n";
close(PID);

open(DATA,"tail -f logfile |");
while (<DATA>) {
-- do stuff --
}

^^^^^^^
this make a subprocess of "tail" that never ends, because of the -f.
it's supposed to do this, but the "tail" does not get killed when we
kill the process that started it.

Any ideas?


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

Date: 8 Feb 1998 21:41:56 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: New Perl book reviews
Message-Id: <6bl8r4$g9t$1@usenet88.supernews.com>

I've put up a page of Perl book reviews.  There are probably no surprises
for regular readers of c.l.p.m., but I've had requests from newbie friends
of mine, so there it is.

URL is http://ChicagoMusic.com/perl/

xoxo,
Andy

--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: 8 Feb 1998 21:45:33 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl Question
Message-Id: <6bl91t$9m9$1@comdyn.comdyn.com.au>

Please read the following article on how to choose a good subject line:

http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

In article <6biep5$spc$1@synthemesc.insync.net>,
	FaxMail@ElectraSoft.com (Bill Krahmer) writes:
> I am new to Perl.  

Nothing wrong with that :)

> Is there a way to run a perl script that would, by
> itself, make a reference to a web page?  Say that when a page loads, I
> want it to run a Perl script to load another page.  Is this posible?

Load another page where? Do you mean redirect the browser to another
page? That is not a perl question. But, if you use CGI.pm, which you
should, look for 'browser redirection' in the documentation. You
should really ask these questions on one of the comp.infosystems.www.*
groups, because they're not really related to perl.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


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

Date: Sun, 8 Feb 1998 12:49:44 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <Pine.GSO.3.96.980208124545.15943T-100000@user2.teleport.com>

On 4 Feb 1998, Jon Drukman wrote:

> : There isn't any symbol from ASCII set that is *not* allowed in an
> : email address. Read RFC822 for details.
> 
> there are clearly some forms which are more likely to be undeliverable
> than others.  i believe in catching the most egregiously
> incorrect-looking cases.

That's fine - it's what you do with them when you catch them that matters,
though. I'm sure that you're kind enough to merely warn "Hey, that address
looks funny" in that case, rather than to refuse to allow it merely
because of the way it looks. 

I know of at least one mailing-list manager that refuses to let me
subscribe as <rootbeer@teleport.com> because it boneheadedly denies all
addresses which begin with 'root'. But, hey, if I want to subscribe from a
root account of mine, why should somebody else's software object?

Of course, now we're too far off topic from Perl... :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 8 Feb 1998 13:05:13 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Greg Bacon <gbacon@cs.uah.edu>
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <Pine.GSO.3.96.980208130126.15943W-100000@user2.teleport.com>

On 4 Feb 1998, Greg Bacon wrote:

> I wonder what Goedel's email address is... :-)

Unfortunately, when I tried writing to him to ask what his email address
is, I uncovered a bug in my mail program, which is unable to handle
addresses which are infinitely long. As soon as I get that bug fixed, I'll
let you know what he says. 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 8 Feb 1998 23:26:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Quickie: regexp for valid e-mail addresses
Message-Id: <6bleui$33v$1@marina.cinenet.net>

Tom Phoenix (rootbeer@teleport.com) wrote:
: On 4 Feb 1998, Greg Bacon wrote:
: 
: > I wonder what Goedel's email address is... :-)
: 
: Unfortunately, when I tried writing to him to ask what his email address
: is, I uncovered a bug in my mail program, which is unable to handle
: addresses which are infinitely long. As soon as I get that bug fixed, I'll
: let you know what he says. 

I received an address purported to be Goedel's, and tried to validate 
it...but the damn thing seems to be both valid and invalid.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sun, 08 Feb 1998 17:29:35 -0600
From: ThomaJA@LFC.EDU (Mike Binkley)
Subject: regular expressions
Message-Id: <ThomaJA-0802981729350001@magmysmac.lfc.edu>

I need some help searching for multiple regular expressions in a string. 
Currently, I'm using code similar to what follows:

#!/usr/bin/perl

$word = "Thing to test for (no really);";
@tokens =  qw ( ( ) + ; test);

for ($k = 0; $k < $#tokens; $k++){
   if ($word =~ /@tokens[$k]/){
      print "$word   @tokens[$k]\n";
      };
   };
exit;


The problem is with those two parentheses and the plus, I keep getting
told that  I can't use the characters.  

For example @tokens[0] is "(" which gives me 
   /(/: unmatched ()

So how can I get around this?  If I put a \ in front of the @tokens[$k],
perl starts looking for "@tokens[k]" inside the string, definitely not
what I want.  

What do I need to do to get perl to look for the individual values?  I
know that I can just break everything up and check for one character at a
time, but i want to do this as efficiently as possible.  

Any help is appreciated.  :)


---

After I've got that working, I'm also going to need to do some simple
finding and replacing of the characters.  For example, I could have the
string

(hello)

and I want to replace the "("'s with " ( ", in other words put a space on
each side of the parenthesis, ending up with:

 ( hello)

If I can do this without using seeks and reads, that would be great.  And
any help with how I could do that would be great.  

If I need to use seeks and reads (or something similar), help with how I
can go about writing that code would be helpful as well.

Thanks!

-Bink.


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

Date: Sun, 08 Feb 1998 12:31:05 -0800
From: Fletcher Glenn <fglenn@notforspam.dnai.com>
To: "James F. Hranicky" <jfh@tick.cise.ufl.edu>
Subject: Re: Sending EOF to an opened pty
Message-Id: <34DE1609.200F@notforspam.dnai.com>

[both posted and emailed]

Have you tried sending a SIGHUP to the other process?  The
system call is:

#include <sys/signal.h>

kill(other_process_id, SIGHUP);

--
		Fletcher Glenn

		To email: remove "notforspam" from my return address

James F. Hranicky wrote:
> 
> Hi there,
> 
> Anyone know how to send an EOF to program B (stdin, stdout, stderr are all
> dup(2)'ed to an open pty) from program A? I tried
> 
>         system("stty eof '^d' < /dev/pts/<whatever>" )
> 
> but that didn't seem to work. I need to be able to send a bunch of output
> to the pty'ed program (e.g. sort), send an eof, and read back the results,
> similar to using shutdown(3n) on a socket. However,  I don't know how to
> do this with a pty.
> 
> I'm currently trying to do this on Solaris 2.[56] using perl5.004
> (IO::Pty for the pty) if any of that matters.
> 
> ----------------------------------------------------------------------
> | Jim Hranicky, Senior SysAdmin                   UF/CISE Department |
> | E314E CSE Building                            Phone (904) 392-1499 |
> | jfh@cise.ufl.edu                       http://www.cis.ufl.edu/~jfh |
> ----------------------------------------------------------------------


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

Date: Sun, 08 Feb 1998 18:24:16 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: solution for multiline comments???
Message-Id: <34DE3EA1.D40E94C8@coos.dartmouth.edu>

Eli the Bearded wrote:
> 
> Chipmunk  <rjk@coos.dartmouth.edu> wrote:
> > Chip Salzenberg wrote:
> > > Pod (or rather =... =cut) *is* very definitely part of the Perl language.
> > > That _is_ Perl's multiline comment syntax.  It just so happens that there
> > > are tools that can read those comments and use them as documentation, but
> > > Perl doesn't know that.
> ...
> > Note that in the third and fourth pieces of code, only the first line is a
> > comment.  =head1 and =cut are interpreted as part of the code.  Not entirely
> > unreasonable.  But definitely inconsistent with the other code samples.  A
> > good multiline commenting syntax shouldn't be so ambiguous.
> 
> All comments in perl are ambiguous. Deal with it.
> 
> In a sh script
> 
>          s=s#foo#bar#;
> 
> Assigns 's' to $s. In perl
> 
>         $s=s#foo#bar#;
> 
> Assigns a 1 or 0 to $s depending on weather or not the s/// of $_ succeded.
> 
> And for a real comment stripping hell (stolen from one of my old posts)
> consider these:
> 
>         s# foo  \# bar
>          # qux   #x;
> 
> [etc...]

Clever, but entirely beside the point.  In all your examples, it is not the
commenting syntax that is ambiguous, but the quoting operator syntax, i.e.
s###.  You could do those same tricks no matter what character was used
for comments, and probably even if comments required multiple characters.

In my examples of the ambiguity of POD-style comments, the comments are ambiguous
specifically because of the commenting syntax.

Chipmunk


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

Date: 8 Feb 1998 21:52:09 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Syntax-coloring editor for NT
Message-Id: <6bl9e9$g9t$3@usenet88.supernews.com>

I'm partial to MultiEdit by American Cybernetics.  The Perl coloring is
pretty good, and I like the editor a bunch, and it's only $100.

xoxo,
Andy

--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: Sun, 8 Feb 1998 13:16:59 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Jerry Davis <gedavis3@vt.edu>
Subject: Re: Using flock?
Message-Id: <Pine.GSO.3.96.980208131534.15943Y-100000@user2.teleport.com>

On Thu, 5 Feb 1998, Jerry Davis wrote:

> open(FILE, ">file.txt");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> flock(FILE, 2);
> ##make changes##
> flock(FILE,8);
> close(FILE);

Don't release the lock before closing the file. Instead, don't release the
lock at all - close the file, and Perl and the system will take care of
everything.

I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file. Hope this helps! 

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 8 Feb 1998 21:52:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: White Hats and Black
Message-Id: <6bl9ef$9m9$2@comdyn.comdyn.com.au>

In article <34dc05f7.3488726@news.tornado.be>,
	bart.mediamind@tornado.be (Bart Lateur) writes:

> Let me speculate on what it means. Why would Netscape free the source?
> 
> I think it's a statement. A statement that you can't compete with
> Microsoft. No matter how good your product is, no matter if you
> initially have the monopoly for the world, once Microsoft smells the
> possibility, it will hunt you down.They will copy the functionality of
> your product, improve on it in some parts, and market it for a similar
> (or preferably cheaper) price. Until YOU give up. Or go bust.

I haven't seen any improvements on other people's products in the
Microsoft products. All they do is market it more aggressively, and
force it to people as 'part' of their 'operating systems'. (quotes
intended)

> Looks what's happened to Novell, Borland, Lotus, WordPerfect, maybe even
> Unix. Once, they had it all. They ruled the world. Now, Microsoft owns
> the world, in what once was their speciality.

I wouldn't really put Unix in that list :). Unix isn't dead or overrun
by a long shot. And still, most of the above aren't caused by product
superiority, but by aggressive marketing strategies.

> M$ even employ dirty tricks, like encorporating Internet Explorer into
> Win95, and claim that it can't be removed from the OS. While it can.

Exactly.

> So, this is Netscape's statement: when up against Microsoft, you just
> can't win.

Not entirely, I think. The full statement is proably more like: 'Ok,
so we haven't been able to beat Microsoft by just having a good
product. Now, let's try it another way'.

I think this is just Netscape's latest try at regaining the browser
market. Navigator won't be free anymore once Microsoft's IE isn't
free anymore. The sources won't be available anymore after that.

> Unless when it's free. Perl stands pretty strong against M$'s offerings,
> so does Apache (web server). Let the world know:
> 
> 	The best things in life are free.
> 
> Even software.
> 
> "Free the web".

Amen. (with the right definition of 'best', that is :))

Martien

PS. Hmm, I didn't mention perl at all. Bad me.
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.       | accept as reality - Calvin
NSW, Australia                      | 


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

Date: Sun, 08 Feb 1998 17:08:42 -0500
From: Bill Lynch <wblynch@worldnet.att.net>
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <6bladf$t3r@bgtnsc02.worldnet.att.net>

Jon R. Kibler wrote:

(snip)

> Apparently neither of you are old enough to remember the IBM 1401s. On

> (more sniping)



> The 1401 was IBM's first really widespread and successful commercial
> computer. This is the machine from which so many of our bad habits
> originated. AND YES IT *IS* TRUE THAT:
> a) Because of the machine's architecture, it WAS MORE EFFICIENT
> storage-wise to use decimal numbers than binary numbers.
>
> b) Programs that operated on decimal numbers RAN SIGNIFICANTLY FASTER
> than the same programs written using binary numbers.
>
> THEREFORE DECIMAL NUMBERS WERE USED! AND THEY SAVED STORAGE!
>

Jon,

Me, too (showing age). IIRC, 16k was a maxed out 1401/1440/1460 (based on how
memory was addressed in a BCD machine), don't know about the 1410's. I did some
Autocoder programming in the 60's and I don't recall any way to specify binary
numbers. The idea of "data type" came, for me, with the S/360's. 1401's had BCD
and you had decimal data, end of story. Maybe I got into the 1400-series late, but
we had MULT & DIVIDE macros - no tables. If we were working on an expensive, pedal
to the metal 1400, it had HIGH-LOW-EQUAL compare (in addition to the std EQUAL-NOT
EQUAL). Amusing to think of how much that's std equipment now was optional not all
that long ago.

Bill Lynch, OF

(the "O" is "old", you can fill in the 2nd word<G>)


> Jon (I'm showing my age) Kibler
> Jon.Kibler@aset.com





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

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

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