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

comment on

( [id://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":



  • 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.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2024-04-19 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found