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 />
<br />
[Newest Nodes|New]<br />
[Recently Active Threads|Recent] <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>
→ [id://1072]<br />
→ [http://perlmonks.org/?node_id=1072#free
+nodelet|edit free]
</p>
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|