Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

can someone help me?

by xiper (Friar)
on Mar 18, 2004 at 05:20 UTC ( #337612=obfuscated: print w/ replies, xml ) Need Help??

i am trying to write a progam that will download several pages at once using fork but it doesnt work and keeps giving me funny output can you tell me what the problem is this is my code what am i doing wrong
#! /usr/bin/perl use strict; use warnings qw( FATAL all ); # not sure what this does my @pop = qw( 1 21 3 24 2 9 5 0 0 0 5 15 4 25 4 16 ); $SIG{__DIE__} = sub { print substr pop,pop@pop,pop@pop }; eval for <DATA>; __DATA__; # download pages from perlmonks printf "%-s", "getting perlmonks nodes\n"; my $node = { node1 => qw(The Monastery Gates), node2 => qw(Seekers of +Perl Wisdom) }; use lwp v5.75; # use latest version # make sure we have a valid pid and fork off a child require $$; if( defined( my %pid ) ) { $pid{ fork() or die } = 1 } # get the html data and print it my $html = connect 'http://www.perlmonks.org/index.pl?node=$node', 10; print html, "\n";

- ><iper (newb)

use japh; print;
NOTE: win32 only, *very* fragile... ymmv

Comment on can someone help me?
Select or Download Code
Re: can someone help me?
by Mr. Muskrat (Abbot) on Mar 18, 2004 at 05:40 UTC
Re: can someone help me?
by Koosemose (Pilgrim) on Mar 18, 2004 at 14:47 UTC

    Beautiful, absolutely beautiful...

    Heh, almost had me, til I noticed the sig handler and the Fatal warnings.

    Just Another Perl Alchemist
      It got a few people. It was actually considered, thought to have been posted to the wrong section. Now that's obfu!

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
Re: can someone help me?
by LostS (Friar) on Mar 18, 2004 at 19:34 UTC
    OK I don't get it... It prints this:

    H:\Scripts>perl test6.pl
    getting perlmonks nodes
    emen:VERfine defin oilei

    OK And?? What does it mean??

    -----------------------
    Billy S.
    Slinar Hardtail - Hand of Dane
    Datal Ephialtes - Guildless
    RallosZek.Net Admin/WebMaster

    perl -le '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat +!\n"; } else { print "Thats a dog\n"; }'
      emen:VERfine defin oilei

      I get "g teatedfine Perl al" -- The output is dependent on your Perl version and operating system.

      It's a clever concept, regardless.

Re: can someone help me?
by ysth (Canon) on Mar 18, 2004 at 22:32 UTC
    What exactly are the error messages it is supposed to get? With different perls I'm seeing Update: hid the partial output I got
      Like others have pointed out, it is highly dependant on your os and perl version, hence my bold disclaimer. For starters, it will only work on win32 because it relies on a case-insensitive filename bug. v5.8.3 works for me.
      <spoiler>
      printf "%-s", "getting perlmonks nodes\n"; my $node = { node1 => qw(The Monastery Gates), node2 => qw(Seekers of +Perl Wisdom) }; use lwp v5.75; require $$; if( defined( my %pid ) ) { $pid{ fork() or die } = 1 } my $html = connect 'http://www.perlmonks.org/index.pl?node=$node', 10; print html, "\n"; 16 4 Newline in left-[just]ified string for printf 25 4 Odd number of elements in[ ano]nymous hash 15 5 lwp defines nei[ther ]package nor VERSION--version check failed 0 5 [Perl ]v2916.0.0 required (did you mean v2916.000?)--this is onl +y v5.8.3, stopped 9 2 defined(%[ha]sh) is deprecated 24 3 connect() on unopened so[cke]t http://www.perlmonks.org/index.pl +?node=$node 21 1 No comma allowed afte[r] filehandle
      </spoiler>
      Update: ysth's comment

      - ><iper

      use japh; print;
        You should use
        <table bgcolor="white"><tr><td><font color="white"> ... </font></table>
        to hide that, since some themes will have a non-white bg.
Re: can someone help me?
by scottj (Monk) on Mar 19, 2004 at 00:48 UTC
    On my WinXP system, running ActivePerl 5.8.2, I get this:
    justtor ther Perl hacker
      It's because you copied/pasted the code form the page. Use the d/l code link instead to get the code so you don't get perlmonks' code wrapping in there.
Re: can someone help me?
by ambrus (Abbot) on Mar 21, 2004 at 10:04 UTC
    require $$;

    This line looks so good (although I don't quite know what it does).

    Update: Very good japh. Almost works on linux too, I get just anop.pm Perl hacker

Re: can someone help me?
by ambrus (Abbot) on May 06, 2008 at 10:32 UTC

    I see mine are not the only obfus that the 5.10.0 release of perl completely breaks. That release has

    removed the "Newline in left-justified string for printf" warning.

    Update: oh sorry, replied to the wrong post. This is meant as a reply to can someone help me?. Update: Arunbear has moved the node to the right place. Thanks.

Re: can someone help me?
by ambrus (Abbot) on Nov 04, 2011 at 19:25 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://337612]
Approved by jweed
Front-paged by jweed
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-11-26 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (162 votes), past polls