Sign in to PrePAN

PrePAN provides a place
to discuss your modules.


Requests for Reviews Feed

Scalar::IfDefined Apply block to scalar depending on whether the scalar is defined.


Takes a block and a scalar value.

If the scalar value is undef, the block is ignored and undef is returned straight away.

If the scalar value is defined, then the block is evaluated with $_ as the value passed in, and the result of the block is returned.

nmbooker@github 1 comment

Games::Dukedom Display agnostic implementation of the big iron game of Dukedom


boftx@github 1 comment

WWW::BetfairNG Object-oriented Perl interface to the Betfair JSON API

Betfair is an online betting exchange which allows registered users to interact with it using a JSON-based API. This module provides an interface to that service which handles the JSON exchange, taking and returning perl data structures (usually hashrefs). Although some checking of the existence of required parameter fields is done, and a listing of the BETFAIR DATA TYPES is provided below, it requires a level of understanding of the Betfair API which is best gained from their own documentation, available from

To use this library, you will need a funded Betfair account and an application key. To use the non-interactive log in, you will also need an SSL certificate and key (in seperate files, rather than a single .pem file). Details of how to create or obtain these, and how to register your certificate with Betfair are also available on the above website. The interactive login does not require an SSL certificate or key and is therefore easier to set up, but Betfair strongly recommend that unattended bots use the non-interactive version.

MyrddinWyllt@github 0 comments

Carp::Proxy Diagnostic delegation

Error messages in Perl are commonly coded with idioms like:

die 'explanation'
    if not $assertion;

The idiom is attractive when the explanation is simple. If an explanation grows to more than a few words, or if it requires calculation, then the surrounding flow becomes disrupted. The solution, of course, is to offload failing assertions to a subroutine.

Subroutines that perform diagnosis, compose error messages and throw exceptions tend to have repeated code at the beginning and end, with unique content somewhere in the middle. Carp::Proxy proposes a wrapper subroutine, called a Proxy, to factor out the repeated sections.

fatal 'user_subroutine'
    if not $assertion;

Proxys, like fatal(), serve as elaborate, customizable replacements for warn(), die() and members of the Carp:: family like confess(). If we look at warn(), die(), confess() and the like, we notice that they are all just different variations on two themes:

  • Add locational context to a user-supplied message.
  • Throw some kind of exception.

Carp::Proxy parameterizes the two themes into attributes of an exception object that is created whenever a Proxy is called. The Proxy passes the object to a user-defined "Handler" subroutine which is responsible for constructing the diagnostic message. When the Handler returns, the Proxy optionally adds "Context" (a stacktrace) to the message and performs "Disposition", typically by calling die().

When the object is constructed it captures the state of Perl's error variables, for later examination by the Handler. The object provides methods that aid in message composition. Attributes control message formatting, stacktrace generation and how Disposition will be handled.

The object overloads Perl's stringification operator with a message rendering method, causing uncaught exceptions to be nicely formatted. Exceptions that are caught can be modified and re-thrown.

thairman@github 1 comment

Geo::Region Geographical regions and groupings using UN M.49 and CLDR data

This class is used to create geographical regions and groupings of subregions and countries. Default regional groupings are provided using the Unicode CLDR v26 Territory Containment data, which is an extension of the United Nations M.49 standard.


Regions and subregions are represented with UN M.49 region codes, such as 419 for Latin America and 035 for Southeast Asia. Either the official format using a three-digit 0-padded string like '035' or an integer like 35 may be used with this class. Note when using the 0-padded format that it must be quoted as a string so as not to be treated as on octal literal. The CLDR also adds two additional two-letter region codes which are supported: EU for the European Union and QO for Outlying Oceania.


Countries and territories are represented with ISO 3166-1 alpha-2 country codes, such as JP for Japan and AQ for Antarctica, and are case insensitive. Unlike with region codes, the three-digit forms of country codes are not used by the CLDR or this class.


The new class method is used to construct a Geo::Region object along with the region argument and optional exclude argument.

  • region

    Accepts either a single region code or an array reference of region or country codes, resulting in a custom region.

    # countries in the Europen Union
    Geo::Region->new(region => 'EU')
    # countries in Asia plus Russia
    Geo::Region->new(region => [ 142, 'RU' ])
  • exclude

    Accepts values in the same format as region. This can be used to exclude countries or subregions from a region.

    # countries in Europe which are not in the European Union
    Geo::Region->new(region => 150, exclude => 'EU')


  • contains

    Given a country or region code, determines if the region represented by the Geo::Region instance contains it.

    if ( $region->contains($country) ) {
  • is_within

    Given a region code, determines if all the countries and regions represented by the Geo::Region instance are within it.

    if ( $subregion->is_within($region) ) {
  • countries

    Returns a list of country codes of the countries within the region represented by the Geo::Region instance.

    for ( $region->countries ) {

patch@github 0 comments

Bio::ViennaNGS Perl extension for Next-Generation Sequencing analysis

Bio::ViennaNGS is a collection of utilities and subroutines often used for Next-Generation Sequencing (NGS) data analysis. It comes with a set of utility programs for accomplishing routine tasks often required in NGS data processing. The utilities serve as reference implementation of the routines implemented in the library.

mtw@github 2 comments

App::DBBRowser New insert feature

Hello, I added the possibility to insert data into database tables to the latest developer releases.

There are 4 ways for the user to add the values for the "INSERT INTO":

Enter each time a column
Enter each time a row
Enter multiple rows
Read from a file

Id would be nice if I could get some feedback regarding these 4 input methods.

kuerbis@github 0 comments

Net::SNTP SNTP client and Server Module

This a single Client Server script that is based on RFC2030 (SNTP Protocol). It runs on while loop based on the interval defined by the server. It basically calculates 2 parameters (the roundtrip delay d and local clock offset t). This is my first attempt to wright a module so please take this in consideration upon reviewing my code.

thanos1983@github 0 comments

Mesos Perl bindings for Apache Mesos


Instead of implementing pure perl drivers, which would require a lot of knowledge of Mesos' internals(and is more likely to break in future versions), I decided to steal certain patterns from Mesos' python bindings. Like in the python bindings, the perl drivers contain instances of C++ drivers, which register C++ proxy schedulers/executors with the C++ drivers. In python, these C++ proxy classes were essentially wrappers around the registered Python classes, which just obtained the GIL, decoded protobuf messages, and called the desired python code. To avoid using perl threads, I decided to create a C++ channel between the C++ proxy classes, and the perl drivers. The C++ proxy classes would send the command name, and encoded args into the channel, and perl drivers would decode the args and invoke the correct method on the perl classes. In perl, the channel was implemented as a tied filehandle so that it could be passed directly to IO::Select or AnyEvent, and used in an IO loop.

I must admit that I am new to XS and perl guts, so I would greatly appreciate a look from someone with XS experience. I also had a small number of other, general concerns.


  • Namespace
    • would this be more appropriate under a different namespace(Net::Mesos, AnyEvent::Mesos)?
  • Architecture
    • does the use of a pipe/channel between the C++ threads and an AnyEvent IO watcher seem sane?
    • does using a tied filehandle, for the perl interface to the channel, seem sane?
    • any suggestions for how to better handle protobuf messages(is using Google::ProtocolBuffers simple enough)?
  • XS
    • are there any XS anti-patterns?
    • is there too much code in the typemaps(and should be moved into XS or perl)?
    • is there too much code in XS(and should be moved into perl)?
    • does using of an XS include file(include/XS/MesosUtils.hpp) seem sane?

mark-5@github 3 comments