PrePAN

Sign in to PrePAN

PrePAN provides a place
to discuss your modules.

CLOSE

Requests for Reviews Feed

WebService::Discord::Webhook A module for posting messages to Discord chat service

The Discord chat service allows server ops to create "webhook"s for their server. These are special secret URLs that allow an external client to post notifications into chat by making certain HTTP requests.

(For those unfamiliar with Discord, think "Slack, if it chugged a 12 pack of Mountain Dew".)

I created this Perl module as a way to help interact with Discord webhooks. The various functions of Webhooks are wrapped in Perl functions that execute with HTTP::Tiny, and data structures with JSON::PP. I tried to focus on ease of use and documentation.


This module posts messages to the Discord chat service, using their Webhook interface. Webhooks are a simple way to add post-only functions to external clients, without the need to create a full-fledged client or "bot".

Normally, Webhooks are used to issue a notification to chat channels when an external event from another site or service occurs, e.g. when a commit is made to a Git repository, a story is posted to a news site, or a player is fragged in a game.

An example Discord Webhook URL looks like this:

https://discordapp.com/api/webhooks/2237...5344/3d89...cf11

where the first magic number ("2237...5344") is the id and the second ("3d89...cf11") is the token.

For more information on Discord Webhooks, see the Discord API documentation located at https://discordapp.com/developers/docs/resources/webhook.

greg-kennedy@github 0 comments

App::Comment2pod generate pod documentation from comments above functions and package name

I have the started on a little utility which hopefully would increase the amount and quality of documentation in my perlscript and modules.

I did not find anything like this on CPAN, so I put this out here in case this might be handy for someone else.

It is probably more work to be done before this is ready for CPAN (like the name of the module), but I would love some feedback.

The current package contains a script, which could be used as:

cat source.pm | comment2doc

The result is written to stdout, so is useful to pipe the result into various utils, i.e

  • pod2man | man -l - see man page
  • pod2markdown
  • podselect

This util will be a nice starting point for further documentation.

The package also comes with a Dist::Zilla plugin

kjellkvinge@github 0 comments

Interact::Later Delay some tasks for later by dumping their data to disk

Can be used, for example, when you receive lots of POST requests that you don't want to proceed right now to save database load.

This module will fastly store the data content on disk (with Storable) without the need to use a database or a job queue. Assuming that Perl is fast at writing files to disk, we can hope good results. This is an experiment...

smonff@github 3 comments

PartialApplication A small module that handle partially applying parameters to functions

PartialApplilcation is a small module to handle partially applying parameters to functions - a common technique used in the functional programming style of coding.

FUNCTIONS

partiallyApply( \&function, @parameters )

Partially applies the parameters to the function, giving a new function reference.

To partially apply parameters to an object method, pass a function reference to the method as the first parameter, the object instance as the second, followed by the parameters to be partially applied.

my $object = Class->new();

my $partiallyAppliedMethod = partiallyApply( \&Class::method, $object, 1, 2, 3 );

$partiallyAppliedMethod->(4, 5, 6);   # equivilant of $object->method(1, 2, 3, 4, 5, 6)

RETURNS

A function reference to the partially applied function.

partiallyApplyRight( \&function, @parameters )

Partially applies the parameters to the end of the function call - useful for when you're using named parameters and you want to make sure that the partially applied parameters are the ones used.

sub testSub {
    my %params = @_;

    print "$_ - $params{$_}\n" for keys %params;
}

my $partiallyAppliedFunction = partiallyApplyRight( \&testSub, asdf => 99 );

$partiallyAppliedFunction->(asdf => 100);   # outputs: asdf - 99

RETURNS

A function reference to the partially applied function.

partiallyApplyN( \&function, \@parameterBitmap, @parameters )

Partially applies the parameters based upon the parameterBitmap. An entry of 1 in the parameterBitmap will use a partially applied parameter and an entry of 0 will use a parameter from the call.

sub testSub {
    print join(", ", @_) ."\n";
}

my $partiallyAppliedFunction = partiallyApplyN( \&testSub, [ 1, 0, 1, 0 ], 1, 2, 3, 4, 5 );

$partiallyAppliedFunction->('a', 'b', 'c', 'd'); # outputs: 1, a, 2, b, 3, 4, 5, c, d

This does allow you to partially apply parameter to a method call without specifying the object instance to apply it to multiple instances.

my $partiallyAppliedMethod2 = partiallyApplyN( \&Class::method, [ 0, 1, 1, 1 ], 1, 2, 3 );

$partiallyAppliedMethod2->($object1, 4, 5); # equivilant to $object1->method(1, 2, 3, 4, 5)
$partiallyAppliedMethod2->($object2, 6, 7); # equivilant to $object2->method(1, 2, 3, 6, 7)

RETURNS

A function reference to the partially applied function.

jlcooper@github 2 comments

SMS::Send::RedSMS SMS::Send driver to send messages via RedSMS.ru

SMS::Send driver for RedSMS - https://redsms.ru/

This is not intended to be used directly, but instead called by SMS::Send (see synopsis above for a basic illustration, and see SMS::Send's documentation for further information).

The driver uses the RedSMS HTTP API mechanism (lk.redsms.ru version) with JSON.

Be aware! The driver is intended only for lk.redsms.ru (not cp.redsms.ru) version of API.

artamonoviv@github 0 comments

App::uricolor Colorize URIs in terminal with ANSI colors.

uricolor is a trivial script to colorize URIs with ANSI colors (underlined blue), based on URI::Find and Term::ANSIColor. It simply reads from STDIN and writes to STDOUT.

Useful in combination with urifind (provided by URI::Find).

kal247@github 0 comments

AtlasTK::GUI Add a graphical user interface to your Perl programs.

  • For a live demonstration of above example: http://q37.info/s/zmzcxvm9
  • for other live demonstrations: http://q37.info/s/sssznrb4

The Atlas toolkit (http://atlastk.org/) purpose is to provide a fast and easy way to add a graphical interface to programs. This toolkit is available for Java, Node.js, PHP, Python, Ruby, and, now, also for Perl. It's lightweight, does not need other Perl modules, and requires only basic knowledge of widespread and easy-to-learn web technologies (no JavaScript required).

It can be easily used in programs that were not originally designed to have a GUI, so the user can choose which interface s/he wants to use. The Atlas toolkit also facilitates the development of prototypes, and can also easily be used by beginners.

epeios-q37@github 3 comments

Template::Plugin::Filter::PlantUML A template toolkit plugin filter for encoding and processing PlantUML Diagrams

This is a trivial Template::Toolkit plugin filter to allow any template writer to embed PlantUML Diagram Syntax in Templates and have them encoded and processed via any PlantUML Server in any supported formats.

It uses WWW:PlantUML remote client under the hood.

The author got his inspiration from XSAWYERX's Template::Plugin::xkcd

ranwitter@github 0 comments

WWW::PlantUML A simple remote client interface to a PlantUML server

  • Plantuml is a library for generating UML diagrams from a simple text markup language.

  • This is a simple Perl remote client interface to a plantuml server using the same custom encoding used by most other plantuml clients. Perl was missing from the list.

  • There are other plantuml Perl libraries, like PlantUML::ClassDiagram::Parse, which provide only parsing capabilities for Class Diagrams. In contrast WWW::PlantUML module provides accessing any UML Diagram Type in various formats supported by any PlantUML server via HTTP/S Protocol.

  • This client defaults to the public plantuml server, but can be used against any server.

  • Read more: http://plantuml.com/de/server

  • See also: UML::PlantUML::Encoder

ranwitter@github 0 comments

UML::PlantUML::Encoder Provides PlantUML Language Encoding

  • Plantuml is a library for generating UML diagrams from a simple text markup language.

  • PlantUML defines a standardized way to encode diagram text description to a simple string of characters that contains only digits, letters, underscore and minus character.

  • The goal of such an encoding is to facilitate communication of diagrams through URL (see http://plantuml.com/de/server).

  • This encoding includes compression to keep encoded strings as short as possible.

  • Compression is done using Deflate algorithm.

  • Code in PHP, Javascript, Python were readily available on various sources. Perl 5 was missing from the list.

  • Read more: PlantUML Text Encoding

ranwitter@github 5 comments