Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

pm-freenode-update.pl

by naChoZ (Curate)
on Jan 14, 2005 at 17:11 UTC ( #422322=snippet: print w/ replies, xml ) Need Help??

Description: Just a simple script to help manage your freenode since the small form fields are a bit unwieldly. Change data to something suitable for yourself.
#!/usr/local/bin/perl -w
#
#---------------------------------------------------------------------
+--
#
#  pm-freenode-update.pl
#
#  Script to update your Free Nodelet content
#
#---------------------------------------------------------------------
+--

use strict;
use WWW::Mechanize;

my $agent = WWW::Mechanize->new;

my $url   = "http://perlmonks.org";
my $urlfn = $url . "/?node_id=492700";


#---------------------------------------------------------------------
+--
#  Supply your perlmonks credentials
#---------------------------------------------------------------------
+--
my $user  = "your_username";
my $pw    = "your_passwd";



#---------------------------------------------------------------------
+--
#  Concat in all the content to put in your Free Nodelet
#  into a single scalar variable
#---------------------------------------------------------------------
+--
my $freenodelet;
my @freedata = <DATA>;
$freenodelet .= $_ for @freedata;


#---------------------------------------------------------------------
+--
#  Log on to perlmonks first
#---------------------------------------------------------------------
+--
$agent->get( $url ) or 
    die "Error accessing $url: $!\n";
$agent->form_number( "2" );
$agent->field( 'user',   $user );
$agent->field( 'passwd', $pw );
$agent->submit();


#---------------------------------------------------------------------
+--
#  Go to the Free Nodelet configuration page and submit your
#  content to the form
#---------------------------------------------------------------------
+--
$agent->get( $urlfn )
    or die "Error accessing $urlfn: $!\n";
$agent->form_number( "2" );
$agent->field( 'setfreenodelet', $freenodelet );
$agent->submit();


#---------------------------------------------------------------------
+--
#  Convenient place to put the content for your Free Nodelet
#---------------------------------------------------------------------
+--

__DATA__
[naChoZ|My]<br />
<a href="/?node_id=6364;user=naChoZ">Posts</a><br />
[131|Home]<br />
&nbsp;<br />
[Newest Nodes|New]<br />
[Recently Active Threads|Recent] &nbsp;<a href="javascript:toggle_all(
+)">(collapse)</a>
<script language="javascript"><!--
var expandState="expanded";
function toggle_all(){
    expandState  = (expandState=='expanded')
                       ? 'collapsed'
                       : 'expanded'
                       ;
    var elements = document.getElementsByTagName('ul');
    var elnum;
    for(elnum=0;elnum<elements.length;elnum++){
        var lb = "\x5B";
        var rb = "\x5D" 
        var el = eval("elements"+lb+"elnum"+rb);
        el.className = expandState;
    }
}
//--></script>
<br />
[Super Search|Search]<br />
[Categorized Questions and Answers|Answers]<br />
[Cool Uses for Perl|CUFP]<br />
[Snippets Section|Snippets]<br />
[Code Catacombs|Code]<br />
<p>
[id://28877|Consider]
</p>
<p>
&nbsp;&nbsp;&rarr;&nbsp;&nbsp;[id://1072]<br />
&nbsp;&nbsp;&rarr;&nbsp;&nbsp;[http://perlmonks.org/?node_id=1072#free
+nodelet|edit free]
</p>
Comment on pm-freenode-update.pl
Download Code
Re: pm-freenode-update.pl (form moved)
by tye (Cardinal) on Sep 17, 2005 at 04:16 UTC

    Thanks for this.

    Can you patch it to use the new Free Nodelet Settings instead of User Settings? I'd like to remove that text field from User Settings before too long.

    Thanks.

    Update: demerphq has already deleted the field so I don't think this script will work until it is patched to use the new page.

    - tye        

      Script updated. Give it a spin.

      --
      naChoZ

      Where in the nursery rhyme does it say Humpty Dumpty is an egg?

Re: pm-freenode-update.pl
by naChoZ (Curate) on Sep 23, 2005 at 18:18 UTC

    Or, if anyone is interested, here is my rather loaded free nodelet. I use a modified version of the dark theme and with this freenode in place I've gone and shut off everything like the nav menu, quips, etc...

    --
    naChoZ

    Where in the nursery rhyme does it say Humpty Dumpty is an egg?

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://422322]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-12-22 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls