In Sawtooth we are able to include our own Perl library file which is in grpahics path by using the "require" statement after getting response from Zach. You can see the response in the below link.
https://www.sawtoothsoftware.com/forum/13961/perl-modules-in-ssi-for-code-reusability
But when we are using the same thing within Lighthouse studio (9.5.3), we are getting a script error while running the survey locally using "Test Survey" option whereas when the same is uploaded into hosting server and in the link we are not getting any error and server is able to compile our Perl code.
Below is the script error shown while the survey is run locally
Error
There is an error in list building: Script:ADD("A1List"); RANDOMIZE(); require "../graphics/JRAPerl.pl"; my $li=LISTVALUESARRAY("A1Const");my $l=substr($li,1,length($li)-2);my @ar=split(",",$l); my @nums=(7,8,9); my @RowArray=JRAPerl::GroupRandN(\@nums,\@ar,0); my @nums1=(11,12); @RowArray=JRAPerl::GroupRandN(\@nums1,\@RowArray,1); REMOVE("A1List",1,15); for(my $a=0;$a<@RowArray;$a++) { ADD("A1List",$RowArray[$a]); } [ID: 132]
System Error:
Can't locate ../graphics/JRAPerl.pl in @INC (@INC contains: E:/LIVEPR~1/PROGRA~1/LIGHTH~1/PROG_T~2/TESTSU~1/cgi-bin E:/Live Projects/Programming Templates/Light House Studio Templates/Prog_Template - Copy/Test Survey/cgi-bin C:/Program Files/Sawtooth Software/Lighthouse Studio 9.5.3/perl/site/lib C:/Program Files/Sawtooth Software/Lighthouse Studio 9.5.3/perl/vendor/lib C:/Program Files/Sawtooth Software/Lighthouse Studio 9.5.3/perl/lib .) at (eval 124) line 4, line 18.
Can anyone would let us know if any other keyword or procedure would help us to execute the Perl code written in our own external Perl library file when the survey is run locally.
Thank you!
Perl Modules in Lighthouse for code re-usability
Resolved
2 replies