[7943] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1568 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 2 14:07:35 1998

Date: Fri, 2 Jan 98 11:00:34 -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           Fri, 2 Jan 1998     Volume: 8 Number: 1568

Today's topics:
     [Q]: pingecho() on Win32? <smcculla@ivey.uwo.mx>
     Re: Avoiding regular expressions (was: Re: Newbie quest (Bart Lateur)
     Re: Avoiding regular expressions (was: Re: Newbie quest (Josh Kortbein)
     Re: File test operators (Jon Orwant)
     Re: forking in perl (Andrew M. Langmead)
     Re: i am a newbie <bugaj@bell-labs.com>
     I need a script <kriebels@nauticom.net>
     Re: I need a script <bugaj@bell-labs.com>
     modifying file lines exceptions <kvandra@uswest.com>
     NEWBE: Triming an input string djboyd@sam.on-net.net
     newbie regexp-problem (Tero Narinen)
     Re: newbie regexp-problem (M.J.T. Guy)
     Re: Perl not Y2K compliant (Abigail)
     Re: Perl not Y2K compliant (Brian Wheeler)
     Re: Perl not Y2K compliant (brian d foy)
     Re: Perl not Y2K compliant (Abigail)
     Re: Perl not Y2K compliant (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Perl not Y2K compliant <khera@kciLink.com>
     Re: pipeing problem. <jay@rgrs.com>
     Re: Pipes in Perl5 on Windows NT (Gurusamy Sarathy)
     Re: Pipes in Perl5 on Windows NT jola@hem.passagen.se
     print from subroutine with CGI module problem <pxharding@csi.com>
     Re: print from subroutine with CGI module problem (Jeremy D. Zawodny)
     Re: print from subroutine with CGI module problem <bugaj@bell-labs.com>
     Re: Putting a Caret in My Unix Prompt Capitalizes the N <barnett@houston.Geco-Prakla.slb.com>
     Re: send mail (Neil Briscoe)
     Re: SST and FrontPage98 under IIS3 <moises@texas.net>
     Re: undefined value <joseph@5sigma.com>
     Re: word wrap routine (Jeremy D. Zawodny)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 2 Jan 1998 17:36:01 GMT
From: "Steve McCullagh" <smcculla@ivey.uwo.mx>
Subject: [Q]: pingecho() on Win32?
Message-Id: <01bd17a5$07977110$f41d6481@bus-sherwood>

Can anyone describe how to do a TCP ping on Win32?

The Ping.pm uses the alarm() call, which is unsupported.

Many thanks,
Steve <smcculla@ivey.uwo.mx>  <- change it from Mexico to Canada!
(just to keep the spammers off balance) ;-|


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

Date: Fri, 02 Jan 1998 18:02:39 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Avoiding regular expressions (was: Re: Newbie question)
Message-Id: <34ae2a67.965801@news.tornado.be>

phenix@interpath.com (John Moreno) wrote:

>I haven't done any large projects in perl, but I've hardly ever needed
>to use a hash, OTOH I don't have a single script that goes for a dozen
>lines (non-setup) without using a regular expression of some sort.

Have you ever had the need to keep some sort of "database" in your
program? E.g. to keep track of how many times a word is used in a text
file? 

For this sort of thing, hashes are ideal, if all the data fits in
memory. Simpler, and MUCH faster than conventional databases.

	Bart.


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

Date: 2 Jan 1998 18:18:19 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Avoiding regular expressions (was: Re: Newbie question)
Message-Id: <68jb1b$5ao$1@news.iastate.edu>

: On Wed, 31 Dec 1997, Joseph Cotton wrote:

: > I'm new to perl, too, and I retch at the sight of such code.  Can any
: > one of you nice perl nerds create a series of functions to format
: > strings and numbers, so I can format things like I am able to in some
: > more civilized languages, that is, with out the use of a tilde and
: > slashes =~s/u/c/k/s;  I am not judgemental, this is just my own humble
: > opinion.  I believe in "each to his own", and I could be much more
: > productive without tildes.  

So you're somehow opposed to slashes and tildes, for aesthetic reasons?

Use the web much?


Josh

--

___________________________________________________________________________
"So, would you say it's about time for our viewers to... crack each others'
 heads open and feast on the goo inside?"
"Yes. Yes I would, Kent." 



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

Date: 02 Jan 1998 18:24:41 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: Sefi Kraemer <skraemer@iil.intel.com>
Subject: Re: File test operators
Message-Id: <ORWANT.98Jan2132441@fahrenheit-451.media.mit.edu>


Sefi Kraemer <skraemer@iil.intel.com> writes:

   I am trying to search for files with the * operator, but am unable to do
   so.

   Here is what I tried:

   push @host_list,$host if (-e "$DB_Path/$server*");


That looks for a filename ending in an asterisk.  You want to "glob",
which is the name used for resolving wildcards like ? and *.

Try
 
   push @host_list, $host if glob("$DB_Path/$server*");

-Jon

------------------------------------
Jon Orwant            http://tpj.com
Editor & Publisher, The Perl Journal


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

Date: Fri, 2 Jan 1998 17:12:43 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: forking in perl
Message-Id: <EM62H7.C0q@world.std.com>

mjforder@hotmail.com writes:

>Can anybody tell me where I can find a nice gentle introduction to
>writing perl script which use fork, wait etc. I've read some sections in
>the programming perl book, and the perl reference, but I'm little foggy
>on some of the concepts.

It uses C and not perl as the language its based on, but it seems that
the book "Advanced Unix Programming" by W Richard Stevens might the
the type of book that you are looking for.

Once you get a handle of the unix process model, you should be able to
understand the perl documentation of how it implements the unix
process systems calls.

-- 
Andrew Langmead


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

Date: Fri, 02 Jan 1998 12:39:20 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: i am a newbie
Message-Id: <34AD2648.794B@bell-labs.com>

> you just gotta love CGI.pm!
> 
There ought to be Knighthoods in the Programming Republic of
Perl, and Lincoln ought to be knighed for CGI.pm (and GD.pm).


LL+P,
Stephan


-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj, Multimedia Communication Research Dept.
Departmental Website:       http://www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan
FAQs:     http://www.cthulhu-dynamics.com/tech/metametafaq.html 
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
             "Do submarines swim?" - E.W. Dijkstra


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

Date: 2 Jan 98 16:28:40 GMT
From: "Kriebel" <kriebels@nauticom.net>
Subject: I need a script
Message-Id: <01bd17b3$8916ce80$3d7fabcc@ppp826278>

I have a site that I want to have users add a links.  I if someone could
write a CGI script that would print to a file using this format:
<br>
<br>
<br>
<b>Band Name: <a href="BandURL">BandName</a>
<table>
<tr><td>
 Song Title: <u>Song Title</u></td>
<td>  <a href="URLofRAM"><img src="gif/playbutton.gif"></a></tr></td>
</table>
<br>
<hr>
<br>
I would think that a database program that it would write to a log, and
call the log with SSI..
Please help
email me with any questions. Thanks in advance
Scott
www.indieradio.net


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

Date: Fri, 02 Jan 1998 12:19:04 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: I need a script
Message-Id: <34AD2188.2781@bell-labs.com>

> I have a site that I want to have users add a links.  I if someone could
> write a CGI script that would print to a file using this format:
>
 ...

You could, for example.  
In fact, if you use CGI.pm it wouldn't even be that hard, because
you wouldn't have to do the "scary" parts like parse the return 
values... 

http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

here's a quick example i wrote in this mailer in a couple minutes
(so ignore any bugs :> )... it's based on the program that's 
pretty much the first thing you see at the above URL... 


#!/usr/local/bin/perl
use CGI qw(:standard);
print header;
print start_html('A Simple Example'),
  h1('Enter your band link'),
  start_form,
  "Enter the band name: ", textfield('bandname'),
  "Enter the band URL: ", textfield('bandurl'),
  ... etc ...
  end_form; 
if(param())
{
  open(LOG,">$log") or die "Could not open $log: $!"; 
  print LOG "<data in the format of your choice>"; ...
  # below returns what the person just entered, so they see it...
  print "<br><b>Band Name: <A HREF=\"param('bandurl')\">
    param('bandname')</A>"; 
  print "<TABLE>...etc... format of your choice..."; 
}

Clearly you'll need to fill in the missing parts (don't leave
the ...'s in there ;> )

You can use the HTML tags imported by CGI.pm in your return
page as well, it has table tags built in, and you could even
check URL validity with the URI modules.  All this good 
stuff is on CPAN:

 http://www.perl.com/CPAN-local//CPAN.html


LL+P,
Stephan



-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj, Multimedia Communication Research Dept.
Departmental Website:       http://www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan
FAQs:     http://www.cthulhu-dynamics.com/tech/metametafaq.html 
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
             "Do submarines swim?" - E.W. Dijkstra


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

Date: Fri, 02 Jan 1998 10:47:04 -0700
From: Kristin VanDragt <kvandra@uswest.com>
Subject: modifying file lines exceptions
Message-Id: <34AD2818.BEE5C99E@uswest.com>

I'm trying to read and modify a file.  After searching many different
sources, I've found that the general solution is to create a temp copy,
write any changes to it, and then copy over the original.  However, I've
read that there are exceptions for manipulating files with all lines the
same length or replacing one a sequence of bytes with another sequences
of the same length.  I can't find any details.  Anyone know what these
would be?



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

Date: Fri, 02 Jan 1998 18:40:40 GMT
From: djboyd@sam.on-net.net
Subject: NEWBE: Triming an input string
Message-Id: <34ad3433.11292567@news.on-net.net>

How does one trim a string.  That is, like in VB you can issue a
command such as ltrim which will remove all spaces etc, on the left
hand of the string and same for rtrim.  How does one do this in perl.
that is remove spaces, tabs and new line on the right hand side of a
string.
 ...
TIA


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

Date: Fri, 02 Jan 98 18:08:57 GMT
From: tero.narinen@lut.fi (Tero Narinen)
Subject: newbie regexp-problem
Message-Id: <68ja65$dos$1@lut.fi>

Hello 
I've just started programming in Perl and I'm amazed how well one can do 
text-file handling with it. My regexps have been succesfull, but I've 
encountered one nasty problem. I'm trying to substitude following strings with 
each other and all the solutions I come up with are long not very elegant:

\\serverXX\share      to      \\otherserverYY\anothershare

It's a script used to upkeep logon-scripts in Windows NT. I'm using s/xxx/yyy/ 
for substitution but I don't seen to get any nice solution. I can make it work 
but it's long and not very Perlish :) None of the tutorials I've seen offer 
any help with special character (\something) rexexps so any pointers or 
suggestions would be valuable.

Another question: I'm considering buying either "Learning Perl" or "Learning 
Perl on win32 systems". They are rougly same size and one (or more?) of makers 
seem to be same. So which would be better? I'm an NT-person but I'm after a 
good Perl book. 

###Tero Narinen####################################################
###Skinnarilankatu 28 F 17###"BEWARE THE FURY OF A PATIENT MAN"####
###53850 Lappeenranta###################-John Dryden###############
###tero.narinen@lut.fi#############################################


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

Date: 2 Jan 1998 18:29:15 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: newbie regexp-problem
Message-Id: <68jblr$e5u$1@lyra.csx.cam.ac.uk>

In article <68ja65$dos$1@lut.fi>, Tero Narinen <tero.narinen@lut.fi> wrote:
>Hello 
>I've just started programming in Perl and I'm amazed how well one can do 
>text-file handling with it. My regexps have been succesfull, but I've 
>encountered one nasty problem. I'm trying to substitude following strings with 
>each other and all the solutions I come up with are long not very elegant:
>
>\\serverXX\share      to      \\otherserverYY\anothershare
>
>It's a script used to upkeep logon-scripts in Windows NT. I'm using s/xxx/yyy/ 
>for substitution but I don't seen to get any nice solution. I can make it work 
>but it's long and not very Perlish :) None of the tutorials I've seen offer 
>any help with special character (\something) rexexps so any pointers or 
>suggestions would be valuable.

I'm not sure exactly what you want, but I suspect you need to learn
about the \Q metacharacter (see perldoc perlre) or equivalently the
quotemeta function (see perldoc -f quotemeta).

For example, if you want to replace the value of $pattern by the value
of $replace, where $pattern may contain metacharacters, do

          s/\Q$pattern\E/$replace/;

or

          $pattern = quotemeta($pattern);
          s/$pattern/$replace/;


Mike Guy


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

Date: 2 Jan 1998 16:14:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl not Y2K compliant
Message-Id: <slrn6aq4mc.50c.abigail@betelgeuse.wayne.fnx.com>

brian d foy (comdog@computerdog.com) wrote on 1585 September 1993 in
<URL: news:comdog-ya02408000R0201980226500001@news.panix.com>:
++ In article <slrn6ap3l0.50c.abigail@betelgeuse.wayne.fnx.com>, abigail@fnx.com wrote:
++ 
++ >Huh, what do you mean "by then"? 
++ 
++ "by then" i was thinking only of the effects on the Unix clock.  one
++ could always make another structure for their own times :)


What makes you think that solves the 2038 problem? A large fraction
of the Y2K problem consists of using datastructures/storages that
use 2 chars for the year, and those are not trivially solved using
a different structure.

That problem will be the same with 2038.



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: 2 Jan 1998 16:28:55 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: Perl not Y2K compliant
Message-Id: <68j4k7$q8q$1@flotsam.uits.indiana.edu>

In article <slrn6aq4mc.50c.abigail@betelgeuse.wayne.fnx.com>,
	abigail@fnx.com (Abigail) writes:
> brian d foy (comdog@computerdog.com) wrote on 1585 September 1993 in
> <URL: news:comdog-ya02408000R0201980226500001@news.panix.com>:
> ++ In article <slrn6ap3l0.50c.abigail@betelgeuse.wayne.fnx.com>, abigail@fnx.com wrote:
> ++ 
> ++ >Huh, what do you mean "by then"? 
> ++ 
> ++ "by then" i was thinking only of the effects on the Unix clock.  one
> ++ could always make another structure for their own times :)
> 
> 
> What makes you think that solves the 2038 problem? A large fraction
> of the Y2K problem consists of using datastructures/storages that
> use 2 chars for the year, and those are not trivially solved using
> a different structure.

	"for their own times" I think is the key.  If I store the date/time
as a long, I will have a 2038 problem.  If I store it as a BCD yyyymmddhhmmss
string, *a different structure*, I don't have any problem (Ok, I have a Y10K
problem).
	Indeed, for legacy code, you can buy more time by having a "year 
(whenever the dates start+2000) problem".  I.E. I have some software that
started collecting data in '93.  Like an idiot, I only used two digit years.
In order to make the data work in 2000, I did a comparison of the two digit
date.  If its less than 93 then its 2000+date, otherwise its 1900+date.
No new structure is really necessary, just a new bit of code.

> 
> That problem will be the same with 2038.
	Not if you don't store them as longs.  long-longs should last much
longer :)

Brian

> 
> 
> 
> Abigail


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

Date: Fri, 02 Jan 1998 11:40:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl not Y2K compliant
Message-Id: <comdog-ya02408000R0201981140070001@news.panix.com>
Keywords: from just another new york perl hacker

In article <slrn6aq4mc.50c.abigail@betelgeuse.wayne.fnx.com>, abigail@fnx.com posted:

>brian d foy (comdog@computerdog.com) wrote on 1585 September 1993 in
><URL: news:comdog-ya02408000R0201980226500001@news.panix.com>:
>++ In article <slrn6ap3l0.50c.abigail@betelgeuse.wayne.fnx.com>, abigail@fnx.com wrote:
>++ 
>++ >Huh, what do you mean "by then"? 
>++ 
>++ "by then" i was thinking only of the effects on the Unix clock.  one
>++ could always make another structure for their own times :)
>
>
>What makes you think that solves the 2038 problem?

if you want to use more than 32 bit times, you make your own.  i'm
not proposing a solution to stupid coding elsewhere.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 2 Jan 1998 17:29:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl not Y2K compliant
Message-Id: <slrn6aq92d.50c.abigail@betelgeuse.wayne.fnx.com>

Brian Wheeler (bdwheele@indiana.edu) wrote on 1585 September 1993 in
<URL: news:68j4k7$q8q$1@flotsam.uits.indiana.edu>:
++ In article <slrn6aq4mc.50c.abigail@betelgeuse.wayne.fnx.com>,
++ 	abigail@fnx.com (Abigail) writes:
++ > brian d foy (comdog@computerdog.com) wrote on 1585 September 1993 in
++ > <URL: news:comdog-ya02408000R0201980226500001@news.panix.com>:
++ > ++ In article <slrn6ap3l0.50c.abigail@betelgeuse.wayne.fnx.com>, abigail@fnx.com wrote:
++ > ++ 
++ > ++ >Huh, what do you mean "by then"? 
++ > ++ 
++ > ++ "by then" i was thinking only of the effects on the Unix clock.  one
++ > ++ could always make another structure for their own times :)
++ > 
++ > 
++ > What makes you think that solves the 2038 problem? A large fraction
++ > of the Y2K problem consists of using datastructures/storages that
++ > use 2 chars for the year, and those are not trivially solved using
++ > a different structure.
++ 
++ 	"for their own times" I think is the key.  If I store the date/time
++ as a long, I will have a 2038 problem.  If I store it as a BCD yyyymmddhhmmss
++ string, *a different structure*, I don't have any problem (Ok, I have a Y10K
++ problem).

Yes, that's fine if you write new software. The problem is, just like
Y2K, existing software.

++ 	Indeed, for legacy code, you can buy more time by having a "year 
++ (whenever the dates start+2000) problem".  I.E. I have some software that
++ started collecting data in '93.  Like an idiot, I only used two digit years.
++ In order to make the data work in 2000, I did a comparison of the two digit
++ date.  If its less than 93 then its 2000+date, otherwise its 1900+date.
++ No new structure is really necessary, just a new bit of code.

Uhm right. Some time ago, I talked to a programmer who did the same
trick. That worked fine, untill one of his clients started trading
in 100 year bonds.

++ > That problem will be the same with 2038.
++ 	Not if you don't store them as longs.  long-longs should last much
++ longer :)

If something is currently stored as 32 bit integers, there will be
problems if you suddenly change the program to use 64 bit structures, just
like "just use 4 chars for the year" doesn't always solve the Y2K problem.



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Fri, 02 Jan 98 12:35:49 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Perl not Y2K compliant
Message-Id: <34ad25c7$1$ofn$mr2ice@speaker>

In <slrn6ap3l0.50c.abigail@betelgeuse.wayne.fnx.com>, on 01/02/98 at 06:50 AM,
   abigail@fnx.com (Abigail) said:
+-----
| Huh, what do you mean "by then"? People said so in the 70's about Y2K too,
| and look what happened.
+--->8

True, but that's with what amounts to formatted data.  The most probable
solution I see is that (long) will be a 64-bit type on most platforms by then.

-- 
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)



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

Date: 02 Jan 1998 12:33:01 -0500
From: Vivek Khera <khera@kciLink.com>
Subject: Re: Perl not Y2K compliant
Message-Id: <x790syaiia.fsf@kci.kciLink.com>

>>>>> "MB" == Michael Budash <mbudash@sonic.net> writes:

>>> ++ can someone explain why 2038 is such a magic number?
>>> 
>>> $ perl -lwe 'print scalar localtime -1 + (1 << 31)'
>>> Mon Jan 18 22:14:07 2038

MB> Thanks, Abigail, but I still don't get it... call me what you will, but
MB> could you please explain...? (sorry)

The expression "-1 + (1<<31)" is the same as "2^31 - 1", which is the
largest positive number one can store in a 32-bit signed integer.
This is the normal datatype used for storing the time values in Unix
systems.  Thus, on the date above, the time value represented in
seconds will overflow unless the underlying data type is enlarged to
something like 64 bit integers.  Work on this is already progressing
in various flavors of Unix.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-258-8292
PGP/MIME spoken here              http://www.kciLink.com/home/khera/


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

Date: 02 Jan 1998 13:21:36 -0500
From: Jay Rogers <jay@rgrs.com>
To: Sebastian Andersson <sa@hogia.net>
Subject: Re: pipeing problem.
Message-Id: <82sor6n3db.fsf@shell2.shore.net>

Sebastian Andersson <sa@hogia.net> writes:
> I'm not a good perl programmer so I think I better ask the experts; How
> do I do this in a portable way?
> open(FD, "command </proc/$$/fd/0 |");

You need to be knowledgeable about Unix IPC (interprocess
communication) to write the above in "long hand".

    pipe FD, KID_WTR
        or die $!;
    
    unless ($pid = fork) {  # child process
        die $! unless defined $pid;
    
        open STDOUT, ">&KID_WTR"
            or die $!;
        $| = 1;
        close KID_WTR;
        close FD;
    
        exec "command"
            or die $!;
    }
    close KID_WTR;

> What I want is to process parts of STDIN from a perl script and then
> process the rest of it via a another program (metamail) and use the
> result in the perlscript.

NB: if you use buffered I/O to read from STDIN, then it's likely that
you'll read more data than you intend (i.e. lines intended for
metamail will be sitting in some other read buffer).

Read using unbuffered I/O to avoid this.  So assuming you want to read
the first line of standard input and have metamail read the rest, do
this before forking:

    $line = '';
    while (sysread STDIN, $line, 1, length($line)) {
        last if $line =~ /\n$/;
    }

--
Jay Rogers
jay@rgrs.com


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

Date: 2 Jan 1998 15:11:40 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Pipes in Perl5 on Windows NT
Message-Id: <68j03c$iog@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <34ACF2B9.1E6E81CC@hem.passagen.se>,
Jo La  <jola@hem.passagen.se> wrote:
>This doesn't work:     echo hello | myprog.pl
>In the second example, myprog.pl is started but the 'hello' never gets
>to the program.
>The same goes for "myprog.pl <mytextfile.txt" which also doesn't work.
>
>The myprog.pl program:
>$myin = <STDIN>;
>print $myin . "\n";
>
>My current filetype association for Perl:
>.pl=plfile
>plfile="e:\winprog\Perl\bin\perl.exe" "%1" %*

This is a well-known bug in file associations.  Which is why I
recommend using batchfile wrappers exclusively (they don't have
this problem).

 - Sarathy.
   gsar@umich.edu




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

Date: Fri, 02 Jan 1998 19:21:58 +0100
From: jola@hem.passagen.se
To: Gurusamy Sarathy <gsar@engin.umich.edu>
Subject: Re: Pipes in Perl5 on Windows NT
Message-Id: <34AD3046.95875344@hem.passagen.se>

Hi Sarathy!

Thanks for your reply!

At [Fri, 2 Jan 1998 10:12:12 -0500 (EST)]
Gurusamy Sarathy <gsar@engin.umich.edu> wrote:
>This is a well-known bug in file associations.  Which is why I
>recommend using batchfile wrappers exclusively (they don't have
>this problem).

Is there no way to avoid using batchfile-wrapping? 
Is the bug in Win-NT or in the Perl.exe? (If the answer is Win-NT, then
how come batch-file works...?)
What about my IIS web-servers: The same bug there, or not?

Thanks in advance again!

/Jonas.


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

Date: Fri, 02 Jan 1998 15:19:58 +0000
From: Piers <pxharding@csi.com>
Subject: print from subroutine with CGI module problem
Message-Id: <34AD059D.3C99EB60@csi.com>

Hello all,

I have imported the CGI.pm module and do successive print commands in
the "main" part of the program eg:
use CGI;

print header;
print start_html;

then I go to a subroutine ...
some_routine;


sub some_routine{
    print h1(" a nice heading ");
}

What happens ( or doesn't happen ) is that anything printed in the
subroutine does not become part of my return html document - it just
seems to disappear!

Can someone please explain.

Using IIS3.0 PERLIIS.DLL version 5.003 etc.

Any help gratefully accepted.



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

Date: Fri, 02 Jan 1998 17:17:38 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: print from subroutine with CGI module problem
Message-Id: <34ad2111.773902953@igate.hst.moc.com>

[original author automagically cc'd via e-mail]

On Fri, 02 Jan 1998 15:19:58 +0000, Piers <pxharding@csi.com> wrote:

>Hello all,
>
>I have imported the CGI.pm module and do successive print commands in
>the "main" part of the program eg:
>use CGI;
>
>print header;
>print start_html;
>
>then I go to a subroutine ...
>some_routine;
>
>
>sub some_routine{
>    print h1(" a nice heading ");
>}
>
>What happens ( or doesn't happen ) is that anything printed in the
>subroutine does not become part of my return html document - it just
>seems to disappear!
>
>Can someone please explain.
>
>Using IIS3.0 PERLIIS.DLL version 5.003 etc.
>
>Any help gratefully accepted.

Have you tried suggestions in the FAQ like running it from the
command-line with the "-w" and "-c" switches? What happens then?

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


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

Date: Fri, 02 Jan 1998 12:26:30 -0500
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Re: print from subroutine with CGI module problem
Message-Id: <34AD2346.446B@bell-labs.com>

> I have imported the CGI.pm module and do successive print commands in
> the "main" part of the program eg:
> use CGI;
> 
> print header;
> print start_html;
> 
> then I go to a subroutine ...
> some_routine;
> 
> sub some_routine{
>     print h1(" a nice heading ");
> }
> 
> What happens ( or doesn't happen ) is that anything printed in the
> subroutine does not become part of my return html document - it just
> seems to disappear!
> 
> Can someone please explain.
> 
> Using IIS3.0 PERLIIS.DLL version 5.003 etc.
> 
Well, I don't know dookie about IIS3.0... but I don't
think it is part of your problem (well, at least, not this
one ;-> )

This is what I'd do to fix it.  

$query = new CGI; 

print $query->header, $query->start_html; #etc
some_routine; 

sub some_routine
{
   my($query) = @_; 
   print $query->h1(" a nice heading "); 
} 

In your code there is no query in the subroutine scope, you
need to pass the sub a $query and to do that you'll have to give
up the implict style you are using (with no $query = new CGI; and
no print $query->foo;)... at least that's what I do.


LL+P,
Stephan


-- 
  
                    "Do computers think?"
---------------------------------------------------------------
Stephan Vladimir Bugaj, Multimedia Communication Research Dept.
Departmental Website:       http://www.multimedia.bell-labs.com
PGPkey from http://www.pgp.net/wwwkeys.html or other keyservers
Non-Lucent website:     http://www.cthulhu-dynamics.com/stephan
FAQs:     http://www.cthulhu-dynamics.com/tech/metametafaq.html 
---------------------------------------------------------------
    STANDARD DISCLAIMER:My opinions are NOT those of LUCENT
---------------------------------------------------------------
             "Do submarines swim?" - E.W. Dijkstra


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

Date: Fri, 02 Jan 1998 10:00:56 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Putting a Caret in My Unix Prompt Capitalizes the Next Character
Message-Id: <34AD0F38.85BC0D18@houston.Geco-Prakla.slb.com>

Tom Phoenix wrote:
> 
> On 31 Dec 1997, Kevin M Simonson wrote:
> 
> >           oas~h/simonson/Perl} cat Simple
> >           #!/usr/local/bin/perl
> >           print "a^g:"
> >           oas~h/simonson/Perl} set prompt = `~simonson/Perl/Simple`" "
> >           a^G:
> >
> >      The thing that's been bothering me is the capital 'G' from the small
> > 'g'.  Anybody know why this is happening?  Or how I can make it stop hap-
> > pening?
> 
> Whatever the reason, it is being done by your shell rather than by Perl.
> So this isn't really a Perl problem. But my guess is that the shell
> interprets '^g' as meaning that you want a control-G, which it prints as
> '^G'. Check your shell's docs to find out how to make a literal caret in
> the prompt.
Hi.

I'm using tcsh.  I'm able to get "a^g:" as the prompt by changing your
print statement to print "a\\^g".  This seems to work because Perl
expands the first \, and passes "a\^g" to the shell.  The shell then
expands the \, leaving a^g.

BTW, I think it is the xterm window (rather than the shell (or in
addition to it?)) intercepting the ^g characters....?  

HTH.

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 *
* Schlumberger Geco-Prakla   (281) 596-1434 (Office Number)            *
* 1325 S. Dairy Ashford      (281) 596-1807 (Fax)                      *
* Houston, TX 77077                                                    *
------------------------------------------------------------------------


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

Date: 2 Jan 1998 15:58:30 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: send mail
Message-Id: <memo.19980102155829.7977B@skep.compulink.co.uk.cix.co.uk>

In article <01bd1730$d134a800$9d8614d1@nwlink.com>, hebert19@nwlink.com
(Josh Hebert) wrote:

> I am looking for a good way to use the mail functions on an NT server
> my &send_mail from the mail-lib.pl is not working.  any thoughts.
>
>

Yup.  If you have access to a mail server that will let you use it, then I
have an smtp.pl script that you can use require on.

I wrote it after I failed to get the excellent libnet modules from Graham
Barr to work under NT - so I just hacked his code into Perl 4 idioms.  Its
not pretty but it does work.

Just mail me if you'd like a copy - and I'll send you the necessary.

Regards
Neil



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

Date: 2 Jan 1998 15:08:45 GMT
From: "Moises G. Solis" <moises@texas.net>
Subject: Re: SST and FrontPage98 under IIS3
Message-Id: <01bd175e$0ad7c740$8a067fce@genesis>

My problem was the virtual directory path.   It was found under Internet
Service Manager -> Directory.

Thanks for the help.
Moises




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

Date: Thu, 01 Jan 1998 19:08:52 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: undefined value
Message-Id: <34AC4C07.EC349523@5sigma.com>

I mean I didn't get a warning message when I tried the code
you posted.  perl 5.004_03, File::Copy 2.02.  When you post messages
about weird behavior like this it is sometimes helpful to post
the output from perl -V (capital V) too.

	-joseph
	 http://www.effectiveperl.com

snailgem@aol.com wrote:
> 
> Joseph N. Hall wrote:
> >
> > Works for me.  Maybe $common_dir or $this_htm are undefined?
> >
> 
> You mean you don't get the warning message? 'Cause as far as the file
> being copied, it works for me too. . .


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

Date: Fri, 02 Jan 1998 15:22:28 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: word wrap routine
Message-Id: <34ad05fe.766972337@igate.hst.moc.com>

[original author automagically cc'd via e-mail]

On Wed, 31 Dec 1997 22:01:02 -0500, Joseph Cotton <jcotton@erols.com>
wrote:

>Opinion #2.  Perl is a language which took all the bad parts of C and
>made them even worse.

Perhaps you could tell us more about that.

I happen to like easily changed data types, not worrying about memory
allocation and string buffer over-runs, etc.

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


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

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

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