[25285] in Perl-Users-Digest
Perl-Users Digest, Issue: 7530 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 17 11:06:02 2004
Date: Fri, 17 Dec 2004 08:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Dec 2004 Volume: 10 Number: 7530
Today's topics:
Re: (quickie) (Aliasing) Possible to get this to work i <bik.mido@tiscalinet.it>
Re: [Q] $ARGV, <>, and command-line Perl <please_post@nomail.edu>
Re: [Q] $ARGV, <>, and command-line Perl chris-usenet@roaima.co.uk
Re: [Q] $ARGV, <>, and command-line Perl <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: [Q] $ARGV, <>, and command-line Perl <1usa@llenroc.ude.invalid>
Re: [Q] $ARGV, <>, and command-line Perl <please_post@nomail.edu>
Re: [Q] $ARGV, <>, and command-line Perl <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: [Q] $ARGV, <>, and command-line Perl <bik.mido@tiscalinet.it>
Re: EOF and reading /proc <bik.mido@tiscalinet.it>
Re: FAQ 5.32: How do I close a file descriptor by numbe <bik.mido@tiscalinet.it>
How to tell what is using memory (Nikki R)
Re: How to tell what is using memory chris-usenet@roaima.co.uk
Re: How to tell what is using memory <spamtrap@dot-app.org>
Re: HTML Parser <tadmc@augustmail.com>
Re: HTML Parser <tadmc@augustmail.com>
Re: HTML Parser <1usa@llenroc.ude.invalid>
Re: labels not displayed when using win32::MsgBox on WI <1usa@llenroc.ude.invalid>
Need to spawn an FTP process thru PERL <bob@vdpcorp.com>
Re: Need to spawn an FTP process thru PERL <tadmc@augustmail.com>
Re: Net::NNTP, retrieving articles help please.......t <j.b.l.0.2.@.hotmail.com>
Net::NNTP, retrieving articles help please <j.b.l.0.2.@.hotmail.com>
Re: Net::NNTP, retrieving articles help please <spamtrap@dot-app.org>
Re: Static Code Analysis Tools? <ouellmiC@videotron.ca>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Dec 2004 16:26:15 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: (quickie) (Aliasing) Possible to get this to work in strict?
Message-Id: <0ds5s0psrmc446ucp6gan79rrpchqjd1l3@4ax.com>
On Thu, 16 Dec 2004 10:03:13 +0100, "Tassilo v. Parseval"
<tassilo.von.parseval@rwth-aachen.de> wrote:
>> aliasing can even be done. Oh, and of course on lexical scope exit it
>> will "downgrade" to a simple copy, won't it? (Just tried, and AFAICT
>> it is indeed so).
>
>No, an alias remains an alias. Perl increments the reference-count of
>the variable to be aliased:
Well, but from the UI-point of view, I mean: it acts in a way that is
perfectly undistinguishable from a copy, doesn't it?
> ethan@ethan:~$ perl -MDevel::Peek
> { my $c = 42;
> Dump($c);
> *alias = \$c;
> Dump($alias);
> }
> Dump($alias);
> __END__
> SV = IV(0x8163094) at 0x814cc6c
> REFCNT = 1
> FLAGS = (PADBUSY,PADMY,IOK,pIOK)
> IV = 42
> SV = IV(0x8163094) at 0x814cc6c
> REFCNT = 2
> FLAGS = (PADBUSY,PADMY,IOK,pIOK)
> IV = 42
I see... but now that I think of it better, examining your example in
detail, isn't it somewhat contradictory that the *package* variable
$alias has the PADMY flag set, what that as you explain below should
mark a lexical variable?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 17 Dec 2004 12:16:35 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <cpuin3$kpd$1@reader2.panix.com>
In <cpubbo$fcn$1@sun3.bham.ac.uk> Brian McCauley <nobull@mail.com> writes:
>bill wrote:
>> In <cpt1lf$s74$1@sun3.bham.ac.uk> Brian McCauley <nobull@mail.com> writes:
>>
>>>bill wrote:
> >>>
>>>>I tried
>>>>
>>>>perl -ne 'if (/whatever/) { print "$ARGV\n"; last }'
>>>>
>>>>which seems to work, but I really don't know what I'm doing.
> >>
>>>I would expect that to print only the first matching file.
>>
>> No, actually, it prints more than one.
>I cannot reproduce that on Perl 5.8.4 (ActiveState Win32 build 810), or
>5.6.1 or 5.8.0 or 5.8.5 (Linux).
Hmm. If that's the case, then there's an error somewhere in the
following perl documentation:
(from perlrun)
-n causes Perl to assume the following loop around your
program, which makes it iterate over filename argu
ments somewhat like sed -n or awk:
LINE:
while (<>) {
... # your program goes here
}
and (from perlop)
...The loop
while (<>) {
... # code for each line
}
is equivalent to the following Perl-like pseudo code:
unshift(@ARGV, '-') unless @ARGV;
while ($ARGV = shift) {
open(ARGV, $ARGV);
while (<ARGV>) {
... # code for each line
}
}
except that it isn't so cumbersome to say, and will actu
ally work. It really does shift the @ARGV array and put
the current filename into the $ARGV variable. It also
uses filehandle ARGV internally--<> is just a synonym for
<ARGV>, which is magical. (The pseudo code above doesn't
work because it treats <ARGV> as non-magical.)
Of course the catch could be in that last "non-magical" bit, which
as far as I know is totally undefined crap (i.e. useless
non-documentation). This documentation suggests that a "last" in
the code given to a command-line script run under -ne should exit
only the inner loop above; instead it appears to exit the outer
one.
BTW, I figured out why I got more than one line to print out in my
version: I had preceded the perl statement with "find . -type f |
xargs ". I didn't question the result in light of the documentation
cited.
bill
------------------------------
Date: Fri, 17 Dec 2004 12:22:05 +0000
From: chris-usenet@roaima.co.uk
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <dkva92-0rq.ln1@moldev.cmagroup.co.uk>
> find all the files below /path/to/subdir (this is Linux)
> that contain either of the strings "foo bar baz" or "quux frobozz",
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> Why? find, the command whose output you are processing, can take a regex
> to match against. Use that.
> $ find . -regex '.*/z.*' -type f -print
But -regex doesn't search the file contents like the OP required. It
matches against file names.
> Please consult
> man find
Exactly:
-regex pattern
File name matches regular expression pattern. This is a
match on the whole path, not a search. For example to match
a file named './fubar3', you can use the regular expression
`.*bar.' or `.*b.*3', but not `b.*r3'.
Quick alternative, since this is CLPM:
find . -type f | perl -ane 'chomp;open(F,$_)||next;print "$_\n" if grep {/foo bar baz|quux frobozz/} <F>'
More complex alternative. I've left the (apparently redundant) perl
bit in on the assumption that you want a more complex RE match than can
simply be performed by egrep (the egrep provides an efficient first-pass
filter to reduce the number of candidate files that perl has to process):
find . -type f -print0 | xargs -0 egrep -l 'foo bar baz|quux frobozz' | perl -ane 'chomp;open(F,$_)||next;print "$_\n" if grep {/foo bar baz|quux frobozz/} <F>'
Chris
------------------------------
Date: Fri, 17 Dec 2004 14:34:05 +0100
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <Xns95C294318E40Felhber1lidotechnet@62.89.127.66>
bill <please_post@nomail.edu> wrote:
[...]
> Of course the catch could be in that last "non-magical" bit, which
> as far as I know is totally undefined crap (i.e. useless
> non-documentation). [...]
Documentation patches are a great way to contribute to the Perl
project. Thanks in advance for yours.
--
Cheers,
Bernard
------------------------------
Date: 17 Dec 2004 13:42:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <Xns95C258856F602asu1cornelledu@132.236.56.8>
chris-usenet@roaima.co.uk wrote in
news:dkva92-0rq.ln1@moldev.cmagroup.co.uk:
>> find all the files below /path/to/subdir (this is Linux)
>> that contain either of the strings "foo bar baz" or "quux frobozz",
>
> A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
>> Why? find, the command whose output you are processing, can take a
>> regex to match against. Use that.
>
>> $ find . -regex '.*/z.*' -type f -print
>
> But -regex doesn't search the file contents like the OP required. It
> matches against file names.
Well, it seems like I misunderstood the OP. Apologies.
Sinan
------------------------------
Date: Fri, 17 Dec 2004 14:10:08 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <cpupc0$meu$1@reader2.panix.com>
In <Xns95C294318E40Felhber1lidotechnet@62.89.127.66> "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> writes:
>bill <please_post@nomail.edu> wrote:
>[...]
>> Of course the catch could be in that last "non-magical" bit, which
>> as far as I know is totally undefined crap (i.e. useless
>> non-documentation). [...]
>Documentation patches are a great way to contribute to the Perl
>project. Thanks in advance for yours.
I can't possibly produce this patch, since I have no idea what this
magical/non-magical stuff means. Do you?
bill
------------------------------
Date: Fri, 17 Dec 2004 15:37:00 +0100
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <Xns95C29EDC6EA1Eelhber1lidotechnet@62.89.127.66>
bill <please_post@nomail.edu> wrote:
> In <Xns95C294318E40Felhber1lidotechnet@62.89.127.66> "Bernard
> El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> writes:
>
>>bill <please_post@nomail.edu> wrote:
>
>>[...]
>
>>> Of course the catch could be in that last "non-magical" bit,
>>> which as far as I know is totally undefined crap (i.e. useless
>>> non-documentation). [...]
>
>
>>Documentation patches are a great way to contribute to the Perl
>>project. Thanks in advance for yours.
>
> I can't possibly produce this patch [...]
Perhaps you could have been slightly less disrespectful in your
critique of the existing documentation, then.
--
Cheers,
Bernard
------------------------------
Date: Fri, 17 Dec 2004 16:26:13 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: [Q] $ARGV, <>, and command-line Perl
Message-Id: <o6t5s0h27vi1tfojs3v34sc6oniriuvck9@4ax.com>
On Thu, 16 Dec 2004 17:43:47 +0000 (UTC), J Krugman
<jkrugman345@yahbitoo.com> wrote:
>The immediate problem that serves as the context of the question
>is this: find all the files below /path/to/subdir (this is Linux)
>that contain either of the strings "foo bar baz" or "quux frobozz",
>and do this *from the command line* (i.e. I'm looking for a one-liner
>here, not a longwinded affair using File::Find, etc.).
Please note, that indeed it will tend to be somewhat clumsy, but you
can use File::Find on the cmd line:
perl -MFile::Find -le 'find sub { print if -f }, @ARGV' .
(OK, accomplishing the task you described *can't* be that terse!)
>I tried
>
> % perl -e 'print "$ARGV\n" if grep /(foo bar baz|quux frobozz)/, <>' `find /path/to/subdir -type f`
As a side note to the other good suggestions you already received,
I'll just add that if I wanted to do it "like this", then I'd do:
perl -lne 'print $ARGV and close ARGV if /whatever/' \
$(find /path/to/subdir -type f)
This has the big advantage (in terms of keystrokes) that you do not
have to explicitly open the files, but (I fear that) you may get into
trouble if the output of find gets large enough...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 17 Dec 2004 16:26:14 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: EOF and reading /proc
Message-Id: <u2u5s0dek86emr01fv6kcdh2fm73kilqto@4ax.com>
On Thu, 16 Dec 2004 17:37:58 -0500, Mark Seger <Mark.Seger@hp.com>
wrote:
>things to change in the middle of reading them? Wouldn't this make all
>system utilities that read /proc subject to errors? I have looked at a
This may well be OT, but actually I and a friend of mine noticed that
'w' occasionally gives erroneous output under heavy load. (On a Linux
machine, that is, or better: on quite a few Linux machines we tried
this thing on...)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 17 Dec 2004 16:26:12 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 5.32: How do I close a file descriptor by number?
Message-Id: <3sa5s0hlmsnpen5j0hq3uoh3u1c4uvv37j@4ax.com>
On Thu, 16 Dec 2004 11:03:00 +0000 (UTC), PerlFAQ Server
<comdog@panix.com> wrote:
> require 'sys/syscall.ph';
Out of curiosity, is the answer to this question still up to date?
Incidentally, is it really frequently asked? (Just out of curiosity
too, and not implying that it should be removed: even if it isn't, it
is interesting IMHO.)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Sat, 18 Dec 2004 00:43:50 +1000
From: nikki5+@notspamar.com.au (Nikki R)
Subject: How to tell what is using memory
Message-Id: <cpunm9$oe8$1@news-02.connect.com.au>
Hi,
I'm running a Perl script on Linux Red Hat 7.3 (in a company - I can't
upgrade).
My script uses up a lot of memory because it is reading large data files.
The largest file is about 10MB.
The data files were stored by using Data::Dumper, and my script reads each
data file one at a time:
foreach .... {
my $var1;
# Suck in the entire Data::Dumper'd file.
my $filestr = join('', <SOMEFILE>);
# The Data::Dumper file consists of a statement like:
# $var1 = {....} ; # Large hash reference.
eval $filestr;
# That sets $var1 which is a hash reference. Now do something with
$var1.
....
}
As the script runs, memory grows fairly quickly. I don't think have a
memory leak anywhere - I think that Perl allocates new memory whenever
it sees a larger data file than previously.
That's my understanding of the way Perl's garbage collection works, anyway.
In the above loop even though all of the 'my' variables go out of scope,
Perl doesn't normally release any memory back to the operating system until
the script finishes running.
Is there anything I can do about this, e.g. change the way that the data
file is read in? I definitely need to use a hash and I don't have the
choice
of using anything else but Data::Dumper (this is part of a large project
that I cannot change).
Is there also a good way of finding out (via a tracer or profiler of
some sort perhaps) which variables are using how much memory in a Perl
script? I eventually found out the above culprits only by doing a fair
amount of analysis using the Perl debugger and using Unix's "top"
program to see how much memory my perl script was using in total.
--
Nikki
------------------------------
Date: Fri, 17 Dec 2004 15:19:43 +0000
From: chris-usenet@roaima.co.uk
Subject: Re: How to tell what is using memory
Message-Id: <f1ab92-ll1.ln1@moldev.cmagroup.co.uk>
Nikki R <nikki5+@notspamar.com.au> wrote:
> I'm running a Perl script on Linux Red Hat 7.3 (in a company - I can't
> upgrade).
I don't see the logical equvalence between working for a company and
not being able to upgrade.
> Perl doesn't normally release any memory back to the operating system until
> the script finishes running.
That's normal behaviour for any unix-based application.
> Is there anything I can do about this, e.g. change the way that the data
> file is read in?
Have you read << perldoc -q 'less memory' >> yet?
> I definitely need to use a hash and I don't have the choice of using
> anything else but Data::Dumper (this is part of a large project that
> I cannot change).
If memory really is a problem, *and* it's only relevant for the small
section you've described, then you may want to consider forking a
separate process to read in the Data::Dumper format and translate it
into a more efficient format that the rest of your program can use. Of
course, if you're needing to use these large data structures throughout
your program then unless you can make them more space efficient you're
pretty much stuck.
Chris
------------------------------
Date: Fri, 17 Dec 2004 10:38:30 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How to tell what is using memory
Message-Id: <aIadnfrPKOnrYF_cRVn-sQ@adelphia.com>
chris-usenet@roaima.co.uk wrote:
> Nikki R <nikki5+@notspamar.com.au> wrote:
>
>>I'm running a Perl script on Linux Red Hat 7.3 (in a company - I can't
>>upgrade).
>
> I don't see the logical equvalence between working for a company and
> not being able to upgrade.
Corporate politics are rarely based in logic. Don't think "My company
can't upgrade." Think more along the lines of "I don't have the personal
authority to force an upgrade through the political morass of our IT
department in a reasonable amount of time."
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 17 Dec 2004 07:19:37 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HTML Parser
Message-Id: <slrncs5n79.6cj.tadmc@magna.augustmail.com>
Asoup <groups@gevorgian.com> wrote:
> I think that people here would like to argue than
> actually help.
I don't.
I prefer to ignore rather than argue or help when my
"bad attitude detector" starts clanging like this.
So long.
> Here is what I have right now:
>
> #!/usr/bin/perl
You should ask for all the help you can get by including
these lines in all of your Perl programs:
use warnings;
use strict;
> open(FILE,">$output_file");
You should always, yes *always*, check the return value from open():
open(FILE,">$output_file") or die "could not open '$output_file' $!";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Dec 2004 07:37:33 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: HTML Parser
Message-Id: <slrncs5o8t.6cj.tadmc@magna.augustmail.com>
Asoup <groups@gevorgian.com> wrote:
> What a schmuck...
Yes, you certainly are.
> Is there a way to ignore people in this groups?
Yes, and most people are now going to ignore all of *your* future posts.
http://www.catb.org/~esr/jargon/html/P/plonk.html
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 17 Dec 2004 13:52:32 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: HTML Parser
Message-Id: <Xns95C25A49DB2BAasu1cornelledu@132.236.56.8>
"Asoup" <groups@gevorgian.com> wrote in
news:1103266133.715414.277400@f14g2000cwb.googlegroups.com:
> Here is what I have right now:
>
> #!/usr/bin/perl
>
> use lib '/perl/lib';
use warnings;
use strict;
> use LWP::Simple;
> use HTML::TreeBuilder;
> use HTML::FormatText;
>
>
> $output_file = "/public_html/rss.txt";
>
> $html get("http://www.yerkir.am/eng/index.php?sub=news_arm&id=11918");
What is this line supposed to do?
Sinan.
------------------------------
Date: 17 Dec 2004 15:02:47 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: labels not displayed when using win32::MsgBox on WIN XP
Message-Id: <Xns95C26632DCF1Easu1cornelledu@132.236.56.8>
hurlu.berlue@laposte.net (hurluberlu) wrote in
news:d9b80c0c.0412170107.4bd60c8f@posting.google.com:
> Normaly it works but on one PC (WIN XP), the box is displayed but les
> labels OK, CANCEL, the label inside the box, the title of the box are
> not displayed.
> Is it due to a bad installation of Windows, due to an other thing ?
Who knows?
Post a short but complete script that others can run. The script you post
should reproduce the problem you are observing on the problem machine.
Sinan.
------------------------------
Date: Fri, 17 Dec 2004 13:11:55 GMT
From: "Bob Van Der Ploeg" <bob@vdpcorp.com>
Subject: Need to spawn an FTP process thru PERL
Message-Id: <vWAwd.122910$8G4.116567@tornado.tampabay.rr.com>
Does anyone know how to spawn an FTP process thru PERL?
Thanks
bob
------------------------------
Date: Fri, 17 Dec 2004 08:03:32 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Need to spawn an FTP process thru PERL
Message-Id: <slrncs5ppk.6ft.tadmc@magna.augustmail.com>
Bob Van Der Ploeg <bob@vdpcorp.com> wrote:
> Subject: Need to spawn an FTP process thru PERL
The name of the language is "Perl", not "PERL".
> Does anyone know how to spawn an FTP process thru PERL?
Yes, the same way you would spawn any other process.
What is it that you really need to accomplish?
You can do FTP from _within_ the perl process via a module from CPAN,
do you *require* that it be in a separate process for some reason?
You could launch it in the background via system() or open(), or
if you really need it, you can fork() and exec() to create
a new process that can be taken over by ftp.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 17 Dec 2004 15:45:19 GMT
From: jbl <j.b.l.0.2.@.hotmail.com>
Subject: Re: Net::NNTP, retrieving articles help please.......thanks that worked
Message-Id: <eiv5s09oml95gfg08ua6pdgmtpbrqjnd2c@4ax.com>
On Fri, 17 Dec 2004 10:02:11 -0500, Sherm Pendley
<spamtrap@dot-app.org> wrote:
>jbl wrote:
>
>> @lines = $server->article($n);
>> print map { "$_ \n" } @lines;
>
>> I want to read the article, all I am getting is a reference to the
>> array
>
>So, what's the problem? That's what the docs say you should get from
>article(), a reference to an array.
>
>Instead of storing that reference as the first element in @lines, you
>probably want something more like this instead:
>
> my $lines = $server->article($n);
> print map { "$_ \n" } @$lines;
>
>(I haven't tested this, but I have a hunch that the above will produce
>double-spaced articles, because I think the lines you get back will
>already have \ns.)
>
>sherm--
------------------------------
Date: Fri, 17 Dec 2004 14:14:12 GMT
From: jbl <j.b.l.0.2.@.hotmail.com>
Subject: Net::NNTP, retrieving articles help please
Message-Id: <4hp5s0p105l0cdb5br1bnlaja5jogvt774@4ax.com>
What am I overlooking?
use Net::NNTP;
# create a new Net::NNTP object:
$server = Net::NNTP->new("news-server.com")
or die "Can't connect to news server: $@\n";
($narticles, $first, $last, $name) =
$server->group("comp.lang.perl.misc")
or die "comp.lang.perl.misc\n";
print "$narticles $first $last $name\n";
for ($n=$first; $n<=$last; $n++)
{
@lines = $server->article($n);
print map { "$_ \n" } @lines;
}
I want to read the article, all I am getting is a reference to the
array
the print map { "$_ \n" } @lines;
this gets me
ARRAY(0x198e0d4)
not any text
Thanks
jbl
------------------------------
Date: Fri, 17 Dec 2004 10:02:11 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Net::NNTP, retrieving articles help please
Message-Id: <d8Gdnfolz91paV_cRVn-iA@adelphia.com>
jbl wrote:
> @lines = $server->article($n);
> print map { "$_ \n" } @lines;
> I want to read the article, all I am getting is a reference to the
> array
So, what's the problem? That's what the docs say you should get from
article(), a reference to an array.
Instead of storing that reference as the first element in @lines, you
probably want something more like this instead:
my $lines = $server->article($n);
print map { "$_ \n" } @$lines;
(I haven't tested this, but I have a hunch that the above will produce
double-spaced articles, because I think the lines you get back will
already have \ns.)
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 17 Dec 2004 08:00:31 -0500
From: "Michele Ouellet" <ouellmiC@videotron.ca>
Subject: Re: Static Code Analysis Tools?
Message-Id: <6KAwd.30143$3d2.1047610@weber.videotron.net>
> Which isn't a problem, I think-- if I have a sub in a module that
> doesn't appear after running that code over all my executables, then
> clearly that sub can be moved anywhere (or preferably, deleted).
Well, it is not quite clear to me. Of course, I have not looked at B::Xref
but it seems to me that if the sub does not appear, it can mean one of two
things:
* it is dead wood:
OR
* it is invoked based on some combination of conditions which were just not
exercised during your test.
Am I missing something?
Michèle.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 7530
***************************************