PrePAN

Sign in to PrePAN

PrePAN provides a place
to discuss your modules.

CLOSE

Requests for Reviews Feed

namespace::local Forget imports at end of scope, think namespace::clean inside-out

Say we need some utility functions inside a subroutine or scope, but we'd like to (a) keep them private and (b) keep them unavailable for the rest of the package.

This module would make imports (in fast, any symbol table changes) only available until end of scope.

namespace::clean does similar thing (and is cool!), but one must be careful to avoid erasing needed functions.

dallaylaen@github 3 comments

List::Unique::DeterministicOrder Store and access a list of keys using a deterministic order based on the sequence of insertions and deletions

Discussion section from the POD is below.

Any suggestions for a better name are appreciated.

DISCUSSION

The algorithm used is from https://stackoverflow.com/questions/5682218/data-structure-insert-remove-contains-get-random-element-all-at-o1/5684892#5684892

The algorithm used inserts keys at the end, but swaps keys around on deletion. Hence it is deterministic and repeatable, but only if the sequence of insertions and deletions is replicated exactly.

So why would one use this in the first place? The motivating use-case was a randomisation process where keys would be selected from a pool of keys, and sometimes inserted. e.g. the process might select and remove the 10th key, then the 257th, then insert a new key, followed by more selections and removals. The randomisations needed to produce the same results same for the same given PRNG sequence for reproducibility purposes.

Using a hash to store the data provides rapid access, but getting the nth key requires the key list be generated each time, and Perl's hashes do not provide their keys in a deterministic order across all versions and platforms.
Binary searches over sorted lists proved very effective for a while, but bottlenecks started to manifest when the data sets became much larger and the number of lists became both abundant and lengthy.

Since the order itself does not matter, only the ability to replicate it, this module was written.

One could also use Hash::Ordered, but it has the overhead of storing values, which are not needed here. I also wrote this module before I benchmarked against Hash::Ordered. Regardless, this module is faster for the example use-case described above - see the benchmarking results in bench.pl (which is part of this distribution). That said, some of the implementation details have been adapted/borrowed from Hash::Ordered.

shawnlaffan@github 1 comment

WebService::HMRC Interact with the UK HMRC tax authority Making Tax Digital API

This is a base set of modules used for interacting with the HMRC Making Tax Digital (MTD) and Making Tax Digital for Business (MTDfB) APIs.

HMRC is the UK government tax authority. Their APIs provide a means to submit and query information relating to personal and business tax and customs affairs.

The top-level WebService::HMRC module is a stub bundling the following modules which encapsulate the minimum functionality needed to interact with the HMRC API:

  • WebService::HMRC::Request
  • WebService::HMRC::Response
  • WebService::HMRC::Authenticate

These base modules will normally not be used directly by an application. Instead, applications will generally use a higher-level module which inherits from these classes.

I have written and intend to release separately the following modules which use the base functionality:

  • WebService::HMRC::VAT
  • WebService::HMRC::HelloWorld
  • WebService::HMRC::CreateUser

Further APIs exist for different aspects of personal and company taxation. It is hoped that this base distribution makes it easier to contribute modules for these.

More information on the HMRC APIs here: https://developer.service.hmrc.gov.uk/api-documentation/docs/api

nick-prater@github 0 comments

HEXONET::Apiconnector Connector Library for the insanely fast HEXONET Backend API

This module allows to query the HEXONET Backend API and to deal with different response formats (list, list_hash, hash). It provides a short hand method (HEXONET::Apiconnector::connect) to instantiate API clients.

A helper utility module is also included for tasks like date handling and string encoding.

papakai@github 9 comments

Benchmark::Parametric Measure code performance by passing an iteration count argument

Instead of iterating the same subroutine over and over again, this module passes an iteration counter to code under test, thus allowing to time precisely the iterated snippet.

It also allows to prepare complex test data and/or check the validity of results by providing "setup" and "teardown" functions.

dallaylaen@github 2 comments

Password::Policy::Rule::Pwned Plug matches against api.pwnedpasswords.com into Password::Policy

Password::Policy::Rule::Pwned is a Password::Policy::Rule to match against the pwned password service at https://api.pwnedpasswords.com/range/ as specified at https://haveibeenpwned.com/API/v2#PwnedPasswords

A password found in the list throws an exception as usual. A password not in the list returns itself also as usual.

Following discussions with the author of Password::Policy, it has been decided to throw a separate, distinct, testable error to deal with the 3rd possibility which is a failure in the API call for whatever reason.

openstrike@github 0 comments

LDF::Schema Classes that implement Linked Data e.g. schema.org

I am working on some Perl classes that are auto-generated from http://schema.org class definitions, and can then be used to output json-ld metadata appropriate to the classes (e.g. for embedding in a web page to help search engines index the content).

Eventually I hope to add classes for other data schemes (e.g. "dc", "foaf" etc.) and allow them to be combined.

In the mean time, I am unsure what to call the module. I chose the "LDF::" namespace since it relates to linked data fragments, but I'm not happy with that. I am open to suggestions.

robrwo@github 2 comments

HTML5::DOM Make html parsing fast again

Stop using libxml for parsing html!

HTML5::DOM - is a fast HTML5 parser with DOM and CSS4 selectors. It really fast, as rocket. With threads!

At the same time, it is achieved fully conformant with the HTML5 specification.

Module has simple classic DOM-like API, it's easily to use. Try and enjoy!

Why this module so fast?

Module written in pure C and based on Modest and MyHTML.

Azq2@github 1 comment

Apache::Arrow Perl bindings for Arrow data structures, IPC and computation kernels

Apache Arrow https://en.wikipedia.org/wiki/Draft:Apache_Arrow already has C bindings via GLib https://github.com/apache/arrow/tree/master/c_glib and Perl already has GLib bindings via https://metacpan.org/pod/Glib.

Given this, does it make sense to implement Arrow bindings for perl as its own module? Or are the existing GLib bindings sufficient for any practical task?

If I were to implement Apache::Arrow[::*] it would likely be little more than a convenience wrapper around the GLib interface.

ttkciar@github 2 comments

Amazon::Credentials read AWS credentials from file, instance metadata, container, env

While PAWS is a wonderful project, it has a lot of dependencies. I've found myself trying to use slimmer Perl modules for interacting with AWS...along the way a need arises to provide the AWS credentials tuple, hence Amazon::Credentials which attempts to find those in the various places they should be found.

Might be a module somebody needs, might not. So, some questions for the community:

  • Do folks want a slimmer set of AWS APIs or is alignment with boto3 more important?
  • Does anyone still use some of the AWS CPAN modules or is all development being down with PAWS?
  • Any feedback on the module in any event would be appreciated.

rlauer6@github 2 comments