Perl Marketing Four Elements

Benefits

What benefits Perl provide to users?

Target

Who is the Perl user?

Strength

What are the strengths of Perl?

Place

Where do people find Perl?

These are the basic elements of Marketing.

[ Perl | Raku | The ] Weekly Challenge - 2020

Here is my plan for 2020:

https://perlweeklychallenge.org/blog/plan-2020/

Platypus Next Generation

(originally posted on the Platypus wiki)

Platypus is getting an update. It’s not backward compatible, so you have to opt-in when you create the platypus instance. That makes it backward compatible for all the old code you may or may not have written. Please spread the word.

# old code:
use FFI::Platypus;
my $ffi = FFI::Platypus->new;

# new code:
use FFI::Platypus 1.00;
my $ffi = FFI::Platypus->new( api => 1 );

You should generally write all new code using the new API so that you can take advantage of the newer features and design fixes. You may want to also consider upgrading your existing code to use the new API for the same reasons.

The main enhancement you get is the ability to pass and return records by value in addition to as pointers of by reference. This missing feature was a design bug in the original implementation of Platypus, and I am pleased to make this feature available. In the old interface records are assumed to be pointers. In the new interface they are assumed to be records, and you have to use the pointer decorator (*) to use pointers to records.

# both versions:
package Foo {
  use FFI::Platypus::Record;
  record_layout
    int bar
    int baz
  ;
}

# old code:
use FFI::Platypus;
my $ffi = FFI::Platypus->new;
# XXX can't use Foo pass-by-value         # pass-by-value
$ffi->type('record(Foo)' => 'foo_t');     # pass-by-pointer/reference

# new code:
use FFI::Platypus 1.00;
my $ffi = FFI::Platypus->new( api => 1 );
$ffi->type('record(Foo)'  => 'foo_t');    # pass-by-value
$ffi->type('record(Foo)*' => 'foo_ptr');  # pass-by-pointer/reference

A minor tweak on the internals mean that you can also decorate aliases as pointer or array types.

# old code:
use FFI::Platypus;
my $ffi = FFI::Platypus->new;
$ffi->type('opaque'      => 'o_t');
$ffi->type('opaque*'     => 'o_ptr');
$ffi->type('opaque[10]'  => 'o_array');
# XXX no records-by-value
$ffi->type('record(Foo)' => 'foo_ptr');

# new code:
use FFI::Platypus 1.00;
my $ffi = FFI::Platypus->new( api => 1 );
$ffi->type('opaque' => 'o_t');
$ffi->type('o_t*');     # pointer to o_t doesn't require an extra alias
$ffi->type('o_t[10]');  # same for arrays
$ffi->type('record(Foo)' => 'foo_t');
$fii->type('foo_t*');   # or pointers to records

Last, but not least, Platypus also now supports out of the box the common opaque pointer as an object pattern. TL;DR, given a C interface like this:

typedef struct foo_t;
foo_t* foo_new();
void foo_set_bar(foo_t*, const char *);
const char *foo_get_bar(foo_t*);
void foo_free(foo_t*);

You can write Perl like this:

# new code:
package Foo {
  use FFI::Platypus 1.00;
  my $ffi = FFI::Platypus->new( api => 1 );
  $ffi->type('object(Foo)' => 'foo_t');
  $ffi->mangler(sub {
    my $name = shift;
    $name =~ s/^foo_//r;  # prefix all symbol lookups with foo_
  });
  $ffi->attach( new     => [ ] => 'foo_t*' );
  $ffi->attach( set_bar => [ 'foo_t*', 'string' ] );
  $ffi->attach( get_bar => [ 'foo_t*' ] => 'string' );
  $ffi->attach( free    => [ 'foo_t*' ] );
  sub DESTROY
  {
    my $self = shift;
    $self->free;
  }
}

my $foo = Foo->new;
$foo->set_bar("baz");
my $baz = $foo->get_bar;

If Platypus or the new API has piqued your interest or you have questions, we should definitely hang out! Join us on #native on irc.perl.org, check out the project on metacpan or github. If in person interaction is more your jam, then I will be at DCBPW in Baltimore next year along with TPCiH in Houston.

Paws XXVII (Templated Paws)


Well today on paws I figured I would take a look and see what was outstanding in terms of code to fix. All that I could find was only really one thing and this boto fix well really a Kludge


/{Bucket}?action
/{Bucket}?action&id={Id}

where I add the id to the URI to get around a bug/problems when running this code on RestXmlCaller.pm;


$uri->query_form(%$qparams); 

would scramble the URI so the call would fail.

What I would like to do is roll back the changes I have made for Boto and see if I can find a pure Perl solution to my problem.

Perl Weekly Challenge 034: Slices and a Dispatch Table

Slices

Write a program that demonstrates using hash slices and/or array slices.

In the spirit of TIMTOWTDI I decided to write a single program that demonstrates both the tasks at the same time.

Let’s start with slices. Slices are parts of structures (arrays and hashes). Slicing has a special syntax by which you tell Perl which indices or keys you want to use to obtain a slice.

For example, consider the following array:

my @keys = qw( not_this_one
               this_one
               this_one_too
               it_was_enough );

Naturally, we want to select the second and third one. We can use

$keys[1], $keys[2]

or

map $keys[$_], 1, 2;

but there’s a shorter and cleaner syntax for the same:

@keys[1, 2]

LedgerSMB 1.7.3 released

The LedgerSMB project aims to prevent small and mid-size businesses from getting locked-in by their accounting software vendor by providing free and open source accounting software, integrating invoicing, order processing, quotations and more (ERP). It's all Perl!

Having installed it myself, I found it very very fully featured. You can try out their demo and watch one of their numerous youtube intros and tutorials

The LedgerSMB development team has announced release 1.7.3.

This release contains the following fixes and improvements:

Changelog for 1.7.3

Releases for stable branches of 1.6.15 and 1.5.29 have also been released.

The project has an official Docker image, tar balls, and deb packages all detailed on their downloads page.

Would you like to get one user instead of the top of TIBOE?

Would you like to get one user instead of the top of TIBOE?

TIBOE provides rankings with a biased perspective.

A few leading engineers understand that TIBOE has no value

Many dishonest media continue to introduce TIBOE ranking.

Rather than getting the top of the biased ranking,

Wouldn't it be better to get one excellent and sincere engineer?

Marketing is not to mislead people.

Low quality marketing is done around the world, but there is no reason for Perl users to join it.

High quality marketing looks at the mind of a one user.

Paws XXVI (The Big Clean)

So time to hold on a bit and go back and and see if my latest changes have broken anything or for that matter fixed something that was already broken?

So back to my tests script and and I got my first fail on

'PutBucketCors'

and surprise it was a bit of Mooso poop.


You must pass a package name and it cannot be blessed at /wwwveh/lib/x86_64-linux-thread-multi/Moose/Meta/Attribute.pm line 867
        Moose::Meta::Attribute::get_value('Moose::Meta::Class::__ANON__::SERIAL::12=HASH(0x4ad5358)', 'http://www.example.com') called at /home/scolesj/aws-sdk-perl/

So I checked the generated 'PutBucketCors,pm' file with one from a clean .41 build and there was no changes there so it must be someplace else?

Well lots of debugging later I found it here

Some Useful Functions for Financial Calculations. Part 1

Hi there. I 'm just trying to write. I like reading rather than writing. So be friendly, please.

I often have to maintain support or develop financial sites. For example, now I'm programming an API for scoring to a site takecashngo.com. As in any other field, most tasks art pretty similar. But for those who first come across similar ones they can cause small problems.

I will begin a series of small notes in which I will give simple formulas, algorithms and codes fragments, designed into functions that you can use in your projects. There will not be any unusual things, everything is pretty trivial.

The first example is the calculation of monthly mortgage payments with a fixed rate.The formula for calculating monthly payments at a non-zero interest rate is well known and looks like this:

P=A*R*(1+R) ^N/((1+R) ^N-1)

Where:
  • P – monthly payment
  • A – loan amount
  • N – number of monthly payments
  • R – decimal monthly interest rate. Calculated by the formula: R=APR/1200

Convos - A multiuser chat application.

From the blurb:

Convos is the simplest way to use IRC. It is always online, and accessible to your web browser, both on desktop and mobile. Run it on your home server, or cloud service easily. It can be deployed to Docker-based cloud services, or you can just run it as a normal Mojolicious application.

Check it out at: https://convos.by/ or on Github.

The UI style is familiar to users of popular "Team Communication" platforms.


2019-10-26-conversation.jpg

There is an online demo running at demo.convos.by. Register with your email address and try it out. There should be someone lurking in the #test channel.

Developer on Fire Interview

On October 22nd I was interviewed by Dave Rael for Developer On Fire podcast.

It has been an interesting experience, and Dave has been a great host making me feel very comfortable during the whole process.

I talked about Open Source, archery, cats and PostgreSQL.
Here there is something more to read about, and for listening the interview just click on the image.


developersonfire.png

Devel::PPPort has been updated

Devel::PPPort 3.55 has more than two hundred commits since the last major releases. The documentation has been extensively revised to make it clearer how to use, and to contribute. And it has been updated to know about the latest blead; the first such update in 5 or more years.

Dozens of functions and macros are newly implemented. The suite of SV handling functions is more complete, with more flags handled. Also the character classification macros (alpha, punct, etc) and case changing functions are greatly expanded. There is more Unicode support, including modern security standards.

ppport.h --api-info foo

is much more complete than before. If you make 'foo' to instead be '/./' you'll get information about every known API element.

And it still supports 5.003, with a surprising number of elements functioning that far back.

The full documentation is available at .

The version backporting is valid for is unknown for quite a few API elements. That is because documentation is lacking on the parameters these take, and so the automatic tests for these elements can't be generated. If you know what some of the missing things do, we would greatly appreciate your contributing documentation for them. in the form of a github pull request.

Perl Weekly Challenge 34: Array and Hash Slices and Dispatch Tables

These are some answers to the Week 34 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days (November 17, 2019). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.

This week, both tasks were contributed by Dave Cross.

Task # 1: Array and Hash Slices

Write a program that demonstrates using hash slices and/or array slices.

Slices are a way to access several values of an array or of a hash in one statement, by using multiple subscripts or keys.

Array and Hash Slices in Perl 5

If you have an @array containing for example some successive integers, you can obtain several values from it with the following syntax: @array[3, 7, 2] or even @array[2..7].

Perl Weekly Challenge 033: Count Letters & Formatted Multiplication Table

Count Letters

Create a script that accepts one or more files specified on the command-line and count the number of times letters appeared in the files.

From the example we can see that we should count the letters in a case insensitive way (see the lc in the example below). Similarly to Challenge 032, we can use a hash to keep the counts.

#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };

my %count;
while (<>) {
    ++$count{ lc $1 } while /([a-zA-Z])/g;
}
for my $char (sort keys %count) {
    say "$char: $count{$char}";
}

Tabs vs Spaces. Article about symbols that are used for indentation in 3.8 million Perl files on CPAN

There are 135 thousand releases on CPAN now. In those releases there are about 3.8 million files with extensions .pm, .pl, .t or .pod.

Here is a link with a small research what symbols are used for indentation in all that files.

There is obvious trend, but unfortunately in this article there is no exact answer why it happen.

https://squareperl.com/en/tabs-vs-spaces-in-millions-of-perl-files

Perl5 CPAN Module Metadata Best Practices

When I started working at SUSE, one of the first things I worked on is the maintenance of the perl modules repository in the openSUSE Build Service (OBS).

We are using a tool called cpanspec to create .spec files from CPAN modules. From the spec file, the OBS then builds rpm packages.

I noticed there are a lot of modules missing information, or having other problems that prevent us from automatically create a working .spec file.

Perl Weekly Challenge 33: Count letters and Multiplication Tables

These are some answers to the Week 33 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (November 10,, 2019). This blog post offers some solutions to this challenge, please don't read on if you intend to complete the challenge on your own.

Challenge # 1: Count Letters (A..Z)

Create a script that accepts one or more files specified on the command-line and count the number of times letters appeared in the files.

So with the following input file sample.txt:

The quick brown fox jumps over the lazy dog.

the script would display something like:

Monthly Report - October

October has been always the busiest month of the year for one annual event Hacktoberfest. However this time, we have had London Perl Workshop annual event as well. On top of all these, I have had to manage Perl Weekly Challenge. I have been participating Hacktoberfest since 2015. It was first introduced to me by Neil Bowers. Last year, I contributed 155 Pull Requests in the month of October. Having done this, I never thought I would ever break this record. Luckily I submitted 160 Pull Request last month.

Here is the breakdown:

  • Merged: 90
  • Close (unmerged): 17
  • Open: 53

Desire for Perl wrapper of Mozilla's IoT platform

I've spent more than four years working on Raspberry Pi stuff for Perl, and although it's only garnered a relatively small but thorough interest, it's been a wonderful one to be a part of.

Mozilla has opened up a new IoT Platform, and I'm wondering if it'd be worth the time to provide a Perl interface to it or not.

Thoughts?

Request for Feedback: Perl Documentation Site

The official Perl documentation site at https://perldoc.perl.org was recently overhauled. Independently, I put together a reimagined documentation site that would be hosted at https://perldoc.pl. In the interest of providing a documentation site that best serves the needs of the Perl community, we need your feedback. Please give both sites a try, in-depth if you want, or just how you would most commonly use the site. What do you like about the design or the functionality of each site? What is missing or can be improved? Any feedback regarding what you want from the Perl documentation site is helpful and appreciated. Please leave comments here or in the linked posts by Monday Nov 18th.

Reddit comments

PerlMonks comments

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.