[16009] in Perl-Users-Digest
Perl-Users Digest, Issue: 3421 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 19 14:09:00 2000
Date: Mon, 19 Jun 2000 11:05:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961437917-v9-i3421@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 19 Jun 2000 Volume: 9 Number: 3421
Today's topics:
Re: arp cache <rootbeer@redcat.com>
Re: Crazy enough that it might just work... <altavistaNOalSPAM@agentkhaki.com.invalid>
Re: Crazy enough that it might just work... (David H. Adler)
Re: Crazy enough that it might just work... (David H. Adler)
Re: Current time minus file's datestamp time <abe@ztreet.demon.nl>
Re: Current time minus file's datestamp time <abe@ztreet.demon.nl>
Re: Determining Dates nobull@mail.com
Re: Doing the scanf %d thing <rootbeer@redcat.com>
Re: Emacs And Perl <thunderbear@bigfoot.com>
Re: flock on dbmopen <rootbeer@redcat.com>
Re: How to send files across the internet? (Malcolm Dew-Jones)
Re: How to send files across the internet? <tony_curtis32@yahoo.com>
Re: install and use POP3Client <rootbeer@redcat.com>
Re: Java Embedded In Perl <brent.schenk@home.com>
Re: Monitor a process like Unix top But should be Perl/ <care227@attglobal.net>
Re: Monitor a process like Unix top But should be Perl/ <care227@attglobal.net>
Re: Monitor a process like Unix top But should be Perl/ (Randal L. Schwartz)
Re: Need help with timelocal <rootbeer@redcat.com>
Need regexp pattern to verify a password is strong <danielreadNOdaSPAM@excite.com.invalid>
Re: Need regexp pattern to verify a password is strong <blah@nospam.com>
Re: Need regexp pattern to verify a password is strong <aqumsieh@hyperchip.com>
Re: Net::NNTP question. <rootbeer@redcat.com>
Re: Newbie: Deleting lines in a file (Malcolm Dew-Jones)
Re: Newbie: Deleting lines in a file <lr@hpl.hp.com>
Re: Newlines again, was Re: Ugh (Bart Lateur)
Re: NT or Unix at runtime <rootbeer@redcat.com>
Re: Outputting a page bit by bit... nobull@mail.com
Re: Outputting a page bit by bit... <rootbeer@redcat.com>
Passing 'undef' TO an XSUB <vikas@navya.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Jun 2000 10:42:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: arp cache
Message-Id: <Pine.GSO.4.10.10006191041300.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, S.Shanmuganathan wrote:
> I want to write a utility to clear the arp cache in Perl. Is there
> any SNMP command for this??? or Is there any MIB variables which can
> be set ???
If there are, they're the same whether you're working with Perl or not.
Maybe you want to search for the docs, FAQs, and newsgroups about SNMP.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 19 Jun 2000 09:25:39 -0700
From: Agentkhaki <altavistaNOalSPAM@agentkhaki.com.invalid>
Subject: Re: Crazy enough that it might just work...
Message-Id: <0eb446b1.6dbb36ef@usw-ex0108-061.remarq.com>
Gee, that was mature. "HTML Programming is impossible..."
Blah, Blah, Blah... I think my point was made. Fine, maybe
the world doesn't think of sitting down and writing out an
extensive HTML document, trying to find the best, most
efficient way to get it working, making the Javascript and
whatever else you're using work properly (sounds a lot like
"programming" to me...). Whatever, at least if you think
you're such a hot shot you could show some maturity. Guess
not... And I'm sorry about this flame. I'm sure it's not
too mature in and of itself, but stupidity begets, well,
stupidity.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: 19 Jun 2000 17:25:50 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Crazy enough that it might just work...
Message-Id: <slrn8kslst.i5i.dha@panix6.panix.com>
On Mon, 19 Jun 2000 04:52:18 +0930, Henry <henry@penninkilampi.net> wrote:
>In article <slrn8kq7a3.4ba.dha@panix6.panix.com>, dha@panix.com (David
>H. Adler) wrote:
>> The difficulties arise from the
>> fact that there are many people who don't know the recognized
>> standards/methods for certain things. Specifically, the methods used
>> to read documentation and the standards of usenet.
>
>True, but...
>
>If an infant doesn't know how to talk, do parents give up trying to
>teach them?
Well, to follow this analogy, should they tell the infant "go away for
a week or so and when you come back, maybe we'll help you"? :-/
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"i don't play lead. it interferes with my drinking." - Malcolm Young
------------------------------
Date: 19 Jun 2000 17:31:54 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Crazy enough that it might just work...
Message-Id: <slrn8ksm8a.i5i.dha@panix6.panix.com>
On Mon, 19 Jun 2000 12:55:16 +0930, Henry <henry@penninkilampi.net> wrote:
>
>Nope, the other way round. I start hallucinating after 65-odd hours
>without sleep (which happens suprisingly often). But in-between the
>weird stuff, there are extended periods of _extreme_ clarity - that's
>when the really good stuff gels (ethics, philosophy, and so-on).
Speaking as a philosopher, I feel obliged to point out that, given the
admission of hallucinations due to lack of sleep, you are on somewhat
shaky ground when assessing periods of this lack of sleep to be of
"_extreme_ clarity". :-)
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"A Marine that says 'gee whiz'? What's he gonna do, storm the
Cunningham house?" - mst3k
------------------------------
Date: Mon, 19 Jun 2000 17:21:26 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Current time minus file's datestamp time
Message-Id: <hgdskssvmvg91m1ugtat38bis0ph8gt0fh@4ax.com>
On 19 Jun 2000 10:45:12 GMT, Steffen Beyer <sb@muccpu1.muc.sdm.de>
wrote:
...
> use Date::Calc qw(:all);
...
> @date = (localtime($time))[5,4,3,2,1,0];
> $date[0] += 1900;
> $date[1]++;
> @diff = Delta_DHMS(@date,Today_and_Now());
> $diff = ((((($diff[0] * 24) + $diff[1]) * 60) + $diff[2]) * 60) + $diff[2];
> next FILE if ($diff < 3600) # 3600 secs = 1 hour
That looks like _huge_ overkill for this (and a typo):
next if time()-$time < 3600;
Besides that, it doesn't answer the original question.
--
Good luck,
Abe
------------------------------
Date: Mon, 19 Jun 2000 17:23:39 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Current time minus file's datestamp time
Message-Id: <bkesks4nj1imqep2p48c87h2i5e5t62lcd@4ax.com>
On Sat, 17 Jun 2000 21:56:42 -0400, Julian Cook/Sherab Gyatso
<president@webticker.com> wrote:
> Howdy folks!
> I have posted a few questions here and everyone is very helpful. My
> quandry
> right now is checking a file's date and then update it if it's older
> than an hour.
> We keep a text file that is updated once a day manually but we would
> like to make
> this automatic by a time check routine.
>
> That is
>
> 1. Check current time
> 2. Subtract file's last modified time
> 3. Older than an hour?
> Yes - Start Update Routine
This looks more like a job for some schedualar service (crontab/at).
--
Good luck,
Abe
------------------------------
Date: 19 Jun 2000 17:45:53 +0100
From: nobull@mail.com
Subject: Re: Determining Dates
Message-Id: <u9zoohfwla.fsf@wcl-l.bham.ac.uk>
reedjd@bitsmart.com writes:
> I'm attempting to write a Perl program that can determine if it is the
> last weekday of the month.
That's maybe the case but I do not believe that your difficulty is
actually Perl-related.
> Obviously I can use localtime(time) to figure out what day of the month
> it is and if it's a weekday or not, but is there any way in Perl to
> determine the total number of days a month taking leap years into
> account?
Well... given the localtime() and time() functions here's one way.
Please note I've coded this in Perl because this is a Perl newsgroup -
I still consider your question not to be Perl related as the answer
would be the basically same in C or any other language.
#!/usr/bin/perl -w
use strict;
# Using several redundant intermediate variables to aid readability.
my $now=time;
my ($hour,$mday,$wday) = (localtime($now))[2,3,6];
# Must go noon-ish to avoid any DST complications.
my $noonish_on_32nd_of_this_month =
$now + 3600 * ( 12 - $hour + 24 * ( 32 - $mday));
my $real_mday_of_32nd_of_this_month =
(localtime($noonish_on_32nd_of_this_month))[3];
my $days_this_month = 32 - $real_mday_of_32nd_of_this_month;
print $days_this_month;
__END__
BTW: There is a more direct approach to know if today is the last
weekday of the month - simply check that the next weekday is next
month!
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 19 Jun 2000 10:03:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Doing the scanf %d thing
Message-Id: <Pine.GSO.4.10.10006191002150.29843-100000@user2.teleport.com>
On 19 Jun 2000, Norman Gaywood wrote:
> I need something that does the same thing as C's scanf family of
> functions when reading numbers from a file. That is, it skips spaces
> and newlines until you get how many numbers you asked for.
That's a pattern match, maybe used in a loop. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 19 Jun 2000 17:47:19 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Emacs And Perl
Message-Id: <394E4087.AB6B721D@bigfoot.com>
spurcell wrote:
>
> Hello,
> I would like to know if anyone is using Emacs, and if they have the product
> configured to debug Perl?
A modern Emacs has Perl support built in.
Try "ESC x perldb RETURN" when you have started Emacs.
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: Mon, 19 Jun 2000 10:01:33 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: flock on dbmopen
Message-Id: <Pine.GSO.4.10.10006190955570.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, John Lin wrote:
> I use 'dbmopen' in a multi-access application (such as web-CGI).
> Perl doesn't seem to provide locking for 'dbmopen'.
> If I don't lock it, will there be race conditions?
Yes. You should generally use flock() on an auxiliary file when using
dbmopen in this way. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 2000 10:16:52 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: How to send files across the internet?
Message-Id: <394e5584@news.victoria.tc.ca>
Craig Berry (cberry@cinenet.net) wrote:
: Shruti (shantha@socal.rr.com) wrote:
: : I guess I did not make myself clear.
: :
: : I would like to know if there is a way for the server side cgi to do the
: : job. I do not want to write client side programs.
: We understood. Abigail's point was that the available 'ways' -- FTP,
: HTTP, and so forth -- don't depend on your choice of Perl as an
: implementation language, so your post could be considered off-topic for
: this newsgroup.
: Were I you, I'd be looking at the Net::FTP module.
No, the first clue is "mime type", and the second clue is
print "Content-type: text/html\n\n";
------------------------------
Date: 19 Jun 2000 12:24:27 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to send files across the internet?
Message-Id: <87em5ttwhg.fsf@limey.hpcc.uh.edu>
>> On 19 Jun 2000 10:16:52 -0800,
>> yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) said:
> Craig Berry (cberry@cinenet.net) wrote: : Shruti
> (shantha@socal.rr.com) wrote: : : I guess I did not make
> myself clear. : : : : I would like to know if there is
> a way for the server side cgi to do the : : job. I do
> not want to write client side programs.
> : We understood. Abigail's point was that the available
> 'ways' -- FTP, : HTTP, and so forth -- don't depend on
> your choice of Perl as an : implementation language, so
> your post could be considered off-topic for : this
> newsgroup.
> : Were I you, I'd be looking at the Net::FTP module.
> No, the first clue is "mime type", and the second clue
> is print "Content-type: text/html\n\n";
Which (a) has no perl relevance since it can be done in
any language that can do CGI, and (b) is missing the point
of what the OP was trying to do anyway.
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Mon, 19 Jun 2000 10:13:14 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: install and use POP3Client
Message-Id: <Pine.GSO.4.10.10006191008580.29843-100000@user2.teleport.com>
On Thu, 15 Jun 2000, PC Leung wrote:
> make: *** Warning: Clock skew detected. Your build may be incomplete.
I'm not sure what your 'make' means by that; does its manpage tell you
anything about that? I'd guess that it means that you either have some
files with future timestamps, or your system clock was running backwards
during the build. Either way, it has the potential to be a serious
problem.
> (2)When I 'make test', there are messages as follows.
>
> Use of uninitialized value at t/poptest.t line 32.
> ok
> All tests successful.
Well, that's ambiguous. You should probably examine the test and determine
whether that warning should be ignored or not, then send a patch to the
module's author to fix the test accordingly.
> (4) If I run a perl program using POP3Client,
>
> Can't locate Mail/POP3Client.pm in @INC (@INC contains:
It's not installed (or not properly installed) along the @INC paths.
Either 'use lib' or re-install it.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 19 Jun 2000 10:29:28 -0500
From: "Brent Schenk" <brent.schenk@home.com>
Subject: Re: Java Embedded In Perl
Message-Id: <394e3bcc.0@news>
hey, that worked like a charm! Thanks a lot!
Daniel van den Oord <danielxx@bart.nl> wrote in message
news:4Bq35.2498$%h3.39114@Typhoon.bART.nl...
> Try to put a full path to the class files in the codebase="./"
>
> "Brent Schenk" <brent.schenk@home.com> schreef in bericht
> news:394e1a30.0@news...
> > I have written a perl script that is for a webpage. Anways, this page
> > contains some calls to java applets. The html page will print out but
the
> > java applets will say java applet not found and it is right where it is
> > looking. Could someone tell me what is going on? Here is a sample of
the
> > code:
> >
> > print "Content-type: text/html\n\n";
> > print qq|
> > <html>
> >
> > <head>
> > <title>This is where the content goes</title>
> > <style fprolloverstyle>A:hover {color: #FFFF00; font-weight: bold}
> > </style>
> > </head>
> >
> > <body stylesrc="../index2.html" background="../../../bg.jpg">
> >
> > <table border="0" width="100%" cellspacing="0" cellpadding="0">
> > <tr>
> > <td width="15%" valign="top"><table border="0" width="100%"
> > cellspacing="0" cellpadding="0">
> > <tr>
> > <td width="100%"><b><font color="#FFFFFF">Job
> > Opportunities</font></b></td>
> > </tr>
> > <tr>
> > <td width="100%">
> > <p>
> > <applet code="fphover.class" codebase="./" width="143"
height="20">
> > <param name="hovercolor" value="#FFFF00">
> > <param name="font" value="Helvetica">
> > <param name="fontstyle" value="bold">
> > <param name="fontsize" value="14">
> > <param name="url" valuetype="ref"
> >
>
value="http://www.contactpdi.com/job_opportunities/descriptions/index.html">
> > <param name="text" value="Job Descriptions">
> > <param name="color" value="#000000">
> > <param name="textcolor" value="#FFFFFF">
> > <param name="effect" value="glow">
> > </applet>
> >
> > That is for one call to one java applet. Thanks alot,
> > Brent "ProtoFrag" Schenk
> >
> >
>
>
------------------------------
Date: Mon, 19 Jun 2000 11:16:52 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Monitor a process like Unix top But should be Perl/tk How?
Message-Id: <394E3964.75BB5883@attglobal.net>
"Charles W.W." wrote:
>
> I must have it in GUI perl/tk window or widget .
You actually expect to come here, post a blank message and
have someone develop this for you, for free, don't you?
Some nerve.
------------------------------
Date: Mon, 19 Jun 2000 11:17:46 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Monitor a process like Unix top But should be Perl/tk How?
Message-Id: <394E399A.2173A094@attglobal.net>
"Charles W.W." wrote:
>
>
> JAPH
^^^^
Somehow I have my doubts.
------------------------------
Date: 19 Jun 2000 08:40:48 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Monitor a process like Unix top But should be Perl/tk How?
Message-Id: <m11z1tbrwf.fsf@halfdome.holdit.com>
>>>>> "Drew" == Drew Simonis <care227@attglobal.net> writes:
Drew> "Charles W.W." wrote:
>>
>>
>> JAPH
Drew> ^^^^
Drew> Somehow I have my doubts.
Yeah, it was sorta cute when that actually meant something, eh? :)
Just the *original* JAPH,
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 19 Jun 2000 10:27:29 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need help with timelocal
Message-Id: <Pine.GSO.4.10.10006191026460.29843-100000@user2.teleport.com>
On 19 Jun 2000, Jonathan Stowe wrote:
> > Download a good module like Date::Calc, cut the code, paste it into
> > your program.
> I would guess that he wouldnt want to try that with Date::Calc as the
> module is largely XS code ;-}
Oops! You're right; I was thinking of Date::Manip. Oh, well!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 19 Jun 2000 08:18:48 -0700
From: Daniel Read <danielreadNOdaSPAM@excite.com.invalid>
Subject: Need regexp pattern to verify a password is strong
Message-Id: <2092b1e7.92f069b2@usw-ex0102-015.remarq.com>
Hello,
Hoping someone can help. I've been doing a lot of reading on
regular expressions, I've scoured the net, and I've searched
this group's archives, but I can't seem to get to the
information I need. I think I'm going to need to purchase the
O'Reilly Regular Expressions book in order to get myself up to
speed, but I could really use someone's help today.
What I need to do is come up with a pattern to match on to
ensure that a password that a user is creating for himself is
strong. For example, we have rules such as "must be at least
six characters", "must contain at least one number", "must
contain at least one lower case letter", "must contain at least
one upper case letter", and "must contain at least one special
character (e.g. #, %, $, *)". What has been difficult for me is
finding a way to make the pattern not be dependent upon the
order of the characters. For example, I need to make sure
there's at least one number, but I don't care where in the
string it is. Same for the other rules: I don't care about the
order that the characters are in, just that a certain number,
character, etc. is somewhere in the string. How is this done?
Any help, suggested patterns, or links to resources would be
greatly appreciated.
Dan Read
Atlanta, GA
If you prefer to e-mail: danielreadXX@yahoo.com (remove the XX)
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 19 Jun 2000 17:37:10 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <394E3E26.60C938F5@nospam.com>
Daniel,
Daniel Read wrote:
> Hoping someone can help.
[snip]
> For example, we have rules such as "must be at least six
> characters", "must contain at least one number", "must contain
> at least one lower case letter", "must contain at least one upper
> case letter", and "must contain at least one special character
> (e.g. #, %, $, *)".
Examine one condition per time:
<code>
if (length ($pass)<6) {
print "must be at least six characters"
}
elsif ($pass!~/\d+/) {
print "must contain at least one number"
}
elsif ($pass!~/[a-z]+/) {
print "must contain at least one lower case letter"
}
elsif ($pass!~/[A-Z]+/) {
print "must contain at least one upper case letter"
}
elsif ($pass!~/[<list_of_special_characters>]+/) {
print "must contain at least one special character"
}
else {
print "seems good to me"
}
</code>
Not even good things are the most twisted ones. ;)
Best regards,
Marco
------------------------------
Date: Mon, 19 Jun 2000 16:12:50 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Need regexp pattern to verify a password is strong
Message-Id: <7a8zw1y7i4.fsf@merlin.hyperchip.com>
Daniel Read <danielreadNOdaSPAM@excite.com.invalid> writes:
> What I need to do is come up with a pattern to match on to
> ensure that a password that a user is creating for himself is
> strong. For example, we have rules such as "must be at least
> six characters", "must contain at least one number", "must
> contain at least one lower case letter", "must contain at least
> one upper case letter", and "must contain at least one special
> character (e.g. #, %, $, *)".
unless (
length $pass >= 6 and
$pass =~ tr/0-9// and
$pass =~ tr/a-z// and
$pass =~ tr/A-Z// and
$pass =~ tr/a-zA-Z0-9_//c
) {
print "BAD PASSWORD!\n";
}
--Ala
------------------------------
Date: Mon, 19 Jun 2000 10:08:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Net::NNTP question.
Message-Id: <Pine.GSO.4.10.10006191005390.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, DougW wrote:
> Using Activestate perl and Net::NNTP
>
> So far I have been able to post (easy)
> but I need an example of how to interact.
Between the docs for Net::NNTP and RFC-977, I don't know what more you
want.
> The goal is a bot that searches a specific news group for a REQ:
> (request) then fills that request.
You're new here, aren't you. :-)
> To that end I'd also appreciate it if someone could
> point me to a UUEncode/UUDecode library. I could
> code it myself but I'd rather not.
Then you should look on CPAN.
http://search.cpan.org/
> Oh, the email address in my post is bogus.
> Sorry, I get entirely too much spam as it is.
Odd. My real address is on my postings, but I spend more time each week
dealing with _paper_ junk mail. I doubt that hiding your address helps you
as much as you think.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 2000 10:19:32 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Newbie: Deleting lines in a file
Message-Id: <394e5624@news.victoria.tc.ca>
Killo (iam007@gofree.indigo.ie) wrote:
: Is there any fuction or easy enough method to delete lines at the
: beginning of a text file.
: Thanks
As a pipe, remove the first line. (untested)
#!perl
@file=<STDIN>;
shift @file;
print @file;
------------------------------
Date: Mon, 19 Jun 2000 10:49:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie: Deleting lines in a file
Message-Id: <MPG.13b7fd0ff520073f98ab9c@nntp.hpl.hp.com>
In article <394e5624@news.victoria.tc.ca> on 19 Jun 2000 10:19:32 -0800,
Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> says...
> Killo (iam007@gofree.indigo.ie) wrote:
> : Is there any fuction or easy enough method to delete lines at the
> : beginning of a text file.
> : Thanks
>
> As a pipe, remove the first line. (untested)
>
> #!perl
> @file=<STDIN>;
> shift @file;
> print @file;
There is nothing there that justifies reading the entire file into
memory before dealing with it.
<>; # Read and discard the first line.
print while <>; # Read and write each of the remaining lines.
The general answer to the question is in perlfaq5: "How do I change one
line in a file/delete a line in a file/insert a line in the middle of a
file/append to the beginning of a file"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Jun 2000 15:56:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Newlines again, was Re: Ugh
Message-Id: <394f3012.6209765@news.skynet.be>
jason wrote:
>is there some confusion with my use of the phrase "on Windows" ?? .. get
>some context - this thread was originated by someone who was developing
>on Windows and then transporting their code to UNIX
Yes, but you didn't way whether the conversion was done on Unix or on
PC. Both are possible.
>nothing that you or Bart have said makes that statement any less useful
>to the originator
The fact that it will fail if done on PC, because of the "\n" ->
"\015\012" magic on text file handles?
Look, if you want to convert PC/DOS files to Unix files (line
terminators only) on a PC, *all* you have to do is:
binmode STDOUT;
while (<>) {
print;
}
But note that this won't work with the -i command line flag, because
STDOUT isn't STDOUT there.
--
Bart.
------------------------------
Date: Mon, 19 Jun 2000 10:37:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: NT or Unix at runtime
Message-Id: <Pine.GSO.4.10.10006191033410.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, Larry R. Waibel wrote:
> I've got some scripts that I want to be able to run on either NT or
> HP-UX. What's the general/accepted/best way for a Perl script to
> determine at run time which OS it's running under?
Have you seen the perlport manpage? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 2000 18:05:01 +0100
From: nobull@mail.com
Subject: Re: Outputting a page bit by bit...
Message-Id: <u9ya41fvpe.fsf@wcl-l.bham.ac.uk>
sbanks <sbanks99NOsbSPAM@yahoo.com.invalid> writes:
> I would like to write a CGI Perl program that will output part
> of the HTML page, so the user can see it's doing something,
> while it works on producing the rest of the page.
>
> I'm finding, though, that nothing is output to the client until
> the whole CGI program is finished.
Make sure that your GCI script is running with STDOUT unbuffered and
that the web client and web server are running HTTP/1.1 (since
HTTP/1.0 sends the length of the response at the start of the
response).
> #!/usr/bin/perl
What no "-w"? :-)
What no "use strict"? :-)
$| = 1; # Unbuffer STDOUT
> print "Content-type:text/html\n\n";
>
> print "<HTML><HEAD></HEAD><BODY>Before sleep...\n";
>
> sleep (10);
>
> print "<P>After sleep...</BODY></HTML>";
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 19 Jun 2000 10:40:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Outputting a page bit by bit...
Message-Id: <Pine.GSO.4.10.10006191038530.29843-100000@user2.teleport.com>
On Mon, 19 Jun 2000, sbanks wrote:
> I would like to write a CGI Perl program that will output part
> of the HTML page, so the user can see it's doing something,
> while it works on producing the rest of the page.
Do that in the same way as you would if it were written in C or any other
language.
> I'm finding, though, that nothing is output to the client until
> the whole CGI program is finished.
Smells like buffering. Have you read about the $| variable in the perlvar
manpage? But maybe your webserver is doing the buffering. In that case,
you'll want to search for the docs, FAQs, and newsgroups about webservers
and CGI programming. Reading comp.infosystems.www.authoring.cgi could help
to get you started.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 19 Jun 2000 13:51:24 -0400
From: Vikas Aggarwal <vikas@navya.com>
Subject: Passing 'undef' TO an XSUB
Message-Id: <394E5D9C.4822382C@navya.com>
I have a perl routine that is invoking an XSUB function.
test(arg1, undef);
and the XSUB (XS) function is:
test(arg1, arg2)
int arg1;
int arg2;
CODE:
....
How can I test if arg2 is set to 'undef' in the xsub? Testing the
integer against a NULL does not seem to be the answer.
I tried:
if (&arg2 == &PL_undef)
but that did not work.
Thanks,
-vikas
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3421
**************************************