Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w #Code adapted from +ractor use strict; use LWP; use Getopt::Std; use HTTP::Request::Common; $|++; use vars qw(%opts); getopts('p:u:n:h',\%opts); my ($user,$passwd,$nodeletfile) = ($opts{u},$opts{p},$opts{n}); USAGE() and exit unless $user and $passwd and $nodeletfile and not $op +ts{h}; my @nodelets; open NODELET, $nodeletfile or die "can't open nodelet file: $nodeletfi +le $!"; while (<NODELET>) { next unless my ($nodelet) = /^\s*(\d+)/; push @nodelets, $nodelet; } use constant URL => ''; my $ua = LWP::UserAgent->new; $ua->agent('personal_nodlet_restorer/1.0 (' . $ua->agent .')'); #$ua->proxy('http', 'http://myproxy:8080'); # log in and access your User Setting page in raw format my $request = POST(URL, Content => [ op => 'login', user => $user, passwd => $passwd, node_id => 1072, displaytype => 'raw', addtopn => \@nodelets, modifypn => 'on', ] ); my $response = $ua->request($request); die $response->message unless $response->is_success; print "All done. Please double check by logging into PerlMonks with yo +ur browser"; sub USAGE { print "USAGE: $0 -u user -p -password -n nodelet_filename\n"; } =pod =head1 NAME - LWP script =head1 DESCRIPTION Reverses the action of Jeffa's Personal Nodelet Extractor. Given a fil +ename that contains a list of node_ids, it will log in and add then all to y +our personal nodelet. The majority of this code was shamelessly stolen from Jeffa's Personal Nodelet Extractor: =head1 SYNOPSIS for *nix: ./ C<-u> uname C<-p> passwd C<-n> filename for win32: perl C<-u> uname C<-p> passwd C<-n> filena +me Invokes the script for the specified username and password. The conten +ts on the input file would look something like this: 24270 Permutations and combinations 25730 Life in the land of OOP, and I'm confused. 17890 shift, Pop, Unshift and Push with Impunity! 32005 Apache::MP3 34786 Why I like functional programming It doesn't need a default record seperator - it's collecting all numbe +rs so a \d+ is sufficient. =cut

In reply to Personal Nodelet Restorer by $code or die

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
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (4)
    As of 2021-03-07 15:49 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (122 votes). Check out past polls.