in reply to Browser::Open Windows metacharacters
Hello IB2017,
The Browser::Open module determines an OS-sppropriate value for $cmd and then executes a call to system($cmd, $url);. So if the equivalent call fails on your OS when invoked directly, it will fail similarly via a call to open_browser. For example, on my system (Windows 8.1, 64-bit, Perl 5.28.0):
21:47 >perl -wE "system('start', 'https://www.google.com/search?q=fina +nce&source=lnms&tbm=isch');" 'source' is not recognized as an internal or external command, operable program or batch file. 'tbm' is not recognized as an internal or external command, operable program or batch file. 21:53 >
But changing the query delimiter from & to ; fixes the problem for me:
21:53 >perl -wE "system('start', 'https://www.google.com/search?q=fina +nce;source=lnms;tbm=isch');" 21:54 >
— and the equivalent:
use strict; use warnings; use Browser::Open qw( open_browser ); my $url = 'https://www.google.com/search?q=finance;source=lnms;tbm=isc +h'; my $ok = open_browser($url); printf "\$ok = >%s<: %s\n", $ok, !defined($ok) ? 'no recognised command found' : $ok == 0 ? 'command found and executed' : 'command found, error while executing';
works correctly:
21:58 >perl 1952_SoPW.pl $ok = >0<: command found and executed 21:58 >
Hope that helps,
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Browser::Open Windows metacharacters
by IB2017 (Pilgrim) on Dec 09, 2018 at 13:58 UTC |