Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Win32::API in perl v5.20.2

by BillKSmith (Prior)
on Jul 01, 2015 at 15:43 UTC ( #1132848=perlquestion: print w/replies, xml ) Need Help??

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

I recently upgraded from Active State Perl 5.16.2 to 5.20.2 on my Win7 (64-bit) system. Most went well except for one script (which had been in daily use for a few years. It now fails with the message:
Can't locate object method "new" via package "Win32::API" at C:\USERS\ +BILL\PERL\ LIB/PDFPrint.pm line 15.

I have attached the module PDFPrint.pm referenced by the message. The code originally came from a post (Print PDF using Win32::OLE and Acrobat Reader) in this forum

Notes: In the install procedure, I saved and restored the ppm module configuration with ppm profile save/restore. While attempting to diagnose the problem, I noticed that a newer version of Win32::API was available on ppm. Installing the newer version did not change the result at all.

Would someone please suggest a way to resolve this issue.

I also have an unrelated issue with this “upgrade” because ActiveState has removed Perl/Tk from their ppm repository.

Bill

Replies are listed 'Best First'.
Re: Win32::API in perl v5.20.2
by marto (Cardinal) on Jul 01, 2015 at 16:02 UTC

    "I also have an unrelated issue with this “upgrade” because ActiveState has removed Perl/Tk from their ppm repository."

    If you're working on a Microsoft Windows platform Strawberry Perl makes life much easier. I can't reproduce your Win32::API problem on Win7, Strawberry 5.20, Win32::API v0.82.

      OMG I just read the front page on your Strawberry Perl link and my (software development) mouth is watering.

      If it lives up to its front page hype, I can see why so many of you grow Stawberries rather than live in an Active State.

      Normally I dread changing platforms, doing upgrades, etc. I can't recall the last time I was actually excited about the prospect of a change like this.

      Hmm. And I have a three-day weekend coming up. Hmmm...

        Everything on the Strawberry Perl's front page is true of ActivePerl too.
        You should be able to use them in parallel if you take the "portableZIP" edition. At least if you call your scripts with perl [switches] scriptname.pl
Re: Win32::API in perl v5.20.2
by Anonymous Monk on Jul 01, 2015 at 16:29 UTC

    Can't locate object method "new" via package "Win32::API" at foo.pl line 15.

    So you're missing a use Win32::API;

    I also have an unrelated issue with this “upgrade” because ActiveState has removed Perl/Tk from their ppm repository.

    <Nelson Muntz>Ha-ha!</Nelson Muntz>

    ppm install MinGW && cpan Tk

    or ppm install http://www.sisyphusion.tk/ppm/Tk.ppd

Re: Win32::API in perl v5.20.2
by fishmonger (Chaplain) on Jul 01, 2015 at 21:49 UTC

    Hi Bill,
    I'm going to point you in the same direction as marto. I moved away from ActiveState several years ago due to module install issues and have been using Strawberry perl which IMO is much better.

    However, with your current issue, it sounds like you're missing use Win32::API, which was already pointed out by another monk.

Re: Win32::API in perl v5.20.2
by syphilis (Bishop) on Jul 02, 2015 at 01:54 UTC
    ...ActiveState has removed Perl/Tk from their ppm repository

    You should be able to take care of that with:
    ppm install http://www.sisyphusion.tk/ppm/Tk.ppd --force

    Update: Ooops - essentially repeating advice already provided by marto.
    The sisyphusion ppm packages all want to install the same small gcc dll - and many version of PPM won't allow (without --force) the overwriting of a file that was precviously installed by PPM (even if the files are identical).
    Hence, installing from that repo usually requires --force.

    Cheers,
    Rob

      What else do I need to know?

      C:\Users\Bill\Perl>ppm install http://www.sisyphusion.tk/ppm/Tk.ppd -- +force ppm install failed: 403 Forbidden C:\Users\Bill\Perl>
      Bill
        What else do I need to know?

        Seems to be a problem with the website ... that I'll have to sort out later today.
        In the meantime, download:
        http://www.sisyphusion.tk/ppm/x64/Tk-520_x64.tar.gz

        Place that file in some folder and, in the same folder place a file named Tk.ppd that contains:
        <?xml version="1.0" encoding="UTF-8" ?> <SOFTPKG NAME="Tk" VERSION="804,033,0,0"> <TITLE>Tk</TITLE> <ABSTRACT>a graphical user interface toolkit for Perl</ABSTRACT> <AUTHOR>Nick Ing-Simmons</AUTHOR> <PROVIDE NAME="Tk" VERSION="804.033" /> <IMPLEMENTATION> <OS NAME="MSWin32" /> <ARCHITECTURE NAME="MSWin32-x64-multi-thread-5.20" /> <CODEBASE HREF="Tk-520_x64.tar.gz" /> </IMPLEMENTATION> </SOFTPKG>
        (Beware the dreaded wrap-around if you copy'n'paste that code - safer to grab it by clicking on the 'download' link.)

        Then 'cd' to that folder and run:
        ppm install Tk.ppd --force
        I think that should work as an interim method. It works for me.
        If it doesn't, please let us know.

        And I'll get the problem (which seems to be affecting all ppm packages) fixed as soon as I can.

        Cheers,
        Rob

        So where is the error message coming from? For what url? Increase verbosity in ppm and find out

        Also try force like suggested

Re: Win32::API in perl v5.20.2
by Laurent_R (Canon) on Jul 02, 2015 at 20:20 UTC
    I'm going to point you in the same direction as marto. I moved away from ActiveState several years ago due to module install issues and have been using Strawberry perl which IMO is much better.
    We have had the same discussion ongoing on a French Perl forum over the last two years or so, and we reached the same conclusion as FishMonger's quote above. Strawberry is currently much better.
      Thanks to martok, FishMonger, and Laurent_R for the strong recommendation of Strawberry perl. Many years ago, I was deterred from Strawberry by the installation process. I Chose ActiveState, and never looked back. I fresh look today suggests that this should no longer be a problem. I am not quite ready to make the switch yet, but it is great to know that I do have an option!
      Bill
        Hi Bill,

        Strawberry also offers a portable version, where everything is contained within a specific directory tree and nothing is changed to your system.

        In other words, you can install it and test it without having to decide immediately whether you really want to switch.

        Personally, when working on Windows (i.e. only at home, where I really need a Windows box because I am using some proprietary software applications that only exist on Windows and Mac, but not on Linux)), I prefer using Cygwin (because I prefer a Unix-like environment with a real shell and Unix commands), but I have both ActiveState and Strawberry installed on my PC, Strawberry is really better in terms of module management, IMHO.

        Anyway, the bottom line is that, with portable Strawberry, you can test it without having to decide to change immediately.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1132848]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2021-05-12 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (128 votes). Check out past polls.

    Notices?