All pastes #49430 Raw Edit

Mine

public text v1 · immutable
#49430 ·published 2006-04-15 15:46 UTC
rendered paste body

# grouphug -> IRC.      
    if ($message =~ /^\.gh.*/i) { 
      &status("collecting gh");

    #my $grouphug = &grouphug::grouphug();
    my @ghs;
    my $ua = LWP::UserAgent->new;
    my $dfg = $ua->get('http://grouphug.us/random/');
    my $content = $dfg->content;

    while ($content =~ /conf-id".*?>(\d+?)<\/a>.*?conf-text">\s*<p>\s*(.*?)<\/p>/igcs) {
      my $n = $1;
      my $quote = $2;
      $quote  =~ s/(<([^>]+)>)|(\xD\xA)|\t|\n//igs;
      $quote  = substr($quote, 0, 320);
      $quote .= " ... ( more at http://grouphug.us/confessions/$n )";
      push (@ghs,$quote);
}
&status("gh collected");

#return $ghs[int rand @ghs];
&say($ghs[int rand @ghs]);
&say($ghs[0]);
&say($ghs[1]);
&status(@ghs);
#&status($ghs[int rand @ghs]);
    
     # return $grouphug;
     # &say($grouphug);
    }
    # end grouphug