?
Solved

Can't locate Win32/Service.pm in @INC (@INC contains:

Posted on 2007-11-14
3
Medium Priority
?
2,189 Views
Last Modified: 2008-02-01
I am trying to use same perl script both on Windows and Unix enviornment, it works on windows fine but I get below error on Unix

Can't locate Win32/Service.pm in @INC (@INC contains: /home/s/lib /usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2 /usr/opt/perl5/lib/site_perl .) at test.pm line 25.
BEGIN failed--compilation aborted

on test.pm at line 25 I have this entry
use Win32::Service;

I have to comment out above line in order to make it work on Unix, is there a way that I could run the same perl script with having 2 verions (windows and Unix) of it?
I would appreciate your help
0
Comment
Question by:khanzada19
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Morcalavin earned 375 total points
ID: 20281123
I don't know the best solution, but I use this on a few scripts.

#!/usr/bin/perl
BEGIN
{
        if($^O eq "MSWin32")
        {
                require Win32::Service;
        }
}
0
 
LVL 18

Expert Comment

by:Morcalavin
ID: 20281128
It's worth noting that Win32::Service is only going to work on windows systems, so if you try to make use of it in unix it's going to croak.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 20281443
The code for Morcalavin will let your script run, but there will likely be other errors if you use any functions from the Win32::Service module.

What is it that the script does on windows?  What do you want it to do on unix?
What windows calls services are what unix calls daemons.  Do you want to monitor a daemon process?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Simple Linear Regression
Starting up a Project

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question