[7637] in Perl-Users-Digest
Perl-Users Digest, Issue: 1263 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 2 22:17:13 1997
Date: Sun, 2 Nov 97 19:00:26 -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, 2 Nov 1997 Volume: 8 Number: 1263
Today's topics:
Re: 2000 time problem (Kai Henningsen)
Re: Accessing perl libraries (Jason Gloudon)
Re: Can I confess run-time taint errors? (Jason Gloudon)
counting lines in a file?? (Burt Lewis)
Re: counting lines in a file?? <jgostin@shell2.ba.best.com>
Re: counting lines in a file?? (brian d foy)
Re: counting lines in a file?? (brian d foy)
Re: Creating a new file each day?? (Andy Rutledge)
Re: Creating a new file each day?? (Andy Rutledge)
Re: Creating a new file each day?? (Andy Rutledge)
Re: form to return answers? (Tad McClellan)
Inserting characters into a string. (Andy Rutledge)
Re: IRC bot <sgreven@sonja.mpu.gov.za>
Make problems with OS/2 samdie@ibm.net
Need binary for solaris jmahtani@hotmail.com
Re: Perl for OS/2 (Ilya Zakharevich)
Re: Real Newbie Question (Tad McClellan)
realtime output - HELP ME PLEASE!!! <matthias.hellmund@nienburg-weser.de>
realtime output: HELP ME PLEASE ! ! ! <matthias.hellmund@nienburg-weser.de>
Re: Replacing a string in several files. (Tad McClellan)
Simple console program <BBDOG@worldnet.att.net>
wanted: perl consultant (Marc Brodsky)
Re: What to do with Bitwise operators? (dave)
Re: What to do with Bitwise operators? samdie@ibm.net
Win32/16: Using perl as NT logon script processor <metcher@no.junk.mail>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 02 Nov 1997 23:57:00 +0200
From: kaih=6h73r35mw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: 2000 time problem
Message-Id: <6h73r35mw-B@khms.westfalen.de>
phenix@interpath.com (John Moreno) wrote on 22.10.97 in <19971022134303922390N@roxboro-169.interpath.net>:
> I think using a 64 bit number and a event several thousand years ago
> would be good enough for most people - sure some historians or geologist
> will still have problems, but it'd cover 99.99% of the cases. And this
> way dates in things like genealogical records could use the date in the
> same manner as other programs.
On the other hand, using a 64 bit number, a base of (say) 1970, and
allowing negative values, gets you back around 300 billion(US) years -
that ought to be enough even for cosmologists. (It also gets you forward
*only* around 300 billion(US) years, as opposed to 600 for unsigned.)
All assuming I didn't do the math wrong, of course. :-)
Kai
--
Internet: kai@khms.westfalen.de
Bang: major_backbone!khms.westfalen.de!kai
http://www.westfalen.de/private/khms/
------------------------------
Date: 2 Nov 1997 22:54:24 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Accessing perl libraries
Message-Id: <63j0b0$sga$1@daily.bbnplanet.com>
Randal Schwartz (merlyn@stonehenge.com) wrote:
: >>>>> "Jason" == Jason Gloudon <bash@bbn.remove.com> writes:
: Jason> Inn wants to link with a libperl.a or libperl.so library, which
: Jason> it is looking for in
: Jason> /usr/local/lib/perl5/sun4-solaris/5.00403/CORE. By default, the
: Jason> perl install doesn't install or create them. You'll need to get
: Jason> the perl source and build them.
: You made a typo there. The word "doesn't" should be "does", as in:
Oops, I was talking about the shared libraries. Didn't check for the static
lib.
Jason Gloudon
------------------------------
Date: 3 Nov 1997 01:52:09 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Can I confess run-time taint errors?
Message-Id: <63jao9$f5v$1@daily.bbnplanet.com>
gtuckerkellogg@genetics.com wrote:
: I'd *really* like to see the call stack. I know how to use the
: debugger to get this, but is there a way of getting a fatal
: run-time error to print the call stack?
>From reading perldoc Carp: This seems like what you want.
Carp(3) User Contributed Perl Documentation Carp(3)
carp - warn of errors (from perspective of caller)
cluck - warn of errors with stack backtrace
(not exported by default)
croak - die of errors (from perspective of caller)
confess - die of errors with stack backtrace
Jason Gloudon
------------------------------
Date: 2 Nov 1997 23:44:49 GMT
From: burt@ici.net (Burt Lewis)
Subject: counting lines in a file??
Message-Id: <63j39h$naa$1@bashir.ici.net>
Hi,
I think this is an easy one but once again, I'm having trouble.
I have a text file that looks something like:
red 22222 green blue black
black 22222 black blue green
white 33333 blue green black
red 33333 green black blue
aqua 33333 black blue white
blue 44444 red green blue
I need to subtotal by the second column so that my results are simply:
22222 group has 2 lines
33333 group has 3 lines
44444 group has 1 line
Appreciate any help with this.
Thanks!
Burt Lewis
burt@ici.net
------------------------------
Date: 3 Nov 1997 00:25:36 GMT
From: Jeff Gostin <jgostin@shell2.ba.best.com>
Subject: Re: counting lines in a file??
Message-Id: <63j5m0$45c$1@nntp1.ba.best.com>
Burt Lewis <burt@ici.net> wrote:
: I think this is an easy one but once again, I'm having trouble.
Well, it depends what you're looking for. If the second column is always
going to of Known Quantities (IE: they're from a pre-determined list), a
"hackish" solution might be:
open (SOMEFILE, "/path/to/file");
# check to see if the file openned ok.
#
# list of counting variables goes here. For example:
$quantity_22222 = 0;
$quantity_33333 = 0;
#etcetc
# Ok, let's read this file line by line, and process each line.
while ($someline = <SOMEFILE>)
{
# Use 'split' to seperate the lines.
# Use a 'case' structure to increment the appropriate counting variables.
}
# You _did_ remember to close the file when you're done with it, right? ;)
close SOMEFILE;
# print the values of the quantity_XXXXXX variables here
# We're done! :)
Now, I'm -sure- there's other ways to do it. Without knowing anything about
the second column beyond what you've given as an example, this pseudo-script
will do what you want. It may not be the _best_ was, but it is _one_ way. :)
Also, I intentionally left the code out of it, to give you an idea of the
flow of my proposed solution. The appropriate documentation ('perldoc',
Learning Perl (Schwartz), etc) will give you more detail on the use of
'split' and 'case', and may provide other clues. :)
I hope this helps!! :)
--Jeff
------------------------------
Date: Sun, 02 Nov 1997 20:20:35 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: counting lines in a file??
Message-Id: <comdog-ya02408000R0211972020350001@news.panix.com>
In article <63j39h$naa$1@bashir.ici.net>, burt@ici.net (Burt Lewis) wrote:
>I have a text file that looks something like:
>
>red 22222 green blue black
>black 22222 black blue green
>white 33333 blue green black
>red 33333 green black blue
>aqua 33333 black blue white
>blue 44444 red green blue
>
>I need to subtotal by the second column so that my results are simply:
>
>22222 group has 2 lines
>33333 group has 3 lines
>44444 group has 1 line
#!/usr/bin/perl -wT
use strict;
# the key is the group name
# the value is the line count for that group
my %count;
while( <DATA> )
{
#split on whitespace. you may need to tidy this up for
#your real data.
my @array = split;
#this is my favorite Perl trick...
#increment the line count for the found group
$count{$array[1]}++;
}
foreach( sort keys %count )
{
print "$_ has $count{$_} line";
print 's' unless $count{$_} == 1;
print "\n";
}
__DATA__
red 22222 green blue black
black 22222 black blue green
white 33333 blue green black
red 33333 green black blue
aqua 33333 black blue white
blue 44444 red green blue
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Sun, 02 Nov 1997 20:28:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: counting lines in a file??
Message-Id: <comdog-ya02408000R0211972028560001@news.panix.com>
In article <63j5m0$45c$1@nntp1.ba.best.com>, Jeff Gostin <jgostin@shell2.ba.best.com> wrote:
>Well, it depends what you're looking for. If the second column is always
>going to of Known Quantities (IE: they're from a pre-determined list), a
>"hackish" solution might be:
s/hackish/kludgey/; # ;)
>$quantity_22222 = 0;
>$quantity_33333 = 0;
oh, Perl can do much better than that! one of Perl's great powers
is not having to know the data format or names at compile-time!
># Use a 'case' structure to increment the appropriate counting variables.
is 'case' something new?
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
as someone said earlier this week "Think Perl not C" (or somesuch).
------------------------------
Date: Sun, 02 Nov 1997 20:05:28 -0600
From: andyrut@usa.net (Andy Rutledge)
Subject: Re: Creating a new file each day??
Message-Id: <andyrut-0211972005290001@lnk1-ppp-24.binary.net>
You could add the date to the filename. For example.
$date = `date +"%m%d%y"`
$logdir = '/usr/www/docs/burt/weblogs/';
open(LOG,">>$logdir$date");
Then your log files would appear in your log directory, with each filename
being the date.
Hope that helps,
Andy
> Hi,
>
> I have an SSI logger script that is wrighting now to a single file and
> appending each line. That works just fine!
>
> I would like to start a new file each day and have one file for every day
> instead of just the one file.
>
> Having some trouble doing this and would appreciate any help.
>
> Thanks!
>
> Burt Lewis
> burt@ici.net
------------------------------
Date: Sun, 02 Nov 1997 20:06:19 -0600
From: andyrut@usa.net (Andy Rutledge)
Subject: Re: Creating a new file each day??
Message-Id: <andyrut-0211972006200001@lnk1-ppp-24.binary.net>
You could add the date to the filename. For example.
$date = `date +"%m%d%y"`;
$logdir = '/usr/www/docs/burt/weblogs/';
open(LOG,">>$logdir$date");
Then your log files would appear in your log directory, with each filename
being the date.
Hope that helps,
Andy
> Hi,
>
> I have an SSI logger script that is wrighting now to a single file and
> appending each line. That works just fine!
>
> I would like to start a new file each day and have one file for every day
> instead of just the one file.
>
> Having some trouble doing this and would appreciate any help.
>
> Thanks!
>
> Burt Lewis
> burt@ici.net
------------------------------
Date: Sun, 02 Nov 1997 20:06:38 -0600
From: andyrut@usa.net (Andy Rutledge)
Subject: Re: Creating a new file each day??
Message-Id: <andyrut-0211972006380001@lnk1-ppp-24.binary.net>
You could add the date to the filename. For example.
$date = `date +"%m%d%y"`;
$logdir = '/usr/www/docs/burt/weblogs/';
open(LOG,">>$logdir$date");
Then your log files would appear in your log directory, with each filename
being the date it was logged.
Hope that helps,
Andy
> Hi,
>
> I have an SSI logger script that is wrighting now to a single file and
> appending each line. That works just fine!
>
> I would like to start a new file each day and have one file for every day
> instead of just the one file.
>
> Having some trouble doing this and would appreciate any help.
>
> Thanks!
>
> Burt Lewis
> burt@ici.net
------------------------------
Date: Sun, 2 Nov 1997 17:00:37 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: form to return answers?
Message-Id: <lm0j36.bn7.ln@localhost>
Rick (ricklarson@pacificcoast.net) wrote:
: Wow! popular ng.
Probably because Perl is a popular language.
: Can do pages etc.
Memory mangagement (paging) is done by the Operating System, not
(usually) by a programming langugage, such as Perl.
You should direct questions about paging to a newsgroup specific to
the OS that you are using.
Or maybe you mean something else when you say "page"?
Maybe you assume some WWW connection with the term "page"?
In that case, perhaps the appropriate newsgroup might be:
comp.infosystems.www.authoring.html
: but not cgi/
I know for a fact that there is a different newsgroup for dealing
with questions specific to CGI:
comp.infosystems.www.authoring.cgi
Perl != CGI!
: perl
THAT is the topic discussed in this newsgroup.
If you have a perl-specific question, ask it here.
: etc. or java.
We don't do Java here either. That would be one of:
comp.lang.java.misc
comp.lang.java.advocacy
comp.lang.java.programmer
comp.lang.java.api
comp.lang.java.setup
comp.lang.java.tech
comp.lang.java.security
comp.lang.java.announce
: Need to
: get a start for a form that will returm answers to math questions. ie: user
: will enter a few numbers.....form or whatever returns a value.
Sounds like you want to write a CGI script.
I've already pointed out where to go with CGI questions, but first you
might want to take this advice from the Perl FAQ, part 9:
-------------------------------
=head2 My CGI script runs from the command line but not the browser. Can you help me fix it?
Sure, but you probably can't afford our contracting rates :-)
Seriously, if you can demonstrate that you've read the following FAQs
and that your problem isn't something simple that can be easily
answered, you'll probably receive a courteous and useful reply to your
question if you post it on comp.infosystems.www.authoring.cgi (if it's
something to do with HTTP, HTML, or the CGI protocols). Questions that
appear to be Perl questions but are really CGI ones that are posted to
comp.lang.perl.misc may not be so well received.
The useful FAQs are:
http://www.perl.com/perl/faq/idiots-guide.html
http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
http://www.perl.com/perl/faq/perl-cgi-faq.html
http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
http://www.boutell.com/faq/
-------------------------------
: Looking or
: shopping cart?
Is that a statement (you are looking for a shopping cart), or a
question (you wonder if a shopping cart will do what you have described)?
: spreadsheet? or? Also not sure if its java, perl or I need.
: Alas! I'm helpless!! Anyways I'll lurk a while and see if I find an
: answer! TIA!
I might suggest getting proactive about it and check out some of the
URLs given above ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 02 Nov 1997 19:58:56 -0600
From: andyrut@usa.net (Andy Rutledge)
Subject: Inserting characters into a string.
Message-Id: <andyrut-0211971958570001@lnk1-ppp-24.binary.net>
Ok, how would I go about inserting a certain character after every fourth
letter in a string?
Like turning "firefighter" into "fireXfighXter" or something. Using perl
code of course. Doing it manually isn't nearly as fun. :o)
If you can help me out, please reply to this post. MERCI BEAUCOUP!
**NO E-Mail please! I was overwhelmed by the wonderful e-mail I received
from my last post! :o)
Thanks in advance,
Andy
------------------------------
Date: Mon, 03 Nov 1997 02:24:41 +0200
From: Sean Greven <sgreven@sonja.mpu.gov.za>
Subject: Re: IRC bot
Message-Id: <345D19C9.41C67EA6@sonja.mpu.gov.za>
Sergio Stateri Jr wrote:
>
> Hi ! I'm doing an IRC bot in Perl and I'm having any problems :
>
> (/^:(\S+)\!\S* PRIVMSG SampaBot :canal(.+)/i) && &send_canal($1,$2,$3);
>
> this line call the sub send_canal. I'd like to pass, per example :
>
> canal #test my message...
>
> then the bot'll send the message "my message..." to the channel #test,
> but...When I do this, bot send only "my" to the channel...Is there any way
> to put all the words after the "canal xxxxxxx" in an unique $variable ? I
> know that what's happening now is because the "my" is $3 and "message..."
> would be $4, but in this way I woudln't know how many $n I'd have...
>
> Thanks for any help...
You are right in your assumption - This is how I did it ..
sub send_canal{
local($a,$b,$c,@rest) = @_;
fill the rest in here
}
regards Seam
------------------------------
Date: Sun, 02 Nov 97 17:50:52 -0500
From: samdie@ibm.net
Subject: Make problems with OS/2
Message-Id: <345d0acf$1$fnzqvr$mr2ice@news-s01.ny.us.ibm.net>
After several fun filled weeks of coding up a storm in standard Perl, I find
myself with a pressing need to use some modules that require making (foo.pl,
etc.) I'm running os/2 and have a perfectly acceptable (heretofore) c++
compiler from Watcom. Their make utility (wmake) is not at all happy with the
makefile produced by the pl script (actually, makemaker, I guess). From
looking at the makefile, it's fairly clear that a lot of Unix
commands/utilities (possibly, GNU replacements) are assumed.
Is there some reasonably straightforward way to build these things without
having to first install several dozen "other" utilities? Failing that, is
there some document describing a necessary & sufficient subset of the usual
Unix utilities that would need to be installed or is this at the whim of the
authors of the pl scripts (and only discoverable if/when the script poops
out)?
I spent a few hours (not fun filled) this AM trying to install GNU's make but
it (and its documentation) seem rather uncompromisingly Unix oriented (don't
seem to remember having had much trouble getting their GAWK to work). I'd
prefer not to have to spend the time and disk space needed to install a whole
passle of GNU stuff if there's some easier way.
TIA for pointers/suggestions.
--
-----------------------------------------------------------
samdie@ibm.net 199711020550 -0500
------------------------------
Date: Sun, 02 Nov 1997 20:02:00 -0600
From: jmahtani@hotmail.com
To: ksjgm09@tamuk.edu
Subject: Need binary for solaris
Message-Id: <878521969.520@dejanews.com>
Hello, I am looking for a binary of perl(for solaris 2.5.1 ). I would be
very much obliged if someone could let me know where I could find a
binary for solaris. (I know it is a good idea to compile perl but I just
wanted to try the binary first before I compile one). Please reply to
jmahtani@hotmail.com and not to dejanews. Waiting for a response. Thanks.
Jeetandra
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 2 Nov 1997 23:43:00 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl for OS/2
Message-Id: <63j364$ief$1@agate.berkeley.edu>
In article <63aqt8$gks$2@news00.btx.dtag.de>,
Gunther E. Biernat <GEBiernat@bauwesen.de> wrote:
> On Wed, 29 Oct 1997 18:28:56, "Billy Boone" <bboone@lexmark.com>
> wrote:
>
> > Where can I find a version of perl for OS/2?
>
> For the source have a look at
> http://www.perl.com/CPAN/src/latest.tar.gz
>
> it should build fine under OS/2. If you need a binary go to
>
> Hobbes
> http://hobbes.nmsu.edu/
>
> and do a search for perl. If you can't find it, I'll have a closer
> look...
I do not think anything reasonable is available on Hobbes. Go to CPAN
ports directory instead (as for any other Perl stuff - except possibly
5.003 source ;-).
Ilya
------------------------------
Date: Sun, 2 Nov 1997 17:14:59 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Real Newbie Question
Message-Id: <jh1j36.bn7.ln@localhost>
Anders Thelemyr (anderst@XISPX.se) wrote:
: I am the mother of newbies when it comes to cgi(perl) programming...
^^^^^^^^^
The first thing you should know is that
Perl != CGI
In fact, most uses of Perl are for things OTHER than CGI programming,
though Perl does seem to shine in that application area too.
You can write CGI scripts in nearly any language.
: Could someone please explain [to a layman like me] this whole thing about
: perl modules
If you have a specific question about a module, ask it here (or in the
comp.lang.perl.modules newsgroup).
: and web servers for Win95?
This is the Perl newsgroup. Perl does not have a "server".
There are other newsgroups for discussing that, such as:
comp.infosystems.www.servers.ms-windows
: Is there something like cuting and pasting code [modules] and building
: applications?
: Since I guess noone will have the time to spend writing me a reply: Is
: there a a FAQ for me to read somewhere?
>From the Perl FAQ, part 9:
-------------------------------------
=head2 My CGI script runs from the command line but not the browser.
Can you help me fix it?
Sure, but you probably can't afford our contracting rates :-)
Seriously, if you can demonstrate that you've read the following FAQs
and that your problem isn't something simple that can be easily
answered, you'll probably receive a courteous and useful reply to your
question if you post it on comp.infosystems.www.authoring.cgi (if it's
something to do with HTTP, HTML, or the CGI protocols). Questions that
appear to be Perl questions but are really CGI ones that are posted to
comp.lang.perl.misc may not be so well received.
The useful FAQs are:
http://www.perl.com/perl/faq/idiots-guide.html
http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
http://www.perl.com/perl/faq/perl-cgi-faq.html
http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
http://www.boutell.com/faq/
-------------------------------------
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 2 Nov 1997 22:23:54 GMT
From: "Matthias Hellmund" <matthias.hellmund@nienburg-weser.de>
Subject: realtime output - HELP ME PLEASE!!!
Message-Id: <01bce705$7b9d7260$0100a8c0@o63hutef>
HELP ME PLEASE ! ! !
I have been asking this question many times in many newsgroups but I still
haven't got a way to solve my problem.
Why does the line-by-line output of this perl-script only work with
Netscape Navigator? Netscape's browser prints one line, pauses, prints one
more line, pauses again and so on.
Why does this not work with Microsoft Internet Explorer (I tried version
3.02 for Win95)? MS IE waits until the script has finished sending the
lines and THEN prints all lines in one flush. Pretty bad for a chat-system
for example where the message-output must be realtime, isn't it?
#### perl-script ######
#!/usr/bin/perl
print "HTTP/1.0 200 OK\n"; # NPH-file with Linux-Apachee-Server
print "Content-Type: text/html\n\n";
$|=1; # unbuffered Output
print "<HTML><HEAD><TITLE>line by line output test</TITLE></HEAD><BODY>\n";
print "line 1<br>\n";
sleep 2;
print "line 2<br>\n";
sleep 2;
print "line 3<br>\n";
sleep 2;
print "line 4<br>\n";
sleep 2;
print "line 5<br>\n";
sleep 2;
print "line 6<br>\n";
sleep 2;
print "line 7<br>\n";
## Output:##
HTTP/1.0 200 OK
Content-Type: text/html
<HTML><HEAD><TITLE>line by line output test</TITLE></HEAD><BODY>
line 1
line 2
line 3
line 4
line 5
line 6
line 7
Is the header wrong or where is the problem?
You can execute the script at
http://195.4.19.9/~hellmund/cgi-bin/nph-lines.pl
Please help me! Microsoft obviously can't (no reply). And I know there must
be a way to get this realtime line-by-line output running with MS IE. The
chatcafe at http://www.west.de makes it.
E-mail-replies appreciated.
CU
Matthias
--
Matthias Hellmund
E-Mail: matthias.hellmund@nienburg-weser.de
Homepage: http://www.nienburg-weser.de/~hellmund
CAT-NET: http://www.nienburg-weser.de/ev.jugend/cat-net
------------------------------
Date: 2 Nov 1997 22:24:41 GMT
From: "Matthias Hellmund" <matthias.hellmund@nienburg-weser.de>
Subject: realtime output: HELP ME PLEASE ! ! !
Message-Id: <01bce705$d44cffc0$0100a8c0@o63hutef>
HELP ME PLEASE ! ! !
I have been asking this question many times in many newsgroups but I still
haven't got a way to solve my problem.
Why does the line-by-line output of this perl-script only work with
Netscape Navigator? Netscape's browser prints one line, pauses, prints one
more line, pauses again and so on.
Why does this not work with Microsoft Internet Explorer (I tried version
3.02 for Win95)? MS IE waits until the script has finished sending the
lines and THEN prints all lines in one flush. Pretty bad for a chat-system
for example where the message-output must be realtime, isn't it?
#### perl-script ######
#!/usr/bin/perl
print "HTTP/1.0 200 OK\n"; # NPH-file with Linux-Apachee-Server
print "Content-Type: text/html\n\n";
$|=1; # unbuffered Output
print "<HTML><HEAD><TITLE>line by line output test</TITLE></HEAD><BODY>\n";
print "line 1<br>\n";
sleep 2;
print "line 2<br>\n";
sleep 2;
print "line 3<br>\n";
sleep 2;
print "line 4<br>\n";
sleep 2;
print "line 5<br>\n";
sleep 2;
print "line 6<br>\n";
sleep 2;
print "line 7<br>\n";
## Output:##
HTTP/1.0 200 OK
Content-Type: text/html
<HTML><HEAD><TITLE>line by line output test</TITLE></HEAD><BODY>
line 1
line 2
line 3
line 4
line 5
line 6
line 7
Is the header wrong or where is the problem?
You can execute the script at
http://195.4.19.9/~hellmund/cgi-bin/nph-lines.pl
Please help me! Microsoft obviously can't (no reply). And I know there must
be a way to get this realtime line-by-line output running with MS IE. The
chatcafe at http://www.west.de makes it.
E-mail-replies appreciated.
CU
Matthias
--
Matthias Hellmund
E-Mail: matthias.hellmund@nienburg-weser.de
Homepage: http://www.nienburg-weser.de/~hellmund
CAT-NET: http://www.nienburg-weser.de/ev.jugend/cat-net
------------------------------
Date: Sun, 2 Nov 1997 16:37:50 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Replacing a string in several files.
Message-Id: <ubvi36.8j7.ln@localhost>
Uwe Hauck (PBUhauck@t-online.de) wrote:
: I am searching for a routine that will go through all files an a
: directory and its subdirectories
: and search for string A to replace it with string B in all the files.
: Anyone has such a perl script ?
: Where can I find it ?
: Can anyone give me hints on writing it ?
^^^^^^^^^^^^^^^^^^^
The File::Find module and
the -p and -i command line switches (documented in the perlrun man page)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Nov 1997 02:03:46 GMT
From: "Al" <BBDOG@worldnet.att.net>
Subject: Simple console program
Message-Id: <63jbe2$5o1@bgtnsc03.worldnet.att.net>
Can someone please send me a sample perl source code for a DOS console
program that says "Hello!". I want to compare different programming
languages. Email to BBDog@worldnet.att.net.
------------------------------
Date: 3 Nov 1997 01:08:22 GMT
From: frontlist@mindspring.com (Marc Brodsky)
Subject: wanted: perl consultant
Message-Id: <frontlist-0211972012580001@user-38lc5s5.dialup.mindspring.com>
I am looking for someone very familiar with perl and its use with websites
to be a consultant for a site that has already been designed and is up and
running. Please respond via email to Marc at mbrodsky@acpub.duke.edu.
Thanks.
------------------------------
Date: Sun, 02 Nov 1997 22:33:08 GMT
From: over@the.net (dave)
Subject: Re: What to do with Bitwise operators?
Message-Id: <345cfe76.5885817@news.one.net>
tmalloy@boley.escape.com () wrote:
>Hi. First, I am beginner just learning perl. Can someone provide
> an explaination of the practical use of bitwise operators.
> ( &, |, ^, ~, <<,>>)
>Please note that I am not asking for an explaination of what the operators
> do. I can read. It is just difficult for me to envision any practical
> use for them. In what situation might I need to use them They must have
> some utility. I just don't see it. I would like to understand.
>Perhaps I could be referred to some example code.
> Thank you for any assistance.
>
Good question. In C, I would typically OR bit masks to select modes/options
etc. But it's so easy to parse strings in Perl that I use string sequences of
option selection characters. For example, "ne" to indicate northeast, or "rw"
to indicate read/write.
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________
------------------------------
Date: Sun, 02 Nov 97 20:35:43 -0500
From: samdie@ibm.net
Subject: Re: What to do with Bitwise operators?
Message-Id: <345d2ec6$1$fnzqvr$mr2ice@news-s01.ny.us.ibm.net>
In <345cfe76.5885817@news.one.net>, on 11/02/97
at 10:33 PM, over@the.net (dave) said:
> tmalloy@boley.escape.com () wrote:
> > an explaination of the practical use of bitwise operators.
> > ( &, |, ^, ~, <<,>>)
> > It is just difficult for me to envision any practical
> > use for them. In what situation might I need to use them They must have
> > some utility. I just don't see it.
> Good question. In C, I would typically OR bit masks to select modes/options
> etc. But it's so easy to parse strings in Perl that I use string sequences
> of option selection characters. For example, "ne" to indicate northeast, or
> "rw" to indicate read/write.
Cryptographic functions are frequently defined in terms of bitwise (usually
exclusive-or) functions. [This is not the sort of application one would be
likely to do in Perl, however.]
For heavy-duty set theoretic operations (membership, union, intersection,
etc.) bitwise operations are the implementation method of choice. With each
bit representing a (potential) member of the set, one handles 16, 32, 64, etc.
(depending on the word width of the underlying architecture) members in
parallel.
--
-----------------------------------------------------------
samdie@ibm.net 199711020835 -0500
------------------------------
Date: Mon, 03 Nov 1997 12:29:32 +1100
From: Jaime Metcher <metcher@no.junk.mail>
Subject: Win32/16: Using perl as NT logon script processor
Message-Id: <345D28FC.3FFDFA0F@no.junk.mail>
Just in case anyone is interested...
Summary:
Below is a batch file which will load perl with a script from the same
directory (on the same server) as the batch file.
Detail:
One problem with using perl as the logon script processor in an NT
network is that you can't add command line parameters to the name of the
logon script. If you set the logon script to be logon.pl, Windows will
say "Huh?", and if you set the logon script to be perl.exe, perl will do
likewise (no default script name). In other words, you can't give perl
the name of the script.
Well, let's start perl from a batch file. Set the logon script to be
logon.bat, then we can start perl from the batch file with as many
parameters as we like. The problem here is that we don't necessarily
know from where the logon batch file was loaded. My NT domain has
several servers separated by slow ISDN links. You don't want to load a
script from the wrong server, as it would take far too long. We need to
load the script from the same server that is processing the logon
request.
Of course, with NTWS, this is a snap. The following solution works with
Win95 and WfW given suitable perl interpreters in the Netlogon share of
the NT server(s).
The script/batch file relies on three nifty things. One is that it is
possible to write a file that will parse and execute under both perl and
COMMAND.COM. The second is that both perl and COMMAND.COM let the
script know its own name ($0 and %0 respectively). The third (and here
comes the shonky bit) is that COMMAND.COM interprets filename\.. to be
the directory containing filename. E.g. "c:\windows\win.com\.." is
exactly the same as "c:\windows". To be slightly more ridiculous,
"c:\windows\win.com\..\win.com" is the same as "c:\windows\win.com".
The script/batch file (saved as logon.bat):
-- begin script
------------------------------------------------------------------
goto begin ;
# Miracle of miracles! The above line parses in both
# DOS batch language and perl, but goes to different places in each.
# This is perl's begin label
# The perl script is executed on the second pass through this file.
# It's earlier in the file because COMMAND.COM has no precompiler stage,
and will
# skip straight over the perl stuff without trying to parse it. Unless
I can get
# perl's __BEGIN__ notation to work, the reverse isn't true.
begin:
# The perl logon script can go here. This means you can have just the
one
# script file.
# I actually load another script instead (partly for historical
reasons).
# The point is that if there's any kind of decision making to be done
# about what script to load and from where, it's far easier to do it in
perl.
# Find the path to the logon script
$logonpath = $0; # The name of this script
$logonpath =~ s/\\[^\\]*$//; # chop off anything after the last \
# Add it to the include search path along with the \code subdirectory
unshift (@INC, $logonpath, "$logonpath\\code");
# load and execute the real logon script
require "logon.pl";
# This is an end of script marker for perl. perl neither parses nor
executes
# anything after this.
__END__
This is COMMAND.COM's begin label. COMMAND.COM couldn't give a hoot
about what appears between the goto command and here, so long as it
doesn't look like a label.
:begin
echo off
%0\..\tools\putinenv L
REM We find out which version of Windows we're running
REM by examining the redirector version which has been put
REM into the environment for us by putinenv
REM Run the right version of perl with this file as the script
REM We could just say "%0\..\perl %0\..\logon.pl", but this technique
REM caters for people who want just the one script.
if %major%==4 %0\..\perl %0
if %major%==2 %0\..\bperl %0
pause
-- end script
----------------------------------------------------------------------
Hope you like it.
Jaime Metcher
------------------------------
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 1263
**************************************