PrePAN

Sign in to PrePAN

PrePAN provides a place
to discuss your modules.

CLOSE

Requests for Reviews Feed

Tk::DBI::LoginDialog DBI login dialog class for Perl/Tk.

DESCRIPTION "Tk::DBI::LoginDialog" is a dialog widget which interacts with the DBI interface specifically to attempt a connection to a database, and thus returning a database handle.

   This widget allows the user to enter username and password details into
   the dialog, and also to select driver, and other driver-specific
   details where necessary.

tmcmeeki@github 1 comment

Hash::Squash Remove numbered keys from a nested object

This package provides B and B subroutines to simplify hash/array structures.

ernix@github 5 comments

Text::Composer Handy Text Builder with Parameters and Logics

DESCRIPTION

I couldn't find nice modules which can handle parameterized text. Please let me know if you know similar modules.

SYNOPSIS

use Text::Composer;
my $composer = Text::Composer->new(
    start_symbol => '{{',
    end_symbol => '}}',
    recursive => 1,
);

say $composer->compose('My name is {{ name }}', +{ name => 'i110' });
# 'My name is i110'

say $composer->compose('My name is {{ name }}', +{
    name => '{{prefix}} i110',
    prefix => 'Mr.',
});
# 'My name is Mr. i110'

say $composer->compose('\{\{ escaped \}\} key will not be expanded', +{
    escaped => 'gununu',
});
# '{{ escaped }} key will not be expanded'

say $composer->compose('{{ with_complicated_logic }}', +{
    with_complicated_logic => sub {
        my ($self, $key) = @_;
        "This text was composed $key by {{ twitter_id }}";
    },
    twitter_id => sub {
        '@{{ user_name }}';
    },
    user_name => 'i110',
});
# 'This text was composed with_complicated_logic by @i110'

use Text::Composer qw(compose_text);
compose_text('{{without_oo_interface}}', +{ without_oo_interface => 'hakadoru' });
# 'hakadoru'

METHODS

  • new ( %args )

    • $recursive

      Expand parameters recursively. Default is true.

    • $start_symbol

    • $end_symbol

      Delimiters for parameters. Defaults are '{{' and '}}', respectively.

  • compose ( $template, $params )

    Compose rext using a template and parameters.

    • $template

      Parameterized text. Required.

    • $params

      Parameters which will be rendered in the template. This must be a hashref or coderef, otherwise it will throw an exception. And also, hash's values must be a scalar or coderef, otherwise it will throw an exception. Both of these coderefs take the same two arguments, Text::Composer instance itself and the accessing key, and should return a scalar or coderef. If the return value is a coderef, it will be called again (and repeat this process until you get a scalar value).

i110@github 3 comments

WebServices::Zazzle Zazzle REST API Order Integration

Module for integration with Zazzle.com REST API.

These methods allow for interfacing with the REST API provided by Zazzle.com for their customers. It is designed as the back-end piece to a web-based Order Management System. The construction of these methods as well as the suggested error handling followed came from the document provided by: 'Zazzle Vendor API Documentation v1.12.pdf'.

troby@github 6 comments

GitInsight Predict your github contributions using Bayesian inference and Markov chain

NAME

GitInsight - Predict your github contributions using Bayesian inference and Markov chain

SYNOPSIS

gitinsight --username [githubusername] (--nodaystats) #using the shipped bin

#or using the module

my $Insight= GitInsight->new(no_day_stats=>0);
$Insight->contrib_calendar("markov"); #specify here the github username
my $Result= $Insight->process;
$Result = $Insight->{result};
# $Result contains the next week predictions and is an arrayref of arrayrefs    [  [ 'Sat', 1, '2014-07-1', [ 0 ,  '0.151515151515152', '0.0606060606060606', '0.0404040404040404',  0  ]  ],   ..   [            'DayofWeek',      'winner_label',  'day' ,  [             probability_label_0,  probability_label_1,              probability_label_2,          probability_label_3,              probability_label_4            ]          ]]

DESCRIPTION

GitInsight is module that allow you to predict your github contributions in the "calendar contribution" style of github (the table of contribution that you see on your profile page).

HOW DOES IT WORK?

GitInsight generates a transation probrability matrix from your github contrib_calendar to compute the possibles states for the following days. Given that GitHub split the states thru 5 states (or here also called label), the probability can be inferenced by using Bayesian methods to update the beliefs of the possible state transition, while markov chain is used to predict the states. The output of the submitted data is then plotted using Cellular Automata.

THEORY

We trace the transitions states in a matrix and increasing the count as far as we observe a transition (https://en.wikipedia.org/wiki/Transition_matrix), then we inference the probabilities using Bayesan method https://en.wikipedia.org/wiki/Bayesian_inference https://en.wikipedia.org/wiki/Examples_of_Markov_chains.

INSTALLATION

GitInsight requires the installation of gsl (GNU scientific library), gd(http://libgd.org/), PDL and PDL::Stats (to be installed after the gsl library set).

on Debian:

    apt-get install gsl-bin libgs10-devt
    apt-get install pdl libpdl-stats-perl libgd2-xpm-dev

For the web interface also the following are required: ruby-sass ruby-compass

It's reccomended to use cpanm to install all the required deps, install it thru your package manager or just do:

cpan App::cpanminus

After the installation of gsl, you can install all the dependencies with cpanm:

cpanm --installldeps .

METHODS

contrib_calendar($username)

Fetches the github contrib_calendar of the specified user

process

Calculate the predictions and generate the CA

start_day

Returns the first day of the contrib_calendar

last_day

Returns the last day of the contrib calendar (prediction included)

prediction_start_day

Returns the first day of the prediction (7 days of predictions)

AUTHOR

mudler

COPYRIGHT

Copyright 2014- mudler

LICENSE

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

SEE ALSO

mudler@github 1 comment

Unicode::Security Unicode security mechanisms

Implements the Unicode security mechanisms as described in the Unicode Technical Standard #39.

FUNCTIONS

confusable

$truth = confusable($string1, $string2)

Returns true if if the two strings are confusable.

skeleton

$skel = skeleton($string)

The skeleton transform is used internally by the confusable algorithm. The result is not intended for display, storage or transmission. It should be thought of as an intermediate processing form, similar to a hashcode. The characters in the skeleton are not guaranteed to be identifier characters.

restriction_level

$level = restriction_level($string [, $non_xid_regex])

Returns the restriction level (0-5) of the string. The default Identifier Profile matches against \P{XID_Continue}. If you want to use a different Identifier Profile, you can pass in an optional regular expression to test for non-identifier characters.

soss

%soss = soss($string)

The set of Unicode character script names for a given string. Used internally by the restriction level algorithm.

SEE ALSO

http://www.unicode.org/reports/tr39/

TODO

gray@github 0 comments

JSON::RPC::Spec JSON-RPC 2.0 Implementation

There are a lot of implementation of JSON-RPC, but I made module that returns a JSON simply because I wanted.

example: PSGI application

use strict;
use warnings;
use JSON::RPC::Spec;
use Plack::Request;

my $rpc = JSON::RPC::Spec->new;

$rpc->register(echo => sub { $_[0] });

sub {
    my ($env) = @_;
    my $req   = Plack::Request->new($env);
    my $body  = $rpc->parse($req->content);
    if (length $body) {
        return [200, ['Content-Type' => 'application/json'], [$body]];
    }
    return [204, [], []];
};

nqounet@github 0 comments

Samba::Smbstatus Read active Samba server data from smbstatus

This is a simple module to make access to the data Samba makes available via the smbstatus easier.

I've wound up needing this for several system administration tasks, so thought I'd make it a proper module and share it.

Is this the best name for this module?

laufeyjarson@github 0 comments

Parse::STDF Parses files in Standard Test Data Format into Perl objects

Standard Test Data Format (STDF) is a widely used standard file format for semiconductor test information. It is a commonly used format produced by automatic test equipment (ATE) platforms from companies such as LTX-Credence, Roos Instruments, Teradyne, Advantest, and others.

STDF is compacted into binary format according to a well defined STDF specification originally designed by Teradyne. The record layouts, field definitions, and sizes are all defined in the specification. Over the years, parser tools have been developed to decode this binary format in several scripting languages, but as of yet nothing has been released to CPAN for perl.

This module would be a first attempt. It utilizes an underlying open sourced C library called libstdf (http://freestdf.sourceforge.net/) to do the grunt work of parsing binary data into structs (STDF records) as defined by the specification.

An object-oriented Parse::STDF module is provided for the end user. It's object methods make the API calls to to libstdf.

erickjordan@github 2 comments

AnyEvent::Handle::Mock Helper for testing AnyEvent::Handle-based code

This class provides a filehandle that you can give to the AnyEvent::Handle constructor and methods to feed and pump from the handle.

Methods:

  • new: Constructor. No arguments.
  • fh: Returns the file handle to give to the AnyEvent::Handle constructor.
  • feed: Send data. Arguments are the same as "AnyEvent::Handle->push_read".
  • pump: Wait for data, synchronously: the event loop will run due to "->recv" on a condvar. Arguments are the same as "AnyEvent::Handle->push_write" (which means you can use any "anyevent_read_type"), except the callback is optional. If it is missing, the received data will be the return value of the method.

dolmen@github 0 comments