Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use File::HomeDir instead of the env variable

  • Loading branch information...
commit a181a66620cff8ae7e236c52e001bf11dcf985b9 1 parent 912a6ef
@wchristian wchristian authored committed
Showing with 9 additions and 6 deletions.
  1. +2 −1  Makefile.PL
  2. +5 −4 lib/Net/LastFMAPI.pm
  3. +2 −1  sync-api-docs.pl
View
3  Makefile.PL
@@ -11,7 +11,8 @@ LWP::UserAgent
Digest::MD5
JSON::XS
File::Slurp
- File::Path }
+ File::Path
+ File::HomeDir }
}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Net/LastFMAPI.pm', # retrieve abstract from module
View
9 lib/Net/LastFMAPI.pm
@@ -8,6 +8,7 @@ use JSON::XS;
use YAML::Syck;
use File::Slurp;
use File::Path 'make_path';
+use File::HomeDir 'my_home';
use URI;
use Exporter 'import';
our @EXPORT = ('lastfm', 'lastfm_config', 'lastfm_iter');
@@ -22,8 +23,8 @@ our $ua = new LWP::UserAgent(agent => "Net::LastFMAPI/$VERSION");
our $username; # not important
our $xml = 0;
our $cache = 0;
-our $cache_dir = "$ENV{HOME}/.net-lastfmapi-cache/";
-our $sk_symlink = "$ENV{HOME}/.net-lastfmapi-sessionkey";
+our $cache_dir = my_home()."/.net-lastfmapi-cache/";
+our $sk_symlink = my_home()."/.net-lastfmapi-sessionkey";
sub load_save_sessionkey { # see get_session_key()
my $key = shift;
@@ -497,7 +498,7 @@ It will be sought when an authorised request is needed.
If it is not saved then on-screen instructions should be followed to authorise
with whoever is logged in to L<last.fm>.
-It is saved in the symlink B<$ENV{HOME}/.net-lastfmapi-sessionkey>. This is
+It is saved in the symlink B<File::HomeDir::my_home()/.net-lastfmapi-sessionkey>. This is
probably fine.
Consider altering the subroutines B<talk_authentication>, B<load_save_sessionkey>,
@@ -515,7 +516,7 @@ hacking, though, getting perl data is much more convenient.
$Net::LastFMAPI::cache = 1
- $Net::LastFMAPI::cache_dir = "$ENV{HOME}/.net-lastfmapi-cache/"
+ $Net::LastFMAPI::cache_dir = File::HomeDir::my_home()."/.net-lastfmapi-cache/"
Does caching. Default cache directory is shown. Good for development.
View
3  sync-api-docs.pl
@@ -3,7 +3,8 @@
use warnings;
use v5.10;
use File::Slurp;
-use lib "$ENV{HOME}/pquery-pm/lib";
+use File::HomeDir 'my_home';
+use lib my_home()."/pquery-pm/lib";
use pQuery;
use Time::HiRes "usleep";
Please sign in to comment.
Something went wrong with that request. Please try again.