Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
(Update(1): added handling for "+", and Mandrake info)

After a week in the cooker and a couple of revisions, I think I've got a fix for URL passing... at least for me, when I click on a URL, it may not make it to netscape (shell munged it), or netscape won't like it (has commas in it)... so, here's the stuff:

Near the top, right after the comments, you have the usual use stuff. Insert:

use URI::Escape; # escape funky chars out of URLs
I inserted this around line 90, after use PerlMonksChat;

Next, you'll want to go down to the LaunchBrowser sub, where you have at about line 773:

... else { $url = $perlmonksURL . $nod +e; } if ($^O =~ /MSWin32/i) { ...
In between these two lines, I've inserted the magic code to take care of all my weird URL woes[1]:
# escape URL to keep netscape and/or the shell from choking # " " is also unsafe (causes "Doc contains no data" $url=~s/+/%2B/g; # real "+" is preserved $url=~s/\s/+/g; # get rid of whitespace, not just " " $url=uri_escape($url,"\',");
Now, for Unix folks, there's now a duplicate line in the eval block that handled whitespace:
... eval ' my($pid) = fork; $url =~ s/\s/+/g; if ($pid == 0) { ...
Get rid of the $url =~ ... line (line 791 in my original), and you'll be set.

Tested for a week on Unix; some testing by dystrophy on win32. It's taken every URL that folks in the CB and I myself have thrown at it. Let me know if something goes weird.

[1] Alternatively, you may want to toy with the following instead of s///, but I haven't tested this:

$url=uri_escape($url," \',+");
Also, for you Mandrake users, the "netscape" wrapper really mangles URLs with "-" in them. If you find this happening to you, and you haven't got it fixed, I have some diffs for the shell script that have helped me. Just /msg me to let me know you're interested.

--
Me spell chucker work grate. Need grandma chicken.


In reply to (yakko: URL handler tweaks) Re: Perl/Tk Chatterbox Client by yakko
in thread Perl/Tk Chatterbox Client by Shendal

Title:
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!
  • 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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (6)
    As of 2015-07-08 02:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (93 votes), past polls