Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can't locate Geo/Gpx.pm in @INC apache

Though there are many queries flowing around asking the same question. But here the error is thrown by apache instead of Perl. I am trying to create an XML Response for the client on Mac OS X Mavericks and have written the perl script as follows:


#!/usr/bin/perl -wT                                                                                                                                                                  use lib '/opt/local/lib/perl5/site_perl/5.16.1/Geo';use strict;use CGI;useGeo::Gpx;open (FH,"/tmp/temp/file.txt") or print("Unable to Open File");my $gpx =Geo::Gpx->new;my $cgi = CGI->new;print $cgi->header(-type=>"text/gpx",-status=>"200 OK");my $lon;my@arr=<FH>;foreach(@arr){my%waypoints;my $var = $_;my@lat= split(/\s+/,$var);#@waypoints=split(/\s+/,$_);                                                                                                                                                     $waypoints{$lat[0]}=$lat[1];$waypoints{$lat[2]}=$lat[3];$gpx->add_waypoint(\%waypoints);}my $xml = $gpx->xml;print $xml;open FILE,">/tmp/temp/xmlfile.xml" or die $!;print FILE $xml;close (FILE);close(FH);



For the apache to find the actual path of the Gpx.pm, I have used 'use lib' to show it the real path of the file. Although this script is working perfectly on command line, my apache server is throwing the following error:


[TueNov2618:34:512013][error][client 127.0.0.1]Can't locate Geo/Gpx.pm in @INC 
(@INC contains: /opt/local/lib/perl5/site_perl/5.16.1/Geo /Library/Perl/5.16/darwin-thread-multi-2level
/Library/Perl/5.16 /Network/Library/Perl/5.16/darwin-thread-multi-2level /Network/Library/Perl/5.16
/Library/Perl/Updates/5.16.2 /System/Library/Perl/5.16/darwin-thread-multi-2level /System/Library/Perl/5.16
/System/Library/Perl/Extras/5.16/darwin-thread-multi-2level /System/Library/Perl/Extras/5.16 .) at /Users/Rachit/Sites/temp.pl line 7.
[Tue Nov 26 18:34:51 2013] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at /Users/Rachit/Sites/temp.pl line 7.


I have used macports and have found searching through the Web that Mavericks has got perl 5.16 preinstalled. So apache may be using that and perl is using the macport installed libraries. On checking the paths mentioned by apache error_log file as I posted above, I have copied Gpx.pm in one of the libraries installed in Geo Folder but still not getting it resolved. On running 'which perl' The result


/opt/local/bin/perl


And 'which cpan' is giving


/opt/local/bin/cpan


Kindly fix this issue as I am not able to move forward because of this. And I am not so familiar with apache.


Thanks

MacBook Pro (13-inch Mid 2012), OS X Mavericks (10.9)

Posted on Nov 26, 2013 5:20 PM

Reply

There are no replies.

Can't locate Geo/Gpx.pm in @INC apache

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.