Net-LastFM-Submission
view release on metacpan or search on metacpan
examples/enc.pl view on Meta::CPAN
use Net::LastFM::Submission 0.61;
use Data::Dumper;
my $a = 'Ïðèâåò';
# Encode::_utf8_on($a);
warn Encode::is_utf8($a);
warn $a = Net::LastFM::Submission::encode_data($a, 'cp1251');
warn Encode::is_utf8($a);
warn $a;
my $conf = require '.lastfmrc';
my $submit = Net::LastFM::Submission->new(map { $_ => $conf->{$_} } 'user', 'password');
warn Dumper $submit->handshake;
warn Dumper $submit->submit(
'artist' => 'Àðòèñò',
'title' => 'Ïåñíÿ',
'time' => time - 10*60,
);
examples/poe.pl view on Meta::CPAN
#!/usr/bin/perl
use strict;
use utf8;
use lib qw(../lib ..);
BEGIN { $ENV{'SUBMISSION_DEBUG'}++ };
use POE qw(Component::Net::LastFM::Submission);
use Data::Dumper;
my $conf = require '.lastfmrc';
POE::Component::Net::LastFM::Submission->spawn(
Alias => 'LASTFM_SUBMIT',
LastFM => {map { $_ => $conf->{$_} } 'user', 'password'},
);
POE::Session->create(
options => { trace => 1 },
inline_states => {
_start => sub {
examples/poe_client.pl view on Meta::CPAN
use strict;
use utf8;
use lib qw(../lib ..);
BEGIN { $ENV{'SUBMISSION_DEBUG'}++ };
use POE qw(Component::Client::HTTP);
use POE::Component::Net::LastFM::Submission 0.24; # support an existing client
use Data::Dumper;
my $conf = require '.lastfmrc';
POE::Component::Client::HTTP->spawn(
Alias => 'HTTP_CLIENT',
Agent => 'My http client/1.0',
Timeout => 1,
# ...
);
POE::Component::Net::LastFM::Submission->spawn(
Alias => 'LASTFM_SUBMIT',
examples/test.pl view on Meta::CPAN
use utf8; # encoding="utf-8"
use strict;
use lib qw(../lib ..);
BEGIN { $ENV{'SUBMISSION_DEBUG'}++ };
use Net::LastFM::Submission;
use Data::Dumper;
warn $Net::LastFM::Submission::VERSION;
my $conf = require '.lastfmrc';
my $submit = Net::LastFM::Submission->new(map { $_ => $conf->{$_} } 'user', 'password');
$submit->handshake;
warn Dumper $submit->submit(
'artist' => 'ÐÑÑиÑÑ1',
'title' => 'ÐеÑнÑ1',
'time' => time - 10*60,
);
use strict;
use utf8;
use Test::More tests => 9;
use Test::Exception;
use lib qw(../lib ..);
use Net::LastFM::Submission;
use LWP::UserAgent;
my $conf = require '.lastfmrc';
# diag "Testing Net::LastFM::Submission $Net::LastFM::Submission::VERSION, Perl $], $^X";
throws_ok { Net::LastFM::Submission->new } qr/Need user name/, 'empty new';
throws_ok { Net::LastFM::Submission->new(user => $conf->{'user'}) } qr/Need shared data/, 'shared dara';
my $standard = Net::LastFM::Submission->new(map { $_ => $conf->{$_} } 'user', 'password'); # standard
my $web = Net::LastFM::Submission->new(map { $_ => $conf->{$_} } 'user', 'api_key', 'api_secret', 'session_key'); # web
ok $standard->{'auth'}->{'type'} eq 'standard', 'standard auth';
#!/usr/bin/perl
use strict;
use utf8;
use Test::More tests => 26;
use lib qw(../lib ..);
use Net::LastFM::Submission 'encode_data';
my $conf = require '.lastfmrc';
# diag "Testing Net::LastFM::Submission $Net::LastFM::Submission::VERSION, Perl $], $^X";
my $submit = Net::LastFM::Submission->new('enc' => 'utf8', map { $_ => $conf->{$_} } 'user', 'password');
# error
for ($submit->_error('test')) {
my $w = 'test error';
ok ref $_ eq 'HASH', "$w";
( run in 0.308 second using v1.01-cache-2.11-cpan-0d8aa00de5b )