Catalyst::Model::EVDB - EVDB model class for Catalyst
# Use the Catalyst helper script/myapp_create.pl model EVDB EVDB xxxxxxxxxxxxxxxx # lib/MyApp/Model/EVDB.pm package MyApp::Model::EVDB; use base qw/Catalyst::Model::EVDB/; __PACKAGE__->config( app_key => 'xxxxxxxxxxxxxxxx', ); 1; # In a controller action my %args = ( location => 'Gainesville, FL', keywords => 'tag:music', ); my $evdb = $c->model('EVDB'); my $results = $evdb->call('events/search', \%args) or die 'Error searching for events: ' . $evdb->errstr;
This is the EVDB::API model class for Catalyst. EVDB::API is a Perl interface to EVDB, the Events and Venues Database.
Please note that EVDB API methods require an application key.
For more information on EVDB, or to obtain an application key, see http://api.evdb.com/.
Create a new EVDB model component, using app_key as specified in your configuration.
app_key
Return the EVDB API error message.
Login using the specified username and password. For example:
# In a controller action (don't forget validation!) my $username = $c->req->param('username'); my $password = $c->req->param('password'); my $evdb = $c->model('EVDB'); $evdb->login(username => $username, password => $password) or die 'Error logging in: ' . $evdb->errstr;
Alternatively, you can set a username and password in the configuration for your model class. They will be used when this method is called without arguments. For example:
# In your model class __PACKAGE__->config( app_key => 'xxxxxxxxxxxxxxxx', username => 'danieltwc', password => 'secret', ); # In a controller action my $evdb = $c->model('EVDB'); $evdb->login or die 'Error logging in: ' . $evdb->errstr; # Call an EVDB method which requires authentication my %args = ( title => 'Lamb', start_time => '2006-03-18T21:00:00', tags => 'music', venue_id => 'V0-001-000160549-4', ); my $response = $evdb->call('events/new', \%args);
This method also supports passwords which have already been hashed using MD5. Use the password_md5 key instead of password when calling the method or in your configuration.
password_md5
password
Catalyst::Helper::Model::EVDB
Catalyst
EVDB::API
Daniel Westermann-Clark <danieltwc@cpan.org>
Brian Cassidy, for clever new code
new
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Model::EVDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Model::EVDB
CPAN shell
perl -MCPAN -e shell install Catalyst::Model::EVDB
For more information on module installation, please visit the detailed CPAN module installation guide.