Why doesn't Windows work in my Open In Perl pipe?

I am having this strange problem with Perl. I am trying to execute an external program from within my Perl script, and this external program takes the string + wildcard as parameters. My Perl program looks like this:

my $cmd_to_run = 'find-something-in-somedb myname* |' 
open(procHandle, $cmd_to_run); # I am using open because I want to 
                               # parse the output using pipes

For some strange reason, starting this Perl script (under Windows) of a function call openfails:

'sqlselect' is not recognized as an internal or external command

I guessed that there was something to do with it *on my command line, and so I deleted it, and now my command line looks like

my $cmd_to_run = 'find-something-in-somedb myname|'

Now when I run my Perl script, it works fine. The problem only occurs when there is a wildcard.

Some notes:

  • char, cmd ( perl script), .

  • , C, _open Windows.

  • , , , *, , ,

  • , Unix..

???

EDIT. , ENV. , , "sqlselect", "*" wild card... find-something-in-somedb, sqlselect . , perl "find-in-db", "sqlselect"

, , - . - "ENV", Wildcard *

+3
3

3- open

open(procHandle, '-|', 'find-something-in-somedb', 'myname*');

( *).

Windows *,

open(procHandle, '-|', 'find-something-in-somedb', '"myname*"');

open(procHandle, '-|', 'find-something-in-somedb "myname*"');

, Perl cmd.

+6

, Perl , . , ephemient, , :

print join ' ', @ARGV;

, ( my argv.pl):

my $cmd_to_run = './argv.pl myname* |' 
open(procHandle, $cmd_to_run); 

, Perl . Unix * . Windows.

+3

What happens if you use three arguments open?

open my $procHandle, '-|', 'find-something-in-somedb myname*'
    or die "Cannot open pipe: $!";
0
source

Source: https://habr.com/ru/post/1712331/


All Articles