a simple control in an nntp client

Discussion in 'Perl Misc' started by George, Dec 4, 2008.

  1. George

    George Guest

    I would like to extend the following script:

    #!/usr/bin/perl -w

    use strict;
    use Net::NNTP ();

    use constant NUMBER_OF_ARTICLES => 10;
    use constant GROUP_NAME => 'alt.solaris.x86';
    use constant SERVER_NAME => 'news.individual.net';
    use constant NNTP_DEBUG => 0;

    my $nntp = Net::NNTP->new(SERVER_NAME, 'Debug' => NNTP_DEBUG) or die;
    my $USER = '';
    my $PASS = '';

    $nntp->authinfo($USER,$PASS) or die $!;


    my($article_count, $first_article, $last_article) =
    $nntp->group(GROUP_NAME) or die;


    # Which XOVER fields contain Subject: and From:?
    my $count = 0;
    my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
    die unless exists $xover_fmt{'Subject:'};
    my $subject_offset = $xover_fmt{'Subject:'};
    my $from_offset = $xover_fmt{'From:'};

    my(@xover, $start_article);
    RETRIEVE: while ($#xover+1 < NUMBER_OF_ARTICLES and $last_article >=
    $first_article) {

    # How many articles do we need? Stop retrieving if we have enough
    my $articles_required = NUMBER_OF_ARTICLES - ($#xover+1) or last
    RETRIEVE;


    # Fetch overview information for the articles
    $start_article = $last_article - ($articles_required-1);
    $start_article = $start_article > $first_article ? $start_article :
    $first_article;

    my $xover_query = $start_article == $last_article ?
    $start_article :
    [$start_article, $last_article];
    my $xover_ref = $nntp->xover($xover_query) or die;

    # Store headers for the articles we've retrieved
    foreach (sort {$b <=> $a} keys %$xover_ref) {
    push @xover, $xover_ref->{$_};
    }
    } continue {
    # Move the pointer forward to fetch previous articles
    $last_article = $start_article - 1;
    }

    # Disconnect from the NNTP server
    $nntp->quit;

    print join("\n", map ($_->[$subject_offset].' from '.$_->[$from_offset],
    @xover)),"\n";


    # perl script1.pl 2>text50.txt >text51.txt

    Current output is:

    C:\MinGW\source>perl script1.pl
    Re: Solaris 10 update 6 on Intel x86. from CJT <>
    Re: Solaris 10 update 6 on Intel x86. from Ian Collins
    <>
    Re: Solaris 10 update 6 on Intel x86. from Atiqur Rahman <>
    Re: Solaris 10 update 6 on Intel x86. from Ian Collins
    <>
    Re: Solaris 10 update 6 on Intel x86. from Atiqur Rahman <>
    Re: Solaris 10 update 6 on Intel x86. from Atiqur Rahman <>
    Re: Solaris 10 update 6 on Intel x86. from Atiqur Rahman <>
    Re: Solaris 10 update 6 on Intel x86. from
    Solaris 10 update 6 on Intel x86. from Atiqur Rahman <>
    Re: Booting multi-user but w/o X from

    C:\MinGW\source>

    The way I would like to extend this is the following:

    If the article is from 'Atiqur Rahman', then I would like to print the
    entire article.

    This may sound trivially easy to those with more experience with perl. I
    find the control structures very difficult in perl. I've done similar
    things before, but it's been a while since I've used perl. I have
    _Programming Perl_ as a reference.

    Thanks for your comment.

    --
    George

    We will stand up for our friends in the world. And one of the most
    important friends is the State of Israel. My administration will be
    steadfast in support Israel against terrorism and violence, and in seeking
    the peace for which all Israelis pray.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 4, 2008
    #1
    1. Advertising

  2. George

    Guest

    On Thu, 4 Dec 2008 14:13:27 -0700, George <> wrote:

    >
    >I would like to extend the following script:
    >

    Have you thought of 'extension' courses?

    sln
    , Dec 5, 2008
    #2
    1. Advertising

  3. George

    George Guest

    On Fri, 05 Dec 2008 03:57:42 GMT, wrote:

    > On Thu, 4 Dec 2008 14:13:27 -0700, George <> wrote:
    >
    >>
    >>I would like to extend the following script:
    >>

    > Have you thought of 'extension' courses?
    >
    > sln


    No, but your response makes me recall fondly the moments when I used to
    throw eurotrash around. Typ.
    --
    George

    I believe that God has planted in every heart the desire to live in
    freedom.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 5, 2008
    #3
  4. George

    Guest

    On Fri, 5 Dec 2008 01:33:47 -0700, George <> wrote:

    >On Fri, 05 Dec 2008 03:57:42 GMT, wrote:
    >
    >> On Thu, 4 Dec 2008 14:13:27 -0700, George <> wrote:
    >>
    >>>
    >>>I would like to extend the following script:
    >>>

    >> Have you thought of 'extension' courses?
    >>
    >> sln

    >
    >No, but your response makes me recall fondly the moments when I used to
    >throw eurotrash around. Typ.


    >--
    >George
    >
    >I believe that God has planted in every heart the desire to live in
    >freedom.
    >George W. Bush
    >
    >Picture of the Day http://apod.nasa.gov/apod/


    Typical George W. Bush fan.

    sln
    , Dec 7, 2008
    #4
  5. George

    George Guest

    On Sun, 07 Dec 2008 00:45:19 GMT, wrote:

    > On Fri, 5 Dec 2008 01:33:47 -0700, George <> wrote:
    >
    >>On Fri, 05 Dec 2008 03:57:42 GMT, wrote:
    >>
    >>> On Thu, 4 Dec 2008 14:13:27 -0700, George <> wrote:
    >>>
    >>>>
    >>>>I would like to extend the following script:
    >>>>
    >>> Have you thought of 'extension' courses?
    >>>
    >>> sln

    >>
    >>No, but your response makes me recall fondly the moments when I used to
    >>throw eurotrash around. Typ.

    >
    >>--
    >>George
    >>
    >>I believe that God has planted in every heart the desire to live in
    >>freedom.
    >>George W. Bush
    >>
    >>Picture of the Day http://apod.nasa.gov/apod/

    >
    > Typical George W. Bush fan.
    >
    > sln


    Dutch fuiks think they're so clever and sarcastic and appear not to see
    what's funny about me posting as the idiot in chief.

    They don't teach perl in continuing education classes around here. So it
    is that I rely on a book and the net, and you've managed to **** up what
    you could of that.

    It's true I was a Reagan Youth when I was a European. With Bush II, we now
    see Reagan's folly.
    --
    George

    A dictatorship would be a heck of a lot easier, there's no question about
    it.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 7, 2008
    #5
  6. George

    Tim Greer Guest

    George wrote:

    > On Sun, 07 Dec 2008 00:45:19 GMT, wrote:
    >
    >> On Fri, 5 Dec 2008 01:33:47 -0700, George <>
    >> wrote:
    >>
    >>>On Fri, 05 Dec 2008 03:57:42 GMT, wrote:
    >>>
    >>>> On Thu, 4 Dec 2008 14:13:27 -0700, George <>
    >>>> wrote:
    >>>>
    >>>>>
    >>>>>I would like to extend the following script:
    >>>>>
    >>>> Have you thought of 'extension' courses?
    >>>>
    >>>> sln
    >>>
    >>>No, but your response makes me recall fondly the moments when I used
    >>>to
    >>>throw eurotrash around. Typ.

    >>
    >>>--
    >>>George
    >>>
    >>>I believe that God has planted in every heart the desire to live in
    >>>freedom.
    >>>George W. Bush
    >>>
    >>>Picture of the Day http://apod.nasa.gov/apod/

    >>
    >> Typical George W. Bush fan.
    >>
    >> sln

    >
    > Dutch fuiks think they're so clever and sarcastic and appear not to
    > see what's funny about me posting as the idiot in chief.
    >
    > They don't teach perl in continuing education classes around here. So
    > it is that I rely on a book and the net, and you've managed to **** up
    > what you could of that.
    >
    > It's true I was a Reagan Youth when I was a European. With Bush II,
    > we now see Reagan's folly.


    A lot of people on this news group have filtered out the "sln" poster,
    you might consider doing the same and saving the grief of dealing with
    him. Not only does he argue with people when he doesn't get humor, but
    he argues with himself as well. Filtering him out will save a lot of
    nonsense.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Dec 7, 2008
    #6
  7. George

    George Guest

    On Sat, 06 Dec 2008 19:21:08 -0800, Tim Greer wrote:


    > A lot of people on this news group have filtered out the "sln" poster,
    > you might consider doing the same and saving the grief of dealing with
    > him. Not only does he argue with people when he doesn't get humor, but
    > he argues with himself as well. Filtering him out will save a lot of
    > nonsense.


    I don't hang around long enough to foster antipathies except to the worst
    of persons who violate civility. sln did give a working perl soln to my
    bits/bytes problem, which I didn't ask for--actually I did but didn't mean
    to--but was glad to have a solution in a another syntax. I keep on pecking
    away at perl; one of these days I'll be able to use it skillfully.

    If $from_offset is defined so:

    # Which XOVER fields contain Subject: and From:?
    my $count = 0;
    my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
    die unless exists $xover_fmt{'Subject:'};
    my $subject_offset = $xover_fmt{'Subject:'};
    my $from_offset = $xover_fmt{'From:'};


    , and this works:

    my $s4 = join( map ($_->[$from_offset],@xover));

    print STDOUT " s4 is $s4\n";

    , why doesn't this:

    if ($_->[$from_offset] eq "George <>")
    {
    print STDOUT "got a match\n";
    }

    perl.exe says:

    Use of uninitialized value in string eq at script2.pl line 58.

    where line 58 is the test condition on the if control.

    --
    George

    I believe that God has planted in every heart the desire to live in
    freedom.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 13, 2008
    #7
  8. George <> wrote:


    > if ($_->[$from_offset] eq "George <>")



    Execute this Perl program:

    $_ = "George <>";
    print;

    and then use single quotes instead.

    :)


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Dec 13, 2008
    #8
  9. George

    Tim Greer Guest

    George wrote:

    > , why doesn't this:
    >
    > if ($_->[$from_offset] eq "George <>")
    > {
    > print STDOUT "got a match\n";
    > }
    >
    > perl.exe says:
    >
    > Use of uninitialized value in string eq at script2.pl line 58.
    >
    > where line 58 is the test condition on the if control.


    I think you meant "George <george\@example.invalid>" or else 'George
    <>', otherwise @example will mean something else.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Dec 13, 2008
    #9
  10. George <> wrote:
    >if ($_->[$from_offset] eq "George <>")
    >
    >perl.exe says:
    >
    >Use of uninitialized value in string eq at script2.pl line 58.
    >
    >where line 58 is the test condition on the if control.


    Well, what value does the array @example have?
    Had you used warnings and strict as has been strongly recommended over
    and over again then perl would (probably) have warned you at compile
    time that @example was undefined.

    jue
    Jürgen Exner, Dec 13, 2008
    #10
  11. Jürgen Exner <> wrote:
    >George <> wrote:
    >>if ($_->[$from_offset] eq "George <>")
    >>
    >>perl.exe says:
    >>
    >>Use of uninitialized value in string eq at script2.pl line 58.
    >>
    >>where line 58 is the test condition on the if control.

    >
    >Well, what value does the array @example have?
    >Had you used warnings and strict as has been strongly recommended over
    >and over again then perl would (probably) have warned you at compile
    >time that @example was undefined.


    s/undefined/undeclared/

    of course

    jue
    Jürgen Exner, Dec 13, 2008
    #11
  12. George

    George Guest

    On Fri, 12 Dec 2008 21:47:14 -0600, Tad J McClellan wrote:

    > George <> wrote:
    >
    >
    >> if ($_->[$from_offset] eq "George <>")

    >
    >
    > Execute this Perl program:
    >
    > $_ = "George <>";
    > print;
    >
    > and then use single quotes instead.
    >
    > :)


    ok


    C:\MinGW\source> perl tad1.pl
    George <george.invalid>
    C:\MinGW\source> perl tad1.pl
    George <>
    C:\MinGW\source>

    Clearly, I want single quotes. What happened as a side effect from the
    double-quoted one?

    One thing that happens in perl that doesn't happen in fortran is that
    you're halfway through the program, and a statement like

    ....($something, @arts)= ...

    creates an array. This would be strictly forbidden in fortran.
    --
    George

    The deliberate and deadly attacks which were carried out yesterday against
    our country were more than acts of terror. They were acts of war.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 15, 2008
    #12
  13. George

    George Guest

    On Fri, 12 Dec 2008 20:27:38 -0800, Tim Greer wrote:

    > George wrote:
    >
    >> , why doesn't this:
    >>
    >> if ($_->[$from_offset] eq "George <>")
    >> {
    >> print STDOUT "got a match\n";
    >> }
    >>
    >> perl.exe says:
    >>
    >> Use of uninitialized value in string eq at script2.pl line 58.
    >>
    >> where line 58 is the test condition on the if control.

    >
    > I think you meant "George <george\@example.invalid>" or else 'George
    > <>', otherwise @example will mean something else.


    That's one side of the comparison. I see that this should be
    single-quoted.

    The stumper is how to use $_-> and $from_offset to get the from attribute
    from a given message.

    I swear, control mechanisms in perl use stealth.
    --
    George

    The United States of America will never be intimidated by thugs and
    assassins. The killers will fail, and the Iraqi people will live in
    freedom.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 15, 2008
    #13
  14. George

    George Guest

    On Fri, 12 Dec 2008 22:31:44 -0800, Jürgen Exner wrote:

    > Jürgen Exner <> wrote:
    >>George <> wrote:
    >>>if ($_->[$from_offset] eq "George <>")
    >>>
    >>>perl.exe says:
    >>>
    >>>Use of uninitialized value in string eq at script2.pl line 58.
    >>>
    >>>where line 58 is the test condition on the if control.

    >>
    >>Well, what value does the array @example have?
    >>Had you used warnings and strict as has been strongly recommended over
    >>and over again then perl would (probably) have warned you at compile
    >>time that @example was undefined.

    >
    > s/undefined/undeclared/
    >
    > of course
    >
    > jue


    I don't see anything different after having added
    use warnings;

    and single quotes:


    C:\MinGW\source>perl script2.pl
    s4 is
    Use of uninitialized value in string eq at script2.pl line 58.

    C:\MinGW\source>perl script2.pl
    s4 is
    Use of uninitialized value in string eq at script2.pl line 59.

    C:\MinGW\source>

    #!/usr/bin/perl -w

    use strict;
    use warnings;
    use Net::NNTP ();

    use constant NUMBER_OF_ARTICLES => 10;
    use constant GROUP_NAME => 'comp.lang.perl.misc';
    use constant SERVER_NAME => 'news.individual.net';
    use constant NNTP_DEBUG => 0;

    my $nntp = Net::NNTP->new(SERVER_NAME, 'Debug' => NNTP_DEBUG) or die;
    my $USER = '';
    my $PASS = '';

    $nntp->authinfo($USER,$PASS) or die $!;


    my($article_count, $first_article, $last_article) =
    $nntp->group(GROUP_NAME) or die;


    # Which XOVER fields contain Subject: and From:?
    my $count = 0;
    my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
    die unless exists $xover_fmt{'Subject:'};
    my $subject_offset = $xover_fmt{'Subject:'};
    my $from_offset = $xover_fmt{'From:'};

    my(@xover, $start_article);
    RETRIEVE: while ($#xover+1 < NUMBER_OF_ARTICLES and $last_article >=
    $first_article) {

    # How many articles do we need? Stop retrieving if we have enough
    my $articles_required = NUMBER_OF_ARTICLES - ($#xover+1) or last
    RETRIEVE;


    # Fetch overview information for the articles
    $start_article = $last_article - ($articles_required-1);
    $start_article = $start_article > $first_article ? $start_article :
    $first_article;

    my $xover_query = $start_article == $last_article ?
    $start_article :
    [$start_article, $last_article];
    my $xover_ref = $nntp->xover($xover_query) or die;

    # Store headers for the articles we've retrieved
    foreach (sort {$b <=> $a} keys %$xover_ref) {
    push @xover, $xover_ref->{$_};
    }
    } continue {
    # Move the pointer forward to fetch previous articles
    $last_article = $start_article - 1;
    }


    my $s4 = join( map ($_->[$from_offset],@xover));

    print STDOUT " s4 is $s4\n";

    if ($_->[$from_offset] eq 'George <>')
    {
    print STDOUT "got a match\n";
    }




    $nntp->article($_,\*STDOUT) for @xover;

    # Disconnect from the NNTP server
    $nntp->quit;


    # perl script2.pl



    --
    George

    Now, there are some who would like to rewrite history - revisionist
    historians is what I like to call them.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 15, 2008
    #14
  15. George <> wrote:
    > On Fri, 12 Dec 2008 21:47:14 -0600, Tad J McClellan wrote:
    >
    >> George <> wrote:
    >>
    >>
    >>> if ($_->[$from_offset] eq "George <>")

    >>
    >>
    >> Execute this Perl program:
    >>
    >> $_ = "George <>";
    >> print;
    >>
    >> and then use single quotes instead.



    ( or, escape the at-sign: $_ = "George <george\@example.invalid>" )


    > C:\MinGW\source> perl tad1.pl
    > George <george.invalid>
    > C:\MinGW\source> perl tad1.pl
    > George <>
    > C:\MinGW\source>
    >
    > Clearly, I want single quotes. What happened as a side effect from the
    > double-quoted one?



    It interpolated the @example array.

    Since it was empty, it was replaced with the empty string.

    You should always enable warnings when developing Perl code.

    perl -we '$_ = "George <>"; print'

    Possible unintended interpolation of @example in string at -e line 1.
    Name "main::example" used only once: possible typo at -e line 1.


    > One thing that happens in perl that doesn't happen in fortran is that
    > you're halfway through the program, and a statement like
    >
    > ...($something, @arts)= ...
    >
    > creates an array. This would be strictly forbidden in fortran.

    ^^^^^^
    ^^^^^^

    You should also always enable strictures in Perl programs.

    If you do, then such things are strictly forbidden in Perl too.

    use warnings;
    use strict;


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Dec 15, 2008
    #15
  16. George <> wrote:
    > On Fri, 12 Dec 2008 22:31:44 -0800, Jürgen Exner wrote:
    >
    >> Jürgen Exner <> wrote:
    >>>George <> wrote:
    >>>>if ($_->[$from_offset] eq "George <>")
    >>>>
    >>>>perl.exe says:
    >>>>
    >>>>Use of uninitialized value in string eq at script2.pl line 58.
    >>>>
    >>>>where line 58 is the test condition on the if control.
    >>>
    >>>Well, what value does the array @example have?



    The more pertinent question is what value does $_ have...


    > if ($_->[$from_offset] eq 'George <>')
    > {
    > print STDOUT "got a match\n";
    > }



    You have not put anything into $_.

    Perhaps you meant to loop over @xover instead?

    foreach ( @xover ) {
    if ($_->[$from_offset] eq 'George <>') {
    print STDOUT "got a match\n";
    }
    }

    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Dec 15, 2008
    #16
  17. On 2008-12-15 01:55, George <> wrote:
    > One thing that happens in perl that doesn't happen in fortran is that
    > you're halfway through the program, and a statement like
    >
    > ...($something, @arts)= ...
    >
    > creates an array. This would be strictly forbidden in fortran.


    As Tad wrote, if you "use strict", you have to declare your variables.
    But being able to create your values while you are "halfway through the
    program" is a feature, not a bug. If you variables for the smallest
    possible scope (possibly just a few lines) it is much easier to see
    where the variable is used for. If you have to declare all your
    variables at the start of your program, you need to examine your whole
    program to see where the variable is used.

    hp
    Peter J. Holzer, Dec 15, 2008
    #17
  18. George

    George Guest

    On Sun, 14 Dec 2008 22:48:58 -0600, Tad J McClellan wrote:

    > George <> wrote:
    >> On Fri, 12 Dec 2008 22:31:44 -0800, Jürgen Exner wrote:


    > The more pertinent question is what value does $_ have...


    It seems to do a lot of things in perl.

    >
    >
    >> if ($_->[$from_offset] eq 'George <>')
    >> {
    >> print STDOUT "got a match\n";
    >> }

    >
    >
    > You have not put anything into $_.
    >
    > Perhaps you meant to loop over @xover instead?
    >
    > foreach ( @xover ) {
    > if ($_->[$from_offset] eq 'George <>') {
    > print STDOUT "got a match\n";
    > }
    > }


    That's precisely what I needed to do.

    C:\MinGW\source>perl script2.pl
    got a match
    got a match
    got a match

    C:\MinGW\source>

    Thanks all for responses.
    --
    George

    You teach a child to read, and he or her will be able to pass a literacy
    test.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 16, 2008
    #18
  19. George

    George Guest

    On Mon, 15 Dec 2008 09:34:44 +0100, Peter J. Holzer wrote:

    > On 2008-12-15 01:55, George <> wrote:
    >> One thing that happens in perl that doesn't happen in fortran is that
    >> you're halfway through the program, and a statement like
    >>
    >> ...($something, @arts)= ...
    >>
    >> creates an array. This would be strictly forbidden in fortran.

    >
    > As Tad wrote, if you "use strict", you have to declare your variables.
    > But being able to create your values while you are "halfway through the
    > program" is a feature, not a bug. If you variables for the smallest
    > possible scope (possibly just a few lines) it is much easier to see
    > where the variable is used for. If you have to declare all your
    > variables at the start of your program, you need to examine your whole
    > program to see where the variable is used.
    >
    > hp


    Fortran is a much different syntax than perl. Rightly or wrongly, I think
    of perl as a fixit syntax. The policy on when you can declare an array,
    while different, is a feature for both.
    --
    George

    I believe that God has planted in every heart the desire to live in
    freedom.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 16, 2008
    #19
  20. George

    George Guest

    On Sun, 14 Dec 2008 21:06:42 -0600, Tad J McClellan wrote:

    > George <> wrote:
    >> On Fri, 12 Dec 2008 21:47:14 -0600, Tad J McClellan wrote:
    >>
    >>> George <> wrote:
    >>>
    >>>
    >>>> if ($_->[$from_offset] eq "George <>")
    >>>
    >>>
    >>> Execute this Perl program:
    >>>
    >>> $_ = "George <>";
    >>> print;
    >>>
    >>> and then use single quotes instead.

    >
    >
    > ( or, escape the at-sign: $_ = "George <george\@example.invalid>" )


    ok
    >
    >
    >> C:\MinGW\source> perl tad1.pl
    >> George <george.invalid>
    >> C:\MinGW\source> perl tad1.pl
    >> George <>
    >> C:\MinGW\source>
    >>
    >> Clearly, I want single quotes. What happened as a side effect from the
    >> double-quoted one?

    >
    >
    > It interpolated the @example array.
    >
    > Since it was empty, it was replaced with the empty string.
    >
    > You should always enable warnings when developing Perl code.
    >
    > perl -we '$_ = "George <>"; print'
    >
    > Possible unintended interpolation of @example in string at -e line 1.
    > Name "main::example" used only once: possible typo at -e line 1.


    #!/usr/bin/perl -w

    use strict;
    use warnings;
    use Net::NNTP ();

    Does this not cover my bases here?
    >
    >
    >> One thing that happens in perl that doesn't happen in fortran is that
    >> you're halfway through the program, and a statement like
    >>
    >> ...($something, @arts)= ...
    >>
    >> creates an array. This would be strictly forbidden in fortran.

    > ^^^^^^
    > ^^^^^^
    >
    > You should also always enable strictures in Perl programs.
    >
    > If you do, then such things are strictly forbidden in Perl too.
    >
    > use warnings;
    > use strict;


    I've been thinking about the fix you gave with:
    foreach ( @xover ) {

    ... send something to STDOUT ...

    }
    }

    How is it different from this:

    $nntp->article($_,\*STDOUT) for @xover;

    ?
    --
    George

    We don't believe in planners and deciders making the decisions on behalf of
    Americans.
    George W. Bush

    Picture of the Day http://apod.nasa.gov/apod/
    George, Dec 16, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hiran de Silva

    NNTP client component in ASP.NET 2.0 Beta?

    Hiran de Silva, Mar 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    667
    Kevin
    Mar 13, 2005
  2. Pierre-Charles David

    [ANN] niouz 0.5 (simple NNTP server)

    Pierre-Charles David, Oct 3, 2004, in forum: Ruby
    Replies:
    0
    Views:
    282
    Pierre-Charles David
    Oct 3, 2004
  3. Anton Bangratz
    Replies:
    0
    Views:
    160
    Anton Bangratz
    Jun 4, 2008
  4. Replies:
    7
    Views:
    380
    Dr.Ruud
    Aug 9, 2006
  5. sadie-no-reply

    Posting to nntp newsgroup with Perl (Net::NNTP)

    sadie-no-reply, Mar 4, 2007, in forum: Perl Misc
    Replies:
    3
    Views:
    284
    Jamie
    Mar 5, 2007
Loading...

Share This Page