STAF perl error

ABanthu
2012-04-01
2013-06-12
  • ABanthu
    ABanthu
    2012-04-01

    Hello all,
    I have got an error while using the STAF with Perl support. I have a perl code which uses another perl module inside it and takes some variables. For example I am showing this code to you.
    use PLSTAF;
    $handle = STAF::STAFHandle->new("Request1");
    use lib '..';
    #Needed to access variables declared in MyConfigModule module
    use MyConfigModule;
    print "Anusha\n";
    print $name;
    sleep(10);
    $name is a variable given in the MyConfigModule.pm file. I want to use that variable in my script.
    When I run the perl script alone without using PLSTAF package it runs properly and prints properly.
    But if I include PLSTAF package and run uisng staf command it is giving the following error.
    can't locate MyConfigModule.pm in @inc <@inc contains.. C:\Perl\lib C:\Perl\site\lib>
    Even if I include these modules in the specified locations the same error is coming.
    Can someone please tell me the solution to this problem

    Thanks in advance
    Ansuha

     
  • Sharon Lucas
    Sharon Lucas
    2012-04-02

    Generally, issues where a script isn't running via STAF are due to not understanding that when running a process via STAF, the process is run in the environment in which STAFProc is running.  So, you need to make sure that all the environment variables you require are set in STAFProc's environment (and/or overridden via the ENV option(s) on a PROCESS START request).  Also, if your script depends on running in a certain directory, be sure to specify the WORKDIR option on your PROCESS START request.

    Have you tried running your perl script using the PLSTAF package but not running it via a STAF PROCESS START request to see if it works then?  Once you get that working, then try running it via a STAF PROCESS START request.

    If you are still having a problem, be sure to post your exact STAF PROCESS START request and the output from a "STAF local VAR LIST" request which shows the environment variables that STAFProc is using.