Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Shorten-Bitly CPAN distribution.

Report information
The Basics
Id: 48565
Status: resolved
Priority: 0/
Queue: WWW-Shorten-Bitly

People
Owner: Nobody in particular
Requestors: joerg [...] joergmeltzer.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Load credentials from $HOME/.bitly file
I think it would be a nice idea to add a configfile e.g. $HOME/.bitly to the distribution, so you don't have to specify credentials every time you shorten a url. I have included a patch to W::S::B v1.10. perl -MToolSet::y -e 'print WWW::Shorten::Bitly->new->shorten(URL=>pop)' "http://search.cpan.org/search?query=WWW::Shorten::Bitly" http://bit.ly/3DzRYP
Subject: bitlyrc.patch
--- WWW-Shorten-Bitly-1.10-k9dlNO/lib/WWW/Shorten/Bitly.pm 2009-06-24 13:15:28.000000000 +0200 +++ WWW-Shorten-Bitly-1.10-cIDHiD.mod/lib/WWW/Shorten/Bitly.pm 2009-08-09 21:36:54.000000000 +0200 @@ -97,6 +97,17 @@ my ($class) = shift; my %args = @_; $args{source} ||= "perlteknatusbitly"; + use File::Spec; + my $bitlyrc = $^O =~/Win32/i ? File::Spec->catfile($ENV{HOME}, "_bitly") + : File::Spec->catfile($ENV{HOME}, ".bitly"); + if (-r $bitlyrc){ + open my $fh, "<", $bitlyrc or die "can't open .bitly file $!"; + while(<$fh>){ + $args{USER} ||= $1 if m{^USER=(.*)}; + $args{APIKEY} ||= $1 if m{^APIKEY=(.*)}; + } + close $fh; + } if (!defined $args{USER} || !defined $args{APIKEY}) { carp("USER and APIKEY are both required parameters.\n"); return -1; @@ -303,6 +314,14 @@ return $WWW::Shorten::Bitly::VERSION; }#version +=head1 FILES + +$HOME/.bitly or _bitly on Windows Systems. + +You may omit USER and APIKEY in the constructor if you set them in the .bitly config file on separate lines using the syntax: + +USER=username +APIKEY=apikey =head1 AUTHOR
From: pjain
On Sun Aug 09 15:44:51 2009, JMELTZER wrote: Show quoted text
> I think it would be a nice idea to add a configfile e.g. $HOME/.bitly > to the distribution, so you don't have to specify credentials every time > you shorten a url. > > I have included a patch to W::S::B v1.10. > > perl -MToolSet::y -e 'print WWW::Shorten::Bitly->new->shorten(URL=>pop)' > "http://search.cpan.org/search?query=WWW::Shorten::Bitly" > http://bit.ly/3DzRYP
Patch is integrated along with a few others. New version is in testing right now. Will release once testing is complete. Thanks for your contribution.
This has been fixed for quite some time and the new release I'm readying to push out will continue having it available. Thanks, Chase