Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!c:\\perl\\bin\\perl.exe # Slashdot Headline Grabber for Win32 # by Joe Stewart use Win32::GUI; use Win32::Shell; use Socket; my $count; my %stories; my @keys; my $maxsize = ([400,42]); my $minsize = ([200,42]); my $main = Win32::GUI::Window->new(-name => 'Main', -text => 'Slashdot Headlines', -width => 275, -height => 42, -maxsize => $maxsize, -minsize => $minsize); my $label = new Win32::GUI::Label($main, -text => "Downloading Headlines...", -name => "Url", -width => 350, -height => 42, -left => 40, -notify => 1); my $button_back = new Win32::GUI::Button($main, -text => "<", -name => "Back", -width => 15, -left => 0, -height => 15); my $button_fwd = new Win32::GUI::Button($main, -text => ">", -name => "Fwd", -width => 15, -left => 15, -height => 15); $main->AddButton($button_back); $main->AddButton($button_fwd); $main->AddLabel($label); my $Cycle = $main->AddTimer("Cycle", 10000); my $Reload = $main->AddTimer("Reload", 1800000); $main->Show(); GUI::Update($main); my $inet = inet_aton(''); my $proto=getprotobyname('tcp'); &fetch_headlines; $main->Url->Text($stories{$keys[0]}); $Cycle->Interval(10000); Win32::GUI::Dialog(); sub Main_Terminate { -1; } sub Fwd_Click { $count++; $count = 0 if $count == scalar(@keys); $main->Url->Text($stories{$keys[$count]}); $Cycle->Interval(10000); } sub Back_Click { $count--; $count = scalar(@keys) - 1 if $count == -1; $main->Url->Text($stories{$keys[$count]}); $Cycle->Interval(10000); } sub Url_DblClick { my $url = $keys[$count]; Win32::Shell::Execute("open", $url, undef, undef, "SW_SHOWNORMAL"); return 1; } sub fetch_headlines { my @D; socket(S,PF_INET,SOCK_STREAM,$proto) || return 0; if(connect(S,pack "SnA4x8",2,80,$inet)) { select(S); $|=1; print "GET /slashdot.xml HTTP/1.0\n\n"; @D=<S>; select(STDOUT); close(S); } else { return 0 } my ($title, $url); for (@D) { $title = $1 if /\<title\>(.*)\<\/title\>/; $url = $1 if /\<url\>(.*)\<\/url\>/; if (/<\/story>/) { $stories{$url} = $title; push(@keys, $url); $title = ""; $url = ""; } } return 1; } sub Cycle_Timer { &Fwd_Click; return 1; } sub Reload_Timer { &fetch_headlines; $Reload->Interval(1800000); return 1; }

In reply to Slashdot Headline Grabber for Win32 by httptech

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [james28909]: you know, i had a thought a few mnths back. what if this universe were just a puzzle, waiting for life to figure it out!
    [james28909]: what if one day we are able to grab the curtain that is "spacetime" and pull it back to reveal <insert imagination here> pulling at levers and ropes xD
    [holli]: like dorothy?
    [james28909]: see ya later holli
    [james28909]: yeah like wizard of oz lol. its just a joke though
    [james28909]: i cannot understand how someone cant see that a cloud of gas that evolves into a solar system or galaxies. it just makes sense to me. everythign that has happened, had to have happened for anything on this planet to be.
    [james28909]: /gas/gas and debris/
    [james28909]: another thing, i used to be atheist. life experiences, personal evidence. and my own perception is the reason why i believe the things i do.

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (13)
    As of 2017-12-15 14:46 GMT
    Find Nodes?
      Voting Booth?
      What programming language do you hate the most?

      Results (433 votes). Check out past polls.