Paws XXV (A break though)

Well today’s post marks a tuning point in Paws me thinks, at least in the S3 name-space. I have been spending quite allot of time trying to get this action to work;

PutBucketAcl

It is the most nasty bit of AWS code I have come across so far. First one needs to send this XML up to AWS;

<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Owner>
    <ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID>
    <DisplayName>OwnerDisplayName</DisplayName>
  </Owner>
  <AccessControlList>
    <Grant>
      <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
        <ID>852b113e7a2f25102679df27bb0ae12b3f85be6BucketOwnerCanonicalUserID</ID>
        <DisplayName>OwnerDisplayName</DisplayName>
      </Grantee>
      <Permission>FULL_CONTROL</Permission>
    </Grant>

You will notice that in the 'Grantee' tag there are some XML attributes!!. Sure enough it is in boto JSON

Sympa 6.2.48 released

I missed this release but it's only a little over a month old, so its still news.

Sympa 6.2.48 is the newest stable version of Sympa 6.2.

Sympa is an electronic mailing list manager. It is used to automate list management functions such as subscription, moderation and management of archives. Sympa also manages sending of messages to the lists, and makes it possible to reduce the load on the system. Provided that you have enough memory on your system, Sympa is especially well adapted for big lists. For a list with 20 000 subscribers, it takes 5 minutes to send a message to 90% of subscribers, of course considering that the network is available. Check out the full list of features.

From the release notices

Significant changes
  • Data sources: Codebase has entirely been rewritten. It will work a bit faster with less memory usage in exchange for some changes on behaviors.
  • Perl: From now on, Perl earlier than 5.10.1 will never be supported.

The full Change Log is here.

RPM Packages are in Fedora and EPEL, and Sympa is in the FreeBSD ports tree. Otherwise you can just install from source tar ball.

Also, a new Logo for the project has been proposed. Check it out too.

I start to write SPVM Language Specification in English.

I start to write SPVM Language Specification in English.

SPVM 1.0 Language Specification

I write SPVM language for 3 years. Language Specification is completed by 95%.

It is time to write SPVM Language Specification in English.

Let's try to

cpanm SPVM

Perl Weekly Challenge 032: Frequency Table & ASCII Bar Chart

Frequency Table

Create a script that either reads standard input or one or more files specified on the command-line. Count the number of times and then print a summary, sorted by the count of each entry.

The original title of the task was “Count instances”, but I’ve always known the output as the “frequency table”. For years, I’ve used the following bash script to produce it:

#! /bin/bash
cat "$@" | sort | uniq -c | sort -n

The first element in the pipeline is cat. It outputs all the files given to it as arguments, or the standard input if there are no arguments. sort sorts the output so duplicate lines are adjacent, which is needed for uniq. Its -c argument means “count”: it prepends the number of occurrences to each line. The final sort is invoked with -n for “numerical”, i.e. it sorts the output by the number of occurrences.

Creating a similar table in Perl is a FAQ. We store each line in a hash, incrementing the corresponding value while reading the input line by line.

If we look carefully at the assignment of the task, though, we can notice that the output should be formatted differently: the numbers should go last and the columns should be aligned. Also, there’s the extra credit which we definitely want.

Paws XXIV (A little Buzz)

Well after the panic stations I talked about in my last post. I have calmed down a little. It seems that huge check in was for the compiled version of the code base and 99% of the changes where just auto-auto-generated stuff chugged out by boto when it re-compiles.

That being said I did find this thread while investigating the mother of all pushes; https://github.com/pplu/aws-sdk-perl/issues/244

Requirements for stabilisation?

shadowcat-mst commented on 24 May 2018
So, a number of components in Paws have something like this -
https://metacpan.org/source/JLMARTIN/Paws-0.36/lib/Paws/S3.pm#L2
Is there a list anywhere of what's required to get to the point where that warning can go away? If not, how would we go about getting to a point where there was such a list?

Perl Weekly Challenge 32: Word Histogram and ASCII Bar Chart

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

Spoiler Alert: This weekly challenge deadline is due in a few days (November 3, 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 Neil Bowers.

Task # 1: Word Histogram

Create a script that either reads standard input or one or more files specified on the command-line. Count the number of times and then print a summary, sorted by the count of each entry.

So with the following input in file example.txt:

Raku gets its very own subreddit

This is a sensible step forward for both languages.

The moderators of r/perl have had a discussion and we've agreed that going forward, this subreddit will be for the discussion of Perl 5 (and, I guess, earlier versions). Posts about Raku are off-topic here. I think that's what most readers here wanted and I think the Raku people will welcome the separation too.

See all the discussion at https://www.reddit.com/r/perl/comments/dmtxk1/raku_posts_in_rperl/

Data Marketing Plan by Perl modules

At first, see the following entry.

Data Science and Perl

Our company goes into many other companies and helps them build new Perl systems or fix old ones. Needless to say, we see how many companies work and a typical example is one of our clients I'll call "AlphaCorp." They use lots and lots of Perl. Their primary web site is almost entirely Perl. So when I went in to help them with their A/B testing (amongst other things), I was surprised that they also used a lot of Python. It turns out they had a specific need that Python fills and Perl does not: data science.

After thinking a few weeks, I create the plan to do Data Marketing.

Data Marketing Plan by Perl modules

This is Japanese. Please translate it using google translation.

Paws XXIII (Bad Paws!! Bad Paws!!)

So I have been happily plugging away at the Paws 'S3' actions and my little Boto fix of


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

I was able to get all of these 'Actions' to work;

  • DeleteBucketAnalyticsConfiguration
  • DeleteBucketInventoryConfiguration
  • DeleteBucketMetricsConfiguration
  • GetBucketAnalyticsConfiguration
  • GetBucketInventoryConfiguration
  • GetBucketMetricsConfiguration
  • ListBucketInventoryConfiguration
  • ListBucketMetricsConfiguration
  • PutBucketInventoryConfiguration
  • PutBucketMetricsConfiguration

Also my 'Flatten' fix seem to clean up at least five or six others so a good day. Then I ran into this one; 'GetBucketPolicy' and on reading the ASW API doc I saw;

Perl Weekly Challenge 031: Division by Zero & Dynamic Variable Name

Division by zero

Create a function to check divide by zero error without checking if the denominator is zero.

Perl already checks the denominator when dividing. All we need to do is to catch the exception it throws and check it instead of checking the value of the denominator.

The following division subroutine uses Try::Tiny to catch the exception. It’s a good practice not to use the low level eval, see for example Bug in eval in pre-5.14 for the reasons.

London Perl Workshop 2019 - Report

DISCLAIMER: All photos courtesy to the official twitter handle of London Perl Workshop.

As you know, LPW2019 just happened last Saturday 19th Oct 2019. It was my second year as a member of LPW Organizing team. Although I was the least active members in the team as compared to others. On the day, I arrived the venue around 8:10 am and saw Katherine, Tom and Lee unloading event materials from the cab. I joined the team and gave helping hands. I was managing the registration desk along with Katherine. People sarted arriving about 8:30 am. It was always great to see so many friends.

Announcing MooX::Press

MooX::Press is a quick way of building a bunch of Moo roles and classes in one use statement.

The most basic example would be:

  package MyApp {
    use MooX::Press class => ['Foo', 'Bar'];
  }
  
  my $thing1 = MyApp::Foo->new();
  my $thing2 = MyApp->new_foo();   # alternative constructor

But do-nothing classes with a constructor and nothing else aren't very exciting. Let's define a class with some subclasses which have attributes and roles and methods and stuff.

Paws XXII (Plana est terra)

The next action I had a crack at was 'PutCORSConfiguration' and I was getting the usual;

<Error> <Code>MalformedXML</Code> <Message>The XML you provided was not well-formed or did not validate against our published schema </Message> </Error>

At this points in my Paws adventure I checked the API doc for URI Request Parameters of the PutCORSConfiguration;

PUT /?cors HTTP/1.1 Host: Bucket.s3.amazonaws.com Content-MD5: ContentMD5

and I see I don't have to deal with the 'id' in the 'URI' bug here as I get what I want in the request URI;

Perl Weekly Challenge 31: Illegal Division by Zero and Dynamic Variables

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

Spoiler Alert: This weekly challenge deadline is due in a few days from now (October 27, 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: Illegal Division by Zero

Create a function to check divide by zero error without checking if the denominator is zero.

Illegal Division by Zero in Perl 5

Perl 5 has a number of modules to implement exception handling using the try ... catch pattern found in a number of other languages, such as, for example, Try::Tiny or TryCatch. Even Autodie might actually fit the bill. But, because this is a coding challenge, we prefer to avoid using modules that do the work you're supposed to do.

In fact, not doing anything special will check the division by zero, as shown in these one-liners:

Perl 5 is now on github

Not sure if this has been posted on here on blogs...

https://www.nntp.perl.org/group/perl.perl5.porters/2019/10/msg256484.html

Cor - Background core Perl OO

So far, the work on Cor is going well. Here's the timeline.

Paws XXI (The Adult Version)

We last left out PAWS hero she was just about ready to fix the S3 'PutBucketAnalyticsConfiguration' call. Having first fixed up the botocore json file to properly define the URI for the call.

She now had to find a way to get the 'xmlns' schema attribute add to the root of the XML that is sent to the API.

Turns out I was in very virgin territory there has been no Paws code to take this into account and checking the py code it was not very helpful so I have to put my thinking cap on for this one.

I was thinking I could just make it a new 'trait' like I did for the 'Status' attribute but then I remembered some of my XML from years ago the the 'xmlns' always should be in the root node so It will appear only in one place so not really an attribute trait.

Tabs or spaces for indentation? Statistics on 3.8 million Perl files created in 24 years

I spotted this on The Twitter, someone processed lots of code to find the truth on this topic of disagreement.

"After I have processed data in the database, I decided to watch from each author he uses for padding. I expect that the most popular will be the use of only spaces, the second place by popularity will be using only tabs, and the third place in popularity is the simultaneous use of tabs and spaces. But it turned out that I was completely wrong. "

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

What is the value that Perl offers?

We are lost.

Temptation and desires will make us lost.


Where is Perl going after Raku begins to take a different path?

Raku provides new values.

Perl provides traditional and conservative values.


If you lead Perl to Raku, Perl will fail.

If you ask Raku for Perl, Raku will fail.


When we talk, we need to be aware of the difference between Raku and Perl.

We are lost.

Those who like traditional Perl have respected SUPER and bless.

Those who aim for Raku have thought that SUPER and bless are failures.

That has become a negative campaign against Perl.


We may need to go back to the fundamentals of what Perl offers.

The Perl language is a good language, but the Perl community continues to fail in marketing.


What benefits does Perl offer?

What is Perl's mission?

Who is a Perl user?

Where is Perl used?

What are the strengths of Perl?

What is Perl's vision?


We talk a lot about the details of the language, but haven't talked about the value that Perl offers to society.


Isn't it time for the Perl core team to start talking about Perl marketing?

The London Perl Workshop 2019

I went to the London Perl Workshop 2019 this weekend. I've been attending the London Perl Workshop several times in the past, and it has always been a great workshop. This year the workshop had a brand new team of organisers, and they did a great job of following up on the legacy that is the London Perl Workshop (LPW).

Going to London

My LPW weekend, didn't start that great. I had a flight from Copenhagen to Gatwick at nine in the evening, but the flight was delayed by almost an hour. This could mean missing the last Gatwick Express train, which would mean I would arrive at the hotel past midnight. Not the best start of a short weekend trip to London.

Finally the pilot was allowed to take off, and he managed to catch up somewhat for the lost time. I had a seat on the second row, I had booked that to be able to get quickly off the plane and get to my train.

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.