$ perl -e " dd\@ARGV " -- "ro""shambo"
["ro\"shambo"]
$ perl -e " dd\@ARGV " "ro""shambo"
["ro\"shambo"]
####
$ perl -MDevel::PL_origargv -e" dd( Devel::PL_origargv->get ) " "ro""shambo" "ro "" shambo"
(
"D:\\perl\\citrusperl\\bin\\perl.exe",
"-MDevel::PL_origargv",
"-e dd( Devel::PL_origargv->get ) ",
"ro\"shambo ro",
"",
"shambo",
)
####
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;
}
####
$ 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\"\"shambo\" \"ro \"\" shambo \""