TROGDOR has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm trying to write a perl script in a Windows environment that will detect the color of the pixel the cursor is pointing at. After some cpan searching, Win32::Screenshot looks ideal, as it allows me to do a quick capture of a specified (small) rectangle on the screen. This would be much more efficient than doing a full screen or window capture, and then picking through the data to find my pixel.

However, I'm having a tough time getting Win32::Screenshot to install correctly. It has a prerequisite of installing Image-Magick. I installed the windows binary, and during the installation, it also installed the perl interface. I verified this in ppm with a query:

15. Image-Magick 6.2.3 ImageMagick PERL Extension

According to the Screenshot README, that's the only prerequisite. So I run "perl Makefile.PL" in the Screenshot directory, and I get the following output:

C:\apps\Perl\dev\Win32-Screenshot-1.20>perl Makefile.PL Note (probably harmless): No library found for comctl32.lib Note (probably harmless): No library found for oldnames.lib Note (probably harmless): No library found for kernel32.lib Note (probably harmless): No library found for user32.lib Note (probably harmless): No library found for gdi32.lib Note (probably harmless): No library found for winspool.lib Note (probably harmless): No library found for comdlg32.lib Note (probably harmless): No library found for advapi32.lib Note (probably harmless): No library found for shell32.lib Note (probably harmless): No library found for ole32.lib Note (probably harmless): No library found for oleaut32.lib Note (probably harmless): No library found for netapi32.lib Note (probably harmless): No library found for uuid.lib Note (probably harmless): No library found for ws2_32.lib Note (probably harmless): No library found for mpr.lib Note (probably harmless): No library found for winmm.lib Note (probably harmless): No library found for version.lib Note (probably harmless): No library found for odbc32.lib Note (probably harmless): No library found for odbccp32.lib Note (probably harmless): No library found for msvcrt.lib Writing Makefile for Win32::Screenshot
If the only prerequisite is Image Magick, why are all these libraries missing??

nmake install produces the following error:

C:\apps\Perl\dev\Win32-Screenshot-1.20>nmake install Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cl -c -I. -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CO +NSOLE -DNO _STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPER +L_IMPLICIT _SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERS +ION=\"1.20 \" -DXS_VERSION=\"1.20\" "-IC:\apps\Perl\lib\CORE" Screenshot.c 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code + '0x1' Stop.
I assume "cl" is a c compiler, but I've never had to use a compiler to do a perl install, so what's going on here? Is there a way I can get this cl compiler, or can I specfiy a different compiler?

Any help with this is greatly appreciated.

Replies are listed 'Best First'.
Re: Installing Win32::Screenshot
by GrandFather (Saint) on Jul 24, 2005 at 22:46 UTC

    Those libs are standard with the MS compiler. Win32::Screenshot needs to build Screenshot.c and can't find the default compiler (MS's cl) to do it.

    Which doesn't answer your question, but does confirm your fears.


    Perl is Huffman encoded by design.
Re: Installing Win32::Screenshot
by Anonymous Monk on Jul 25, 2005 at 05:21 UTC
Re: Installing Win32::Screenshot
by rsilvergun (Acolyte) on Aug 30, 2007 at 13:12 UTC
    Use ppm. From a command line, run ppm install --nodeps Win32::Screenshot and it'll install and work just fine. The dependency checker can't find perl-magick, but that won't be a problem when you go to use it. Just make sure you've got these use directives:
    use win32::API; use Image::Magick; use Win32::Screenshot;
    and yes, they're case sensitive. I couldn't get the CaptureWindow() functions to work though. They capture the entire screen, not the window, but that shouldn't be a problem with what you're doing. Good Luck!