Perl サンプルモジュール package ECNavi::HotNews::API::Counter; use strict; use warnings; our $VERSION = 0.01; use URI; use LWP::UserAgent; BEGIN { use Carp; our $HAVE_JSON_SYCK; eval { require JSON::Syck; $HAVE_JSON_SYCK = 1 }; eval { require JSON } unless $HAVE_JSON_SYCK; Carp::croak("JSON::Syck or JSON required to use " . __PACKAGE__) if $@; *_parse_json = $HAVE_JSON_SYCK ? sub { JSON::Syck::Load($_[1])