CPANLists::Server - Application that runs on cpanlists.org
This document describes version 0.02 of CPANLists::Server (from Perl distribution CPANLists-Server), released on 2014-05-17.
You probably do not want to install this. This distribution contains the code to run on cpanlists.org.
For the client program, see App::cpanlists.
Currently to use this module, you have to do two things. This is ugly and might change in the future.
Set database handle at startup
$dbh = DBI->connect(...); CPANLists::Server::__dbh($dbh);
Set PSGI environment for each request
Mainly so that __activity_log() can get REMOTE_ADDR etc from PSGI environment.
CPANLists::Server::__env($env);
Add an item to a list.
Arguments ('*' denotes required arguments):
comment => str
Comment.
Will be interpreted as Markdown
list_id* => int
name* => str
Item's name (i.e. module name/CPAN ID).
rating => int
Rating.
Return value:
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Add a comment to a list.
comment* => str
Check username and password against database.
Upon success, will return a hash of information, currently: id (user numeric ID), email.
id
email
password* => str
username* => str
Check if session with certain ID exists and not expired.
id* => str
Session information (any)
Create a new list.
description => str
A longer (one to several paragraphs) of description.
Will be interpreted as Markdown.
For module lists, module names in the form of Foo::bar or mod://Foo::bar or mod://foo will be detected and added as items if indeed are CPAN module names.
Foo::bar
mod://Foo::bar
mod://foo
items => array
List items.
Alternatively, you can leave this empty and add items one-by-one using add_item().
The list title.
Examples: "Steven's most favorite modules", "Steven's favorite authors", "Modules to do blah", "Top ten modules you'll want for christmas 2014".
scan_modules_from_description => bool (default: 0)
Whether to scan module names from description and add them as items (for module lists only).
tags => array
Tags.
type* => str
List type, either m (for modules) or a (authors).
email* => str
first_name => str
last_name => str
note => str
Delete an item from a list.
Delete a list.
id* => int
reason => str
Optional reason for deletion.
Delete a single list comment.
Get signin URL via BitCard API (bitcard.org).
To signin via BitCard, first call this function. You will get login URL (to bitcard.org). Go to the login URL and enter your credentials. Afterwards, if the login is correct, you will get return URL like, which you need to follow:
https://cpanlists.org/api/verify_bitcard_signin?bc_confirmed=1&...
Either follow this URL, or pass the parameters to the verify_bitcard_signin function yourself. If signin is verified, a success status (200) will be returned along with session ID to use. Session ID can be used as password in HTTP authenticaion e.g.:
verify_bitcard_signin
curl -u USERNAME:SESSION_ID https://cpanlists.org/api/SOME_FUNC?PARAM1=...
By default session ID can be used for 6 (six) months. If session is expired, you can signin again.
No arguments.
Get details about a list.
items => bool (default: 1)
Whether to retrieve list's items.
Get a single list comment.
Get user information either by email or username.
email => str
username => str
Like a list.
You are allowed to like your own list.
List ID.
List items of a list.
List comments to a list.
id => int
List available lists.
creator => str
has_tags => array
Only include lists containing these tags.
lacks_tags => array
Only include lists not containing these tags.
query => str
result_limit => int (default: 5000)
Limit number of results.
type => str
Filter only certain type of lists ("a" means lists of authors only, "m" means lists of modules only).
Unlike a list.
Update a list item.
Item's name.
new_comment => str
Item's new comment.
If not specified, comment will not be changed
new_rating => str
Item's new rating.
If not specified, rating will not be changed
Update a list.
new_description => str
List's new description.
If not specified, description will not be changed
new_items => array
List's new items.
If not specified, items will not be changed
new_name => str
List's new name.
If not specified, name will not be changed
new_tags => array
List's new tags.
If not specified, tags will not be changed
Update a list comment.
If not specified, comment will not be replaced.
Verify URL parameters returned by BitCard.
See get_bitcard_signin_url for more information on signing in via BitCard.
get_bitcard_signin_url
bc_confirmed => any
bc_email => any
bc_fields => any
bc_id => any
bc_name => any
bc_sig => any
bc_ts => any
bc_username => any
bc_version => any
Session ID (hash) =head1 TODO
App::cpanlists
Please visit the project's homepage at https://metacpan.org/release/CPANLists-Server.
Source repository is at https://github.com/sharyanto/perl-CPANLists-Server.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=CPANLists-Server
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install CPANLists::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPANLists::Server
CPAN shell
perl -MCPAN -e shell install CPANLists::Server
For more information on module installation, please visit the detailed CPAN module installation guide.