http://www.perlmonks.org?node_id=1008023


in reply to Re: win32::printer 5.16 will not install
in thread win32::printer 5.16 will not install

Taken from my command line: Please help, I must be doing something wrong as I am having a hard time installing it using nmake as well.
C:\Documents and Settings\Administrator>ppm install Win32::Printer
ppm install failed: Can't find any package that provides Win32::Printer

C:\Documents and Settings\Administrator>cpan Win32::Printer
Set up gcc environment - 3.4.5 (mingw-vista special r3)
CPAN: Term::ANSIColor loaded ok (v3.02)
CPAN: Storable loaded ok (v2.34)
Reading 'C:\Perl\cpan\Metadata'
Database was generated on Sun, 09 Dec 2012 12:07:03 GMT
Running install for module 'Win32::Printer'
Running make for W/WA/WASX/Win32-Printer-0.9.1.zip
CPAN: Digest::SHA loaded ok (v5.71)
'-qdt' is not recognized as an internal or external command,
operable program or batch file.
Checksum for C:\Perl\cpan\sources\authors\id\W\WA\WASX\Win32-Printer-0.9.1.zip ok
CPAN: Archive::Zip loaded ok (v1.30)
CPAN: CPAN::Meta loaded ok (v2.120630)

CPAN.pm: Building W/WA/WASX/Win32-Printer-0.9.1.zip

Set up gcc environment - 3.4.5 (mingw-vista special r3)
Inlude FreeImage image support? y: y
Inlude Ghostscript PDF support? y: y

DO NOT FORGET TO SET A Postscript PRINTER AS DEFAULT FOR THE TESTS TO SUCCEED!

Inlude ebbl barcode support? y: y
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for Delayimp.lib
Writing Makefile for Win32::Printer
Writing MYMETA.yml and MYMETA.json
CPAN: Module::CoreList loaded ok (v2.70)
cp Printer/Direct.pm blib\lib\Win32\Printer\Direct.pm
cp Printer/Enum.pm blib\lib\Win32\Printer\Enum.pm
cp Printer.pm blib\lib\Win32\Printer.pm
C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp -typemap C:\Perl\lib\ExtUtils\
typemap -typemap typemap Printer.xs > Printer.xsc && C:\Perl\bin\perl.exe -MExt
Utils::Command -e mv -- Printer.xsc Printer.c
C:\Perl\site\bin\gcc.exe -c -I.\3PLibs\FreeImage -I.\3PLibs\Ghostscript -I.\3PL
ibs\ebbl -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS
-DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_
USE_32BIT_TIME_T -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields -O2
-DVERSION=\"0.9.1\" -DXS_VERSION=\"0.9.1\" -DFREE -DGHOST -DEBBL -DWIN_IMPOR
T "-IC:\Perl\lib\CORE" Printer.c
Printer.xs: In function `XS_Win32__Printer__CreatePen':
Printer.xs:910: warning: assignment makes integer from pointer without a cast
Printer.xs: In function `XS_Win32__Printer__GetWinMetaFile':
Printer.xs:1260: error: syntax error before "_int16"
Printer.xs:1260: warning: no semicolon at end of struct or union
Printer.xs:1261: error: `_int16' undeclared (first use in this function)
Printer.xs:1261: error: (Each undeclared identifier is reported only once
Printer.xs:1261: error: for each function it appears in.)
Printer.xs:1267: error: `METAFILE_HEADER' undeclared (first use in this function
)
Printer.xs:1267: error: `PMETAFILE_HEADER' undeclared (first use in this functio
n)
Printer.xs:1274: error: syntax error before "MfHdr"
Printer.xs:1279: error: `lpszMetaFile' undeclared (first use in this function)
Printer.xs:1287: error: `MfHdr' undeclared (first use in this function)
Printer.xs:1301: warning: passing arg 2 of `GetMetaFileBitsEx' makes integer fro
m pointer without a cast
Printer.xs:1304: error: `hdc' undeclared (first use in this function)
Printer.c: At top level:
Printer.c:2108: error: syntax error before "void"
Printer.c:2108: error: syntax error before "PerlInterpreter"
Printer.xs: In function `XS_Win32__Printer__EBbl':
Printer.xs:1332: warning: assignment makes integer from pointer without a cast
Printer.xs:1337: error: `__try' undeclared (first use in this function)
Printer.xs:1337: error: syntax error before '{' token
Printer.xs:1346: error: `pen' undeclared (first use in this function)
Printer.xs:1347: error: `prepen' undeclared (first use in this function)
Printer.xs:1347: error: `hdc' undeclared (first use in this function)
Printer.xs:1348: error: `ebc' undeclared (first use in this function)
Printer.xs:1349: error: `RETVAL' undeclared (first use in this function)
Printer.xs:1349: error: `string' undeclared (first use in this function)
Printer.xs:1349: error: `x' undeclared (first use in this function)
Printer.xs:1349: error: `y' undeclared (first use in this function)
Printer.xs:1352: error: `emf' undeclared (first use in this function)
Printer.xs: At top level:
Printer.xs:1356: error: syntax error before '(' token
Printer.c:2178: error: syntax error before '(' token
Printer.c:2178: error: syntax error before ')' token
Printer.c:2180: error: syntax error before '=' token
Printer.c:2180: error: syntax error before '++' token
Printer.c:2182: error: syntax error before "PerlInterpreter"
Printer.xs: In function `XS_Win32__Printer__LoadBitmap':
Printer.xs:1401: error: `__try' undeclared (first use in this function)
Printer.xs:1401: error: syntax error before '{' token
Printer.xs:1408: error: `Type' undeclared (first use in this function)
Printer.xs:1409: error: `Image' undeclared (first use in this function)
Printer.xs:1409: error: `BmpFile' undeclared (first use in this function)
Printer.xs:1411: error: `lpbmi' undeclared (first use in this function)
Printer.xs:1412: error: `hdc' undeclared (first use in this function)
Printer.xs:1413: error: `du' undeclared (first use in this function)
Printer.xs:1415: error: `resolutionX' undeclared (first use in this function)
Printer.xs:1416: error: `resolutionY' undeclared (first use in this function)
Printer.xs:1422: error: `RETVAL' undeclared (first use in this function)
Printer.xs: At top level:
Printer.xs:1433: error: syntax error before '(' token
Printer.c:2281: error: syntax error before '=' token
Printer.c:2281: error: syntax error before '++' token
Printer.c:2283: error: syntax error before "PerlInterpreter"
Printer.xs: In function `XS_Win32__Printer__GhostPDF':
Printer.xs:1828: warning: assignment makes integer from pointer without a cast
Printer.xs:1830: error: `__try' undeclared (first use in this function)
Printer.xs:1830: error: syntax error before '{' token
Printer.xs: At top level:
Printer.xs:1840: error: syntax error before '(' token
Printer.c:2847: error: syntax error before '=' token
Printer.c:2847: error: syntax error before '++' token
Printer.c:2849: error: syntax error before "PerlInterpreter"
.xs: In function `XS_Win32__Printer__Inject':
Printer.xs:1892: error: `PSINJECTDATA' undeclared (first use in this function)
Printer.xs:1892: error: syntax error before "psd"
Printer.xs:1896: error: `PSIDENT_PSCENTRIC' undeclared (first use in this functi
on)
Printer.xs:1899: error: `psd' undeclared (first use in this function)
Printer.xs:1905: error: `POSTSCRIPT_IDENTIFY' undeclared (first use in this func
tion)
Printer.xs:1906: error: `POSTSCRIPT_INJECTION' undeclared (first use in this fun
ction)
dmake.exe: Error code 129, while making 'Printer.o'
WASX/Win32-Printer-0.9.1.zip
C:\Perl\site\bin\dmake.exe -- NOT OK
CPAN: YAML::XS loaded ok (v0.38)
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible

Replies are listed 'Best First'.
Re^3: win32::printer 5.16 will not install
by Anonymous Monk on Dec 10, 2012 at 04:34 UTC

    Taken from my command line: Please help, I must be doing something wrong as I am having a hard time installing it using nmake as well.

    For some reason you don't appear to be reading the "error" messages

      cpanp -z Win32::Printer

      patch -p1 -i./Win32-Printer-0.9.0-formingw.diff

      Win32-Printer-0.9.0-formingw.diff

      diff -ruN Win32-Printer-0.9.0-7P99xa/Printer.xs Win32-Printer-0.9.0-ne +w/Printer.xs --- Win32-Printer-0.9.0-7P99xa/Printer.xs 2008-04-28 11:40:34.00000 +0000 -0700 +++ Win32-Printer-0.9.0-new/Printer.xs 2012-12-09 21:22:29.32812500 +0 -0800 @@ -24,6 +24,12 @@ #include <winspool.h> #include <commdlg.h> + +#define _int16 __int16 + + + + //------------------------------------------------------------------- +---------// LPWSTR ToWide( @@ -1334,7 +1340,7 @@ ebc.flags = flags; ebc.baw = baw; ebc.bah = bah; - __try { +//~ __try { if (emf) { brush = GetCurrentObject(hdc, OBJ_BRUSH); font = GetCurrentObject(hdc, OBJ_FONT); @@ -1352,10 +1358,10 @@ if (emf) { emf = CloseEnhMetaFile(hdc); } - } - __except (exfilt()) { - RETVAL = 64; - } +//~ } +//~ __except (exfilt()) { +//~ RETVAL = 64; +//~ } #else croak("EBbl is not supported in this build!\n"); #endif @@ -1398,7 +1404,7 @@ RETVAL = NULL; #ifdef FREE SetCurrentDirectory(dir); - __try { +//~ __try { if (Type == FIF_UNKNOWN) { Type = FreeImage_GetFIFFromFilename(BmpFile); if (Type == FIF_UNKNOWN) { @@ -1429,10 +1435,10 @@ } else { Image = 0; } - } - __except (exfilt()) { - Image = 0; - } +//~ } +//~ __except (exfilt()) { +//~ Image = 0; +//~ } #else croak("FreeImage is not supported in this build!\n"); #endif @@ -1827,7 +1833,7 @@ CODE: RETVAL = NULL; #ifdef GHOST - __try { +//~ __try { if (gsapi_new_instance(&minst, NULL) == 0) { sprintf(pdfpath, "-sOutputFile=%s", pdf); if (gsapi_init_with_args(minst, gsargc, (LPSTR *)gsargv) == 0 +) { @@ -1836,8 +1842,8 @@ } gsapi_delete_instance(minst); } - } - __except (exfilt()) { } +//~ } +//~ __except (exfilt()) { } #else croak("Ghostscript is not supported in this build!\n"); #endif
        Hi thanks for your help. The problem that I have is that this is above my head. I wrote the programs I use a few years back when it was easy to install and I don't really want to go backwards and install all of this over again.

        I created a new file called what you suggested and put in the contents like you said and then ran this and this is what I got.

        C:\>cpanp -z Win32::Printer patch -p1 -i./Win32-Printer-0.9.0-formingw.diff
        Set up gcc environment - 3.4.5 (mingw-vista special r3)
        ERROR 'patch' does not contain an author part

        ERROR Cannot find 'patch' in the module tree

        No such module: patch
        Key 'p1' is not a valid key for CPANPLUS::Internals::Fetch::_fetch provided by C PANPLUS::Module::fetch at C:/Perl/lib/CPANPLUS/Module.pm line 580.
        Microsoft Windows Version 5.2.3790
        (C) Copyright 1985-2003 Microsoft Corp.

        C:\Documents and Settings\Administrator\Application Data\.cpanplus\5.16.1\build\ Win32-Printer-0.9.0>

        Could you please give me more defined steps so that I can get this accomplished. I would be in your debt.