Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Janitors Thread Retitler v1

by castaway (Parson)
on Dec 02, 2004 at 08:23 UTC ( [id://411686]=note: print w/replies, xml ) Need Help??


in reply to Janitors Thread Retitler v1

Nice work davido!

A couple of points:

1. Please add a <p><small>"Edit by [$user] - Retitle from '$orig_title'"</small></p> to the end of the root node while retitling, else we'll still have to do that bit by hand.

2. I'd prefer to be able to enter the original title on the command line too, so that I can just start it and forget, and not have to wait for it to ask if I want to continue.

3. If I enter an invalid node id, the xml node thread ticker gives back a valid but empty list, you should probably check if the title it gives has a length. (Someone should probably patch the ticker not to do this, see my post in the Scriptorium).

4. I have WWW::M 0.70, so I replaced your line

$agent->click_button( 'value' => 'update' );
with
$agent->current_form->value('blah','update'); $agent->click('blah');
stolen from Corions version, and it seems to work fine.

C.

Replies are listed 'Best First'.
Re^2: Janitors Thread Retitler v1
by tye (Sage) on Dec 03, 2004 at 00:17 UTC

    I'd prompt for a 'from' and 'to' and not try to parse "Re^2:" but just s/\Q$from/$to/ on the titles. Perhaps slightly more robust would be

    s/(?!(?<=\w)\w)\Q$from\E(?!(?<=\w)\w)/$to/

    Which is like \b\Q$from\E\b except that it is more DWIM in cases where $from starts or ends with \W characters.

    And I'd prompt for what to add to the bottom of retitled nodes (with what castaway proposed as a default) since I'd only rarely want to include the full original title, especially that many times.

    I didn't check, but I hope it allows me to retitle subtrees of a thread.

    - tye        

      "that many times" ? I thought we only put the janitor-comment on the top node. Or perhaps I have no idea what you mean?

        Sorry, I missed "root". I still would rather not quote the entire previous title in many (most) cases.

        I was thinking it might be nice to have two default attributions to pick from, the second being something like "... by tye: $title =~ s/$old/$new/...". Actually, I'd like [id://22609] used instead of [tye], but I don't mind maintaining my own copy of the script for such quirks. :)

        - tye        

Re^2: Janitors Thread Retitler v1
by davido (Cardinal) on Dec 02, 2004 at 16:07 UTC

    All good points, castaway. I'll have time to work on implementing them this evening (localtime california).

    One thought. The reason that I opted to not require the original title to be typed in on the command line is because I felt that it is inconvenient to have to carefully type it in exactly as it appears in the original post, without any missed spaces, punctuation, and so on. How about if I implement an optional commandline switch, "-orig"? If you use the switch, the script runs from the commandline without the runtime prompt. If you don't use the switch, the script still grabs the original title itself (like it does now) and prompts to ensure it's correct.

    Thanks for the suggestion on how to overcome the WWW::Mechanize 0.74 requirement. I'll implement that too.


    Dave

      Well, I dunno about you, but on any occasion where I pass a node to a/the retitler, I've always gone for the "cut&paste" method so far, both on original title, and new title suggestion. Your suggestion to make it optional is fine by me :)

      C.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-04-23 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found