Frandajo has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I have a Tk program on ActiveState Perl for Win32 which can display its own manual in MSIE fine. I'd like to show it in Firefox instead if they have that browser.
Someone sent me this snippit. And it works fine for MSIE but makes Tk to hang while Firefox stays up after being called to show the doc.
Someone please tell me how to make it work as well for Firefox as it does for MSIE.
Thanks bunches,
# Launch new process the Win32 way. # Use alternate browser if installed. sub show_in_browser { no strict; if ( $browser =~ m/mozilla|firefox/ ) { # Display in Mozilla or its derivatives... $_ = shift || ''; my $command = m!^(?:ftp|http|file)://! ? sprintf URL, $_ : -r ($_) ? sprintf URL, 'file://' . abs_path($_) : s!^(www\..+)!http://$1! ? sprintf URL, $_ : s!^(ftp\..+)!ftp://$1! ? sprintf URL, $_ : s/^mailto:// ? sprintf MAIL, $_ : warn "usage: $0 (filename|URL|mailto:foo\@bar.com)\n" ; # Could add a LOG file output here. system "$browser", -remote => sprintf( $command, $_ ); } else { system( qq|start "$browser" "$browser"|, qq|"$_[0]"| ) && log_write( "Oops! Trouble opening $browser"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Open doc in Firefox from Tk with no Tk hanging
by eserte (Deacon) on Dec 08, 2007 at 00:04 UTC | |
by Frandajo (Novice) on Dec 08, 2007 at 00:26 UTC | |
|
Re: Open doc in Firefox from Tk with no Tk hanging
by renodino (Curate) on Dec 07, 2007 at 20:30 UTC | |
|
Re: Open doc in Firefox from Tk with no Tk hanging
by zentara (Cardinal) on Dec 07, 2007 at 18:22 UTC | |
by Frandajo (Novice) on Dec 07, 2007 at 19:34 UTC |