[11415] in Perl-Users-Digest
Perl-Users Digest, Issue: 5017 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 1 12:07:36 1999
Date: Mon, 1 Mar 99 09:03: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 Mon, 1 Mar 1999 Volume: 8 Number: 5017
Today's topics:
How to find memory leak (Jennifer Ozzello)
Re: How to find memory leak <lembark@wrkhors.com>
how to get the target info like size, date by libwww? lufan@hotmail.com
How to Read/Block/Write a file at same time dragnovich@my-dejanews.com
Re: How to Read/Block/Write a file at same time <hm@garmisch.net>
Re: HTML::TreeBuilder and $p->warn to validate HTML? <jdf@pobox.com>
I want to use open3(), but... <wfunk@dev.tivoli.com>
Re: I want to use open3(), but... <wfunk@dev.tivoli.com>
IPC::open2 warning? chrissv@my-dejanews.com
Re: Looking for a perl module or script for computer te <gellyfish@btinternet.com>
Re: Looking for a perl/cgi programmer who can maintain <gellyfish@btinternet.com>
Re: Mail Form Handlers <gellyfish@btinternet.com>
Making readable posts (was Re: Getting specfic items in <gellyfish@btinternet.com>
match anything but..? (Peter Bismuti)
Re: match anything but..? (Larry Rosler)
Re: MS/IIS4 and custom errors with a perl script <gellyfish@btinternet.com>
Re: need a clearer explanation of ${1} use in s///i <cook@mediaone.net>
Re: need a clearer explanation of ${1} use in s///i <aqumsieh@matrox.com>
Re: Newbie : bash doesn't want to run my script ! (Tad McClellan)
Re: Newbie : bash doesn't want to run my script ! <baillie@my-dejanews.com>
Re: Newbie question (Andre L.)
Re: Newbie question (Ronald J Kimball)
newbie: How couuld I find my IP? <bodycount@mail.jps.net>
News::NNTPClient 480 Authentication (Phillip George Geiger)
Note Tab lite (Ken )
Re: Offtopic (Was: Re: custom dial script - simple if y <gellyfish@btinternet.com>
Re: PC - UNIX text converter (Tad McClellan)
Re: perl open function <gellyfish@btinternet.com>
Perl script to compare files ben@kesslerconsulting.com
Re: Perl script to compare files <tchrist@mox.perl.com>
Re: Perl script to compare files (Randal L. Schwartz)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Feb 1999 18:35:52 -0800
From: ozzello@best.com (Jennifer Ozzello)
Subject: How to find memory leak
Message-Id: <7bcue8$ql7$1@shell9.ba.best.com>
Hey all,
I was wathcing my code operate under top today and I found that it's
memory size was increasing while it shouldn't have been. I had it
running through the main loop but it should not have been adding
anything new to anything and yet it seemed to gain size with each pass
through the main loop. I'd like to try and find the leak so that the
code is more friendly to its neighbors. Are there tools or techniques
to do this with perl?
Thanks,
Jennifer
------------------------------
Date: Sun, 28 Feb 1999 21:38:01 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: How to find memory leak
Message-Id: <36DA0B99.91718E0D@wrkhors.com>
> I was wathcing my code operate under top today and I found that it's
> memory size was increasing while it shouldn't have been. I had it
> running through the main loop but it should not have been adding
> anything new to anything and yet it seemed to gain size with each pass
> through the main loop. I'd like to try and find the leak so that the
> code is more friendly to its neighbors. Are there tools or techniques
> to do this with perl?
step1 is probably to check the thing out in the debugger. perl
normally `recycles' memory it malloc's from the O/S (i.e., it
won't return the memory but keep it in perl's own free pool).
since perl uses reference counting it's usually pretty good at
getting rid of unused items. catch: if you leave references
lying around they'll keep lexical objects alive. this can be
good (closures) or bad (leaks).
i'd start by making *real* sure that all of your lexical ("my")
variables aren't being referred to by something global or
refering to themselves.
--
Steven Lembark 2930 W. Palmer St.
Workhorse Computing Chicago, IL 60647
lembark@wrkhors.com 800-762-1582
---------------------------------------------------------------------
The opinions expressed here are those of this company.
I am the company.
---------------------------------------------------------------------
------------------------------
Date: Mon, 01 Mar 1999 10:37:32 -0800
From: lufan@hotmail.com
Subject: how to get the target info like size, date by libwww?
Message-Id: <36DADE6C.3760@hotmail.com>
hi,
I need to check the link info rather than catch the whole
file. How can I get the data like file size, update date before
download it ?
thanks in advance ;)
lufan
------------------------------
Date: Mon, 01 Mar 1999 16:10:08 GMT
From: dragnovich@my-dejanews.com
Subject: How to Read/Block/Write a file at same time
Message-Id: <7bee4m$lpa$1@nnrp1.dejanews.com>
Hello .. is the there any way to open a file.. and keep it opened (so no body
can read/write it, until I close the file) read file data modify data and
write the new data in the same file?? Now I use something like this ...
open(FILE,"filename") || die "No file";
@data = <FILE>;
close(FILE);
# DATA PROCESING RUTINES, this process can take from 30 to 90 seconds
open(FILE,">filename") || die "Cant open to write";
foreach $d(@data) { print FILE $d; }
close(FILE);
The point is that I have a very demanded PERL script but some times, it
returns equals values, because the scritpt get some time to make all the
calculations. And if I run an other script during this time, the second
script reads the same old data and returns me the same values, so I need that
the 1st script blocks the file... until it finish the program process.
Is this posible ??
Regards
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 01 Mar 1999 17:49:13 +0100
From: Heiko Marschall <hm@garmisch.net>
Subject: Re: How to Read/Block/Write a file at same time
Message-Id: <36DAC509.51AA78B1@garmisch.net>
Use "sysopen" from the C-Library.
- Heiko -
> Hello .. is the there any way to open a file.. and keep it opened (so no body
> can read/write it, until I close the file) read file data modify data and
> write the new data in the same file?? Now I use something like this ...
>
> open(FILE,"filename") || die "No file";
> @data = <FILE>;
> close(FILE);
>
> # DATA PROCESING RUTINES, this process can take from 30 to 90 seconds
>
> open(FILE,">filename") || die "Cant open to write";
> foreach $d(@data) { print FILE $d; }
> close(FILE);
>
> The point is that I have a very demanded PERL script but some times, it
> returns equals values, because the scritpt get some time to make all the
> calculations. And if I run an other script during this time, the second
> script reads the same old data and returns me the same values, so I need that
> the 1st script blocks the file... until it finish the program process.
--
-------------------------------------------------------------------
Dipl.Phys. Heiko B. Marschall - Geschdftsleitung
MARSCHALL ELECTRONICS GmbH & Co KG
hm@garmisch.net http://www.garmisch.net
Phone: +49 8821 943910-0 Kreuzackerstrasse 2
Fax: +49 8821 943910-99 D-82467 Garmisch-Partenkirchen
------------------------------
Date: 01 Mar 1999 11:09:23 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: moseley@best.com (Bill Moseley)
Subject: Re: HTML::TreeBuilder and $p->warn to validate HTML?
Message-Id: <m3btidkx8s.fsf@joshua.panix.com>
moseley@best.com (Bill Moseley) writes:
> I'm unclear on its use, too. Something like this?
> $h->warn( 1 ) # Call warn() on syntax errors
>
> $SIG{__WARN__} = sub { $Contains_Syntax_Errors++ };
>
> $h->parse( $HTML_Snipit );
Your example is correct, though you may want to
{
local $SIG{__WARN__} = \&some_sub;
$h->parse($whatever);
}
So that other warnings get handled as usual.
The thing that puzzles me is: if you had simply tried it yourself with
some sample data, you would have discovered that it worked. Why not
just try it? That's the best way to answer the question, "does it
work?"!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 28 Feb 1999 19:04:04 -0600
From: "Wade T. Funk" <wfunk@dev.tivoli.com>
Subject: I want to use open3(), but...
Message-Id: <36D9E784.564A61A9@dev.tivoli.com>
I get an error:
Can't locate /IPC.pm in @INC at ./newfile line 2.
BEGIN failed--compilation aborted at ./newfile line 2.
I'm sure one of you has seen this before and I'm sure it's
simple, but I'm new to this and my debugging skills
aren't the greatest yet.
Thanks again for the help,
Wade
------------------------------
Date: Sun, 28 Feb 1999 19:27:58 -0600
From: "Wade T. Funk" <wfunk@dev.tivoli.com>
Subject: Re: I want to use open3(), but...
Message-Id: <36D9ED1E.572FD16B@dev.tivoli.com>
Never mind....I figured it out. Sorry for the unnecessary thread.
Wade...again
"Wade T. Funk" wrote:
> I get an error:
>
> Can't locate /IPC.pm in @INC at ./newfile line 2.
> BEGIN failed--compilation aborted at ./newfile line 2.
>
> I'm sure one of you has seen this before and I'm sure it's
> simple, but I'm new to this and my debugging skills
> aren't the greatest yet.
>
> Thanks again for the help,
>
> Wade
------------------------------
Date: Mon, 01 Mar 1999 02:30:14 GMT
From: chrissv@my-dejanews.com
Subject: IPC::open2 warning?
Message-Id: <7bcu3n$fg4$1@nnrp1.dejanews.com>
I want to use the IPC::open2 function, but read this ominous warning on the
man page:
"It will not create these file handles for you. You have to do this yourself.
So don't pass it empty variables expecting them to get filled in for you."
I am relatively new to PERL - how do I create the file handles? I'm assuming
that the standard 'open' function creates them for me, since I don't do
anything special.
Can somebody give me a perl snippet as to how to create the handles, call
open2, and print to the pipe?
I looked on the web and usenet and couldn't find a good example.
Thanks!
Steven
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Feb 1999 23:22:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Looking for a perl module or script for computer telephony
Message-Id: <7b9unv$3n6$1@gellyfish.btinternet.com>
On Fri, 26 Feb 1999 11:44:50 +0100 Burkhard Kiesel wrote:
> Hi there,
>
> i found a program called SimplyPhone 1.0, where you can directly call a
> phone number from a PC program. The PC is connected to the Internet.
>
> Is there a Perl Module or script available, which does the same thing, means
> I try to put it into a Web-Page for Online Support.
>
Its gotta be SNPP or TAP innit ... ;-P
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 28 Feb 1999 01:38:18 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Looking for a perl/cgi programmer who can maintain a meta search engine
Message-Id: <7ba6ma$3vc$1@gellyfish.btinternet.com>
On Fri, 26 Feb 1999 16:14:20 GMT raj@netpromote.com wrote:
> You're hired if the price is right and you can maintain it.
>
I think the point is that there may be many people here who could
'maintain it' (whatever that means) but 'if the price is right' sounds
like some kind of game show thing with Bob Monkhouse and anyhow your
e-mail address smacks of some spamming thing ...
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 28 Feb 1999 02:35:08 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Mail Form Handlers
Message-Id: <7baa0s$454$1@gellyfish.btinternet.com>
On Thu, 25 Feb 1999 13:47:01 GMT sboucher@msn.com wrote:
> Does anyone know of a form handler suitable for sending large amounts of text
> from a web page using the 'mailto' process.
>
Of course if you use 'mailto:*****' as an action then you dont need a
handler it is all done for you by the browser - you will just get the
www-url-encoded stuff as mail. For more information on this consult a
browser or CGI oriented group.
> Someine was telling me a from handler may be necessary to "Clean up" the text
> to make it easily readable.
>
Er that is possible - but of course you could be doing it in any language
that is capable of supporting the CGI.
> Any other methods of sending mail from a web page greatly appreciated
>
OK. You could check out the resource of my comrade Dave at:
<http://www.mag-sol.com/>
Wherein he has a mailer script.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 28 Feb 1999 01:15:06 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Making readable posts (was Re: Getting specfic items in an array and loop through to all)
Message-Id: <7ba5aq$3ug$1@gellyfish.btinternet.com>
On Fri, 26 Feb 1999 09:48:00 -0500 Bill Chase wrote:
> I think I'm having a mental block. I know this should be simple but this is
> not working. Hopefully one of you perl gurus can straighten me out.
>
> This is the routine after items found and prints them out. Works fine.
>
> sub print_record {
> print "<BR>\n";
> #<!-- this is all 1 line-->
> print "<input type=\"checkbox\" name=\"page_id\" value
> =\"$doc_title,$doc_url\" checked><A
> HREF=\"http:\/\/www.myserver.com\/testscripts\/excerpt.html\"
> target=\"blank\">" . $doc_title . "</A></B>\n";
> #<!-- line ends here-->
>
> }#sub closed
My problem is that once I have seen a post like this with such scruffy
presentation I just switch off and cant really bring myself to do
anything but moan about it - its just too difficult on the eyes.
May I suggest something more like:
sub print_record {
print <<EOHTML;
<BR>
<INPUT TYPE="checkbox"
NAME="page_id"
VALUE="$doc_title,$doc_url" CHECKED>
<A HREF="http://www.myserver.com/testscripts/excerpt.html"
TARGET="blank"> $doc_title </A></B>
EOHTML
}
Now having done that I still dont think there's much we can do to help
you because all of that is perfectly fine in Perl terms - as long as we
assume that $doc_title and $doc_url are global variables.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 28 Feb 1999 01:02:27 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: match anything but..?
Message-Id: <7ba4j3$8cp$1@news.fsu.edu>
while ($document =~ /(\>)([\.\,\:\s_0-9a-zA-Z]*)(?=\<\/font\>\<\/TD\>)/g){
}
I'm matching an expression, the middle term should match any character string
which contain any character EXCEPT for the "<" and ">" characters, how can
this be done???
Thanks again!
_____________________________________________________________________
| |
| Pete Bismuti |
| Department of Computer Science |
| Florida State University |
| bismuti@cs.fsu.edu (850) 644-0516 |
|_____________________________________________________________________|
------------------------------
Date: Sat, 27 Feb 1999 17:41:27 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: match anything but..?
Message-Id: <MPG.11423e9e4cabb789896a9@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7ba4j3$8cp$1@news.fsu.edu>, on 28 Feb 1999 01:02:27 GMT
bismuti@cs.fsu.edu says...
> while ($document =~ /(\>)([\.\,\:\s_0-9a-zA-Z]*)(?=\<\/font\>\<\/TD\>)/g){
>
> I'm matching an expression, the middle term should match any character string
> which contain any character EXCEPT for the "<" and ">" characters, how can
> this be done???
You ought to read perlre a few times -- this is there.
[^<>]*
I would write your regex above with alternate delimiters to avoid all
those backslash escapes, many of which are just superstitious:
while ($document =~ m%>([^<>]*)(?=</font></TD>)%gi) {
I dropped the capture of the leading '>' (why capture a constant into
a variable?). and I added the 'i' modifier because HTML tags are not
case sensitive.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 28 Feb 1999 00:47:11 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: MS/IIS4 and custom errors with a perl script
Message-Id: <7ba3mf$3u7$1@gellyfish.btinternet.com>
On 26 Feb 99 19:04:52 GMT Thierry Masson wrote:
> Hello,
>
> On a Apache/Unix server (SGI IRIX 6.5), I trap the HTML ERROR 404 to a perl
> script.
>
> Here is a simple Perl Script :
> print "HTTP/1.0 200 OK\r\n" if $ENV{PERLXS} eq "PerlIS" ; # For MS/IIS
> web server
> print "Content-type: text/html\n\n" ;
> while(($key,$val)=each %ENV) {
> print "$key=$val<br>\n" ; }
>
> When I ask for an non-existing page, I receive the env. variables. Among
> them :
> REQUEST_URI = /doc/non-existingpage.htm
> HTTP_HOST = sysil.noh.be.solvay.com:8888
> SCRIPT_FILENAME = /usr/local/apache/share/cgi-bin/printenv
> SERVER_PORT = 8888
> REMOTE_PORT = 1192
> REMOTE_ADDR = 195.251.99.134
> .... many others
>
> With this behaviour, I can get the requested page (REQUEST_URI)
>
>
> When I try the same thing on a MS/IIS4 server (Perl 5.003_07) using the
> Customs errors (404 error is mapped to a URL=/cgi-bin/printenv), I only
> have this single variable :
>
> PERLXS=PerlIS
>
> It sounds like the error code lauche the Perl script in another environment
> space.
>
> Thus anybody get an idea ?
>
Whilst I wouldnt want to sound intolerant or anything - I would suggest
that this question is best asked in a group that is actually interested
in the workings of various HTTP servers or perhaps in CGI as I dont think
that this has any thing to do with Perl per-se , the answer would be the
same if the Error routine was written in any language I fear.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 28 Feb 1999 08:47:38 -0500
From: edgar <cook@mediaone.net>
Subject: Re: need a clearer explanation of ${1} use in s///i
Message-Id: <36D948FA.DF571662@mediaone.net>
> > still slighly confused but I'm reading the perldoc perlre and trying
> > examples.
>
> ${1} is the same as $1 .. it has nothing to do with perlre. IIRC, for
> every scalar $var, Perl internally represents it as ${var}. The braces
> are there just to avoid confusion.
> <snip>
> If you simply wrote "$base_$name", Perl would interpret that as
> "$base_" . "$num", which of course is wrong.
>
> Did that relieve the confusion?
>
> Ala
that helps.
I have to relook the problem over again and do some homework then repost.
The originall problem was not stated completely and thats my fault. I was
playing with s/\b(p)earl\b/${1}erl/i and when I put braces around [earl]
things didn't happen the way I expected but I'm still learning.
thanxs till the next post
(just another cookie) cook
------------------------------
Date: Sat, 27 Feb 1999 17:00:24 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: need a clearer explanation of ${1} use in s///i
Message-Id: <x3yogmfpkw7.fsf@tigre.matrox.com>
edgar <cook@mediaone.net> writes:
> still slighly confused but I'm reading the perldoc perlre and trying
> examples.
${1} is the same as $1 .. it has nothing to do with perlre. IIRC, for
every scalar $var, Perl internally represents it as ${var}. The braces
are there just to avoid confusion.
For example, if you want to create multiple files with the same name,
but with different number suffixes, you can do:
my $base = "FILE";
my $file;
for my $num (0..10) {
$file = "${base}_$num";
# do whatever with $file
}
If you simply wrote "$base_$name", Perl would interpret that as
"$base_" . "$num", which of course is wrong.
Did that relieve the confusion?
Ala
------------------------------
Date: Sat, 27 Feb 1999 13:52:51 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie : bash doesn't want to run my script !
Message-Id: <3ue9b7.j7e.ln@magna.metronet.com>
Matthew O. Persico (mpersico@erols.com) wrote:
: I bet your current directory is not in the PATH. Don't add it to the
: PATH. Simply execute ths script as
: ../script
But, since he said he is using a shebang line, the path matters
not at all.
The path is something the shell maintains, shebang lines are
processed by the kernel, which does not have any concept of
a "path".
: Patrick Fichou wrote:
: >
: > I want to run a script file from bash. It maybe simple but doesn't seem to
: > work !
: > 1/ I add this (first) line in my script :
: >
: > #!/usr/bin/perl
: >
: > 2/ My PATH is correct (contains /usr/bin)
: >
: > 3/ Perl is in this directory
: >
: > 4/ I use Linux Redhat 5.2
: >
: > Where I'm wrong ?
[ please don't quote signatures ]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 01 Mar 1999 03:17:55 GMT
From: Baillie <baillie@my-dejanews.com>
Subject: Re: Newbie : bash doesn't want to run my script !
Message-Id: <7bd0su$hco$1@nnrp1.dejanews.com>
In article <3ue9b7.j7e.ln@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> Matthew O. Persico (mpersico@erols.com) wrote:
> : I bet your current directory is not in the PATH. Don't add it to the
> : PATH. Simply execute ths script as
>
> : ../script
>
> But, since he said he is using a shebang line, the path matters
> not at all.
>
> The path is something the shell maintains, shebang lines are
> processed by the kernel, which does not have any concept of
> a "path".
>
I may have lost you there, but I'm pretty sure he meant the path to the script
where as you meant the path to perl. There is quite a difference, although I
don't think the path is the problem anyway.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 27 Feb 1999 15:06:50 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Newbie question
Message-Id: <alecler-2702991506500001@dialup-554.hip.cam.org>
In article <7b96of$jmm$1@nnrp1.dejanews.com>,
johan.levin@mbox300.swipnet.se wrote:
> Hi
>
> I've only just started to learn perl.
>
> I understand these lines should do the same thing:
>
> <STDIN>
> $_ = <STDIN>
>
> But they don't.
Indeed, they don't.
>From perlop (I/O Operators): "Evaluating a filehandle in angle brackets
yields the next line from that file (newline, if any, included), or undef
at end of file. Ordinarily you must assign that value to a variable, but
there is one situation where an automatic assignment happens. If and ONLY
if the input symbol is the only thing inside the conditional of a while or
for(;;) loop, the value is automatically assigned to the variable $_."
HTH,
Andre
------------------------------
Date: Sat, 27 Feb 1999 17:00:02 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Newbie question
Message-Id: <1dnw969.1klklei1jh5y5sN@bay1-409.quincy.ziplink.net>
<johan.levin@mbox300.swipnet.se> wrote:
> I understand these lines should do the same thing:
>
> <STDIN>
> $_ = <STDIN>
>
> But they don't. (Actually I don't understand what the first one does at all.)
>
Nope... As explained in perlop, those expressions should only do the
same thing in the conditional of a while() or for(;;) loop.
For example, these:
while (<STDIN>) {
for ($i=1; <STDIN>; ++$i) {
are equivalent to these:
while (defined($_=<STDIN>)) {
for ($i=1; defined($_=<STDIN>); ++$i) {
As a statement by itself:
<STDIN>;
reads in a line of input and discards it.
--
_ / ' _ / - aka - rjk@linguist.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
perl -e'$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'
------------------------------
Date: Sat, 27 Feb 1999 19:12:28 -0800
From: Mark Davis <bodycount@mail.jps.net>
Subject: newbie: How couuld I find my IP?
Message-Id: <36D8B41C.3EE037DA@mail.jps.net>
I'm hooked up to an ISP with a PPP connection and I want to know what my
IP is. Where should I look.
I know that I can do a system call to ifconfig but that seems like
a dumb way to do it. Plus I need this to run as a cron job and I just
learned that STDOUT ends up going to mail from cron...
Thanks in advance!
--mark
------------------------------
Date: 27 Feb 1999 21:28:01 GMT
From: geiger@cs.ucdavis.edu (Phillip George Geiger)
Subject: News::NNTPClient 480 Authentication
Message-Id: <7b9o11$45a$1@mark.ucdavis.edu>
My apologies if this should have been posted to just c.l.p.modules;
I searched DejaNews and all of the relevant articles seemed to be in
the misc group.
I recently installed NNTPClient-0.28 on my system (Linux) and have
been fiddling around with it.
I copied the sample program from the man page, adding in the name
of my news server:
----
#!/usr/bin/perl -w
use News::NNTPClient;
$c = new News::NNTPCLient("my.news.server"");
($first, $last) = ($c->group("alt.test"));
for(; $first <= $last; $first++ ) {
print $c->article($first);
}
----
When I run the program, I get:
NNTPERROR: 480 Authentication Required
Use of unitialized value at ./test.pl line 9 <SOCK1> chunk 2.
NNTPERROR: 480 Authentication Required
Use of unitialized value at ./test.pl line 9 <SOCK1> chunk 3.
Consulting the man page again, I found (under "Extended NNTP Commands"):
authinfo Expects two arguments, user and password.
I have a username and password for this server. My question, as a very
new Perl programmer, is how to employ the authinfo command so that the
news server will allow me to download and print all the articles in the
"alt.test" newsgroup.
Suggestions would be appreciated. Thanks!
--
Phil Geiger
geiger@cs.ucdavis.edu
------------------------------
Date: Sun, 28 Feb 1999 03:32:20 GMT
From: cant_take@thespam.com (Ken )
Subject: Note Tab lite
Message-Id: <36d8b85b.15323442@news.tiac.net>
Hello:
I've been writting some Perl using Note Tab lite, which has served me
well for quick and dirty HTML, but I was having a devil of a time
getting some programs to run. I rewrote them in notepad and they all
ran. Anybody got any idea what's up with that!?
Ken
------------------------------
Date: 27 Feb 1999 23:18:46 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Offtopic (Was: Re: custom dial script - simple if you know how - I don't)
Message-Id: <7b9ugm$3n2$1@gellyfish.btinternet.com>
On Sat, 27 Feb 1999 02:22:37 +0100 Werns wrote:
> Kosta wrote:
>>
>> Well thanks, I appreciate the response:
>> but it's not as if I have a choice.
>> Catch 22
>
> I don't get that last line - is it some TV series down under ?
>
"You've got to prove you're mad to get out of here but if you want to
get out of here you cant be mad" - thats catch 22 (wildly paraphrased as
I cant find the book right now).
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 28 Feb 1999 02:50:08 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: PC - UNIX text converter
Message-Id: <gfsab7.ltf.ln@magna.metronet.com>
Fred O'Brian (NOSPAMwibbly.wobbly.web@w3.to) wrote:
: This is a multi-part message in MIME format.
^^^^^^^^^^^^^^
Please configure your "newsreader" properly.
Usenet is a plain text medium.
No MIME here.
: Am I missing something REALLY obvious here?
: All I need is a tool to add/remove the carrage returns in
: text files. Surely this must already exsist! Can anybody suggest
: one? (I am using Redhat linux / Win95)
perl -p -i -e 's/\r//g' filename # dos->unix
perl -p -i -e 's/\n/\r\n/g' filename # unix->dos
: <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
: <HTML>
Please configure your "newsreader" properly.
HTML is for the WWW.
Usenet is not the WWW.
No HTML here.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Feb 1999 00:57:05 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl open function
Message-Id: <7ba491$3ua$1@gellyfish.btinternet.com>
On Sat, 27 Feb 1999 08:10:31 -0800 Larry Rosler wrote:
> In article <m3k8x3sviu.fsf@joshua.panix.com>, on 27 Feb 1999 10:42:33 -
> 0500 jdf@pobox.com says...
>> RS <rajshreesankaran@hotmail.com> writes:
> ...
>> my $path = "$DIR\\reg.htm$VAR1";
> ...
>> Also, using backwhacks as path separators leads to mental confusion.
>> Forward slashes work just dandy under NT, and you don't have to worry
>> about interpolation.
>
> True, and worth repeating many times. But in this case, interpolation
> is what RS wanted, hence the double quotes, hence the double
> backslashes.
>
I think that is what Jonathan meant - if you use the '/' then you dont
have to worry about any possible interpolation from the '\' - at least I
think I think that ...
Anyhow if anyone was left in any doubt about this -
IT IS ONLY THE POXY MS COMMAND INTERPRETER THAT CARES ABOUT THE
DIRECTION OF THE SLASHES - THIS HAS BEEN THE CASE SINCE DOS 2.0.
Just to reiterate Larry's point of course ... ;-}
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 27 Feb 1999 19:28:59 GMT
From: ben@kesslerconsulting.com
Subject: Perl script to compare files
Message-Id: <7b9h1i$rtl$1@nnrp1.dejanews.com>
I'm looking to create a script that will compare the contents of two text
files (in this instance they are Cisco router configurations) and report any
differences in the second file relative to the first. Here is an example:
read fileA
compare fileB to fileA
report each line that was added as follows:
+ foo
report each line that was deleted as follows:
- bar
Any change in a existing line would be reported as both an addition and
deletion e.g changing "foo" to "foo1" would result in the following:
- foo
+ foo1
In addition to showing the individiual lines that change, I would like the to
see all of fileB listing the changes in context.
Does anyone know of such a script already existing? If not, any pointers on
how to accomplish this?
Thanks,
Ben
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Feb 1999 12:51:40 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl script to compare files
Message-Id: <36d84ccc@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ben@kesslerconsulting.com writes:
:I'm looking to create a script that will compare the contents of two text
:files (in this instance they are Cisco router configurations) and report any
:differences in the second file relative to the first.
system("diff f1 f2");
--tom
--
*** The previous line contains the naughty word "$&".\n
if /(ibm|apple|awk)/; # :-)
--Larry Wall in the perl man page
------------------------------
Date: 27 Feb 1999 14:39:05 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl script to compare files
Message-Id: <m1vhgntqt2.fsf@halfdome.holdit.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> system("diff f1 f2");
Or even
system "diff", "f1", "f2";
Especially better when f1 and f2 are variables, to ensure that you
don't get shell-mangled.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5017
**************************************