Welcome to Squishdot Websites Squishdot How-To
 about
 search
 post article
 Documentation
 Mailing Lists
 Bug Tracking
 Development
 Installation
 Upgrading
 Download
 admin
 rdf

 main


Contrib: LWP Perl automated posting sub
Squishdot Posted by on Tuesday August 08, 07:16AM, 2000
from the somebody elses problem dept.

I just brought up a quake site- clan No Problem site with the aid of squishdot. Many thanks to the developers it is a great app.

I did a little LWP coding to automate a post when a new member joins and thought I'd post it to save someone else a little time if they need a CGI script to talk to their Squishdot site.

Basically you just call squish_post with a hash containg the stuff you need to send in the message. You can get this from a CGI object like so:

@updatefields=$CGIQuery->param();

my %realhash;

foreach $updatefields(@updatefields){
  
  $temp = $CGIQuery->param($updatefields);
  if (substr($updatefields, 0 , 2) eq 'ZZ'){
  }
 else {
     $realhash{$updatefields} = $temp;

   };
};

I use values starting with ZZ as a "hidden" value in some of my CGI scripts.

Then take that hash, which now contains your CGI variables and names and pass it to squish_post.

squish_post(%info);

sub squish_post{

  my %args = @_;

  my $ua = LWP::UserAgent->new;

  my $e1 ="addPosting:method";

  my $req = POST 'http://your.suishdot.server:8888/your_site_id/addPostingForm/.',
  [author=>"The automation bot.",
   email=>"$args{EmailAddress}",
   title=>"$args{UserName} Joins Clan {NP}!",   
   subject=>"No Problem",
   dept=>"Robotic Problem Solution",
   summary=>"Please welcome $args{UserName} to Clan {NP} by sending a reply.  (So go ahead and click the Read More...)",
   body=>"$args{UserName}
          
              Web page: $args{WebPage}
              Email Address:$args{EmailAddress}
              ICQ: $args{ICQ}
              Notes: $args{Notes}    
",
   file=>"",
   $e1=>" Add "
  ];  
$req->referer("http://your_serv:888/your_site/addPostingForm");
$ua->request($req);

};

Notes:

  • I run my zope on a separate port - the 888 comes from there.
  • This didn't work until I upgraded to the most recent version of squishdot 0.4.1.
  • Watch for typos. I had to tweak a bit to get this accepted without a mangle
  • IF you play tf quake visit the site and join. Its no problem. Hey, join if you don't, thats no problem either :)
  • Happy Hacking and Fragging

    Killbossa {NP}

    <  |  >

     

Related Links

The Fine Print: The following comments are owned by whoever posted them.
( Reply )

Powered by Zope  Squishdot Powered
  "Any system that depends on reliability is unreliable." -- Nogg's Postulate
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©1999 , ©2000-2002 .