Whats this now eyepopslikeamosquito??

<update> yes I have "use Data::Dump;" loaded form sitecustomize, you can set PERL5OPT=-MData::Dump to get same effect of dd() available

</update>

$ perl -e " dd\@ARGV " -- "ro""shambo" ["ro\"shambo"] $ perl -e " dd\@ARGV " "ro""shambo" ["ro\"shambo"]

Seems to me "" works fine, and its not perl thats messing with it :)

$ perl -MDevel::PL_origargv -e" dd( Devel::PL_origargv->get ) " "ro""s +hambo" "ro "" shambo" ( "D:\\perl\\citrusperl\\bin\\perl.exe", "-MDevel::PL_origargv", "-e dd( Devel::PL_origargv->get ) ", "ro\"shambo ro", "", "shambo", )

From inspired by Re^5: How can I get a Unicode @ARGV? ( Win32::CommandLine bug ) a patch for Win32 (compiles easy)

diff -ruN Win32-0.45/Win32.xs Win32-0.45066/Win32.xs --- Win32-0.45/Win32.xs 2012-08-13 16:06:21.000000000 -0700 +++ Win32-0.45066/Win32.xs 2012-12-08 06:46:20.593750000 -0800 @@ -1753,6 +1753,32 @@ XSRETURN_IV(SetConsoleOutputCP((int)SvIV(ST(0)))); } + + +XS(w32_ArgvW) +{ + dXSARGS; + + int nArgs; + int ix = 0; + wchar_t** szArglist; + const wchar_t* wArgstring = GetCommandLineW(); + + if (GIMME_V == G_ARRAY) { + szArglist = CommandLineToArgvW( wArgstring , &nArgs); + for( ix = 0; ix < nArgs; ix++) { + XPUSHs( wstr_to_sv(aTHX_ szArglist[ix] ) ); + } + PUTBACK; + return; + } else { + XPUSHs( wstr_to_sv(aTHX_ wArgstring ) ); + PUTBACK; + return; + } + XSRETURN_EMPTY; +} + MODULE = Win32 PACKAGE = Win32 PROTOTYPES: DISABLE @@ -1825,5 +1851,7 @@ #ifdef __CYGWIN__ newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file); #endif + + newXS("Win32::ArgvW", w32_ArgvW, file); XSRETURN_YES; }

And it shows same results

$ perl -Mblib -MWin32 -e " dd( Win32::ArgvW() )" "ro""shambo" "ro "" + shambo " ( "perl", "-Mblib", "-MWin32", "-e", " dd( Win32::ArgvW() )", "ro\"shambo ro", "", "shambo", "", ) $ perl -Mblib -MWin32 -e " dd( scalar Win32::ArgvW() )" "ro""shambo" + "ro "" shambo " "perl -Mblib -MWin32 -e \" dd( scalar Win32::ArgvW() )\" \"ro\"\"sham +bo\" \"ro \"\" shambo \""

Seems to me "" works fine, and its not perl thats messing with it :) its cmd.exe ... not 100% sure about that but thats cmd.exe for you, its fudgy

link dump :)

See also


In reply to Re: Parsing Windows CommandLine from Perl by Anonymous Monk
in thread Parsing Windows CommandLine from Perl by eyepopslikeamosquito

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.