Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

networking with perl

by varalaxmibbnl (Acolyte)
on Sep 06, 2013 at 11:59 UTC ( #1052697=perlquestion: print w/replies, xml ) Need Help??
varalaxmibbnl has asked for the wisdom of the Perl Monks concerning the following question:

if i run this code i get (Can't locate in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at line 3. BEGIN failed--compilation aborted at line 3.) this error.... i don't understand what is the problem in this plz help me out for this

use strict; use LWP::Simple; # from CPAN use JSON qw( decode_json ); # from CPAN sub getLatLong($){ my ($address) = @_; my $format = "json"; #can also to 'xml' my $geocodeapi = ""; my $url = $geocodeapi . $format . "?sensor=false&address=" . $addres +s; my $json = get($url); my $d_json = decode_json( $json ); my $lat = $d_json->{results}->[0]->{geometry}->{location}->{lat}; my $lng = $d_json->{results}->[0]->{geometry}->{location}->{lng}; return ($lat, $lng); }

Replies are listed 'Best First'.
Re: networking with perl
by toolic (Bishop) on Sep 06, 2013 at 12:19 UTC
    This error is telling you that the JSON module cannot be found in your Perl search path directories (@INC). Most likely, you did not install it; to do so, you could use cpan.

    Or, maybe you did install it, but you need to point to it: see PERL5LIB.

Re: networking with perl
by daxim (Chaplain) on Sep 06, 2013 at 13:30 UTC
    Since your @INC includes /etc/perl, I guess you are running a Debian system, or one derived from it. Install the package libjson-perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1052697]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2018-01-20 12:18 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.