Giter Site home page Giter Site logo

text-karma's Introduction

NAME

Text::Karma - Process (and optionally store) karma points

SYNOPSIS

use 5.010;
use strict;
use warnings;
use Text::Karma;
use DBI;

my $dbh = DBI->connect("dbi:SQLite:dbname=karma.sqlite","","");
my $karma = Text::Karma(dbh => $dbh);

$karma->process_karma(
    nick  => 'someone',
    who   => 'someone!from@somewhere',
    where => '#in_here',
    str   => "this thing++ is awesome # some cool comment",
);

say "Karma for thing: ".$karma->get_karma("thing");

METHODS

new

Constructs and returns a Text::Karma object. Takes the following arguments:

'dbh', an optional database handle.

'table_prefix', a prefix to use for the table that will be created if you supplied a database handle.

process_karma

Processes karma from a string, and returns the results. They will also be stored in the database if you supplied a database handle to new. Takes the following arguments:

'nick', the nickname of the person who wrote the text. Required.

'who', the full name of the person who wrote the text. Required.

'where', the place where the person wrote the text. Required.

'str', the text that the person wrote. Required.

'self_karma', whether to allow people to affect their own karma. Optional. Defaults to false.

The return value will be an arrayref containing a hashref for each karma operation. They will have the following keys:

'subject', the subject of the karma operation (e.g. 'foo' in 'foo++').

'op', the karma operation (0 if it was '--', 1 if it was '++').

'comment', a potential comment for the karma change.

get_karma

This method returns the karma for a given subject from the database. Takes one argument, a subject to look up. If the subject is unknown, nothing is returns. Otherwise, you'll get a hashref with the following keys:

'up', number of karma upvotes for the subject.

'down', number of karma downvotes for the subject.

'score', the karma score for the subject ('up' minus 'down').

AUTHOR

Hinrik Örn Sigurðsson <[email protected]>

Apocalypse <[email protected]>

CONTACT

Email

You can email the authors of this module at [email protected] or [email protected] asking for help with any problems you have.

Internet Relay Chat

You can get live help by using IRC (Internet Relay Chat). If you don't know what IRC is, please read this excellent guide: http://en.wikipedia.org/wiki/Internet_Relay_Chat. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join the following networks/channels and get help:

  • MAGnet

    You can connect to the server at 'irc.perl.org', join the #perl-help channel, and talk to Hinrik or Apocalypse.

  • FreeNode

    You can connect to the server at 'irc.freenode.net', join the #perl channel, and talk to literal or Apocal.

  • EFnet

    You can connect to the server at 'irc.efnet.org', join the #perl channel, and talk to Hinrik or Ap0cal.

LICENSE AND COPYRIGHT

Copyright 2011 Hinrik Örn Sigurðsson and Apocalypse

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

text-karma's People

Contributors

apocalypse avatar hinrik avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.