Today's post proves that test suite, even one that uses canned data, requests and responses, is a very valuable asset to have about.
As I was charging though some 80 action calls copying the requests from my successful unit tests into my t/09_request.t test cases I ran into the odd real bug.
The first one I ran into was to do with the 'PutBucketLogging' action; My real unit test case would work with no problem but as I transferred this real world unit test into canned test cases I got a fail on some of the composed XML.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (January 12, 2020). 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: Octal Number System
Write a script to print decimal number 0 to 50 in Octal Number System.
I didn't notice much public discussion, but in the last month, Perl 5
development has moved to Github. The logistics of the move were mostly handled
by Todd Rinaldo although I'm sure there were other people helping.
The change involved moving the main development repository from
perl5.git.perl.org to https://github.com/Perl/perl5,
moving the issues from rt.perl.org to Github issues, renaming them in the
process, and fixing the code that used the hostnames or URLs for decisions.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (January 5, 2020). 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: Attractive Numbers
Write a script to display attractive number between 1 and 50.
A number is an attractive number if the number of its prime factors is also prime number.
The number 20 is an attractive number, whose prime factors are 2, 2 and 5. The total prime factors is 3 which is also a prime number.
First comment: we’re obviously interested only with proper prime factors, i.e. prime factors of a number other than 1 and the number itself.
Goodness Paws 30 and I am at least code compete as far as running through all of the different action found on S3. Now that leads me to a very important part.
I now have to do a little bit of back peddling and come up with a test suite for all the now fixed S3 actions. 90% of the bugs and fixes I have done so far on S3 have been for requests to the server not checking responses form the server.
Following on with this it makes sense that I test how things are sent to the server as well. I had a peek about in the test suite and except for a few of the basic actions there are no tests on request calls.
Some time ago I have created a small web project about Perl programming language. The site where you can execute Perl code online — PerlBanjo.com. (blog post about the release)
Today I'm happy to announce the new small project about Perl. This is the place with interactive coding tasks. You solve the task, enter the solution, system run it and tell you if it accept your submission. (PerlBanjo.com is used as a backend to run Perl code)
Now there are only several tasks. The source code for all the all tasks is hosted on GitHub, so anybody can propose a fix for the task or create the new task.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (December 29, 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: Multiple Arrays Content
You are given two or more arrays. Write a script to display values of each list at a given index.
For example:
Array 1: [ I L O V E Y O U ]
Array 2: [ 2 4 0 3 2 0 1 9 ]
Array 3: [ ! ? £ $ % ^ & * ]
The Hilton Houston North has been selected as the #TPCiH venue! #savethdates June 23-27, 2020. The 3-day tech conference goes from Wednesday, June 24 through Friday, June 26. Master-class tutorial sessions will be offered Tuesday, June 23 and Saturday, June 27 #perlcon #rakulang
I'm already working on Part II, but here's Part I in all its glory: http://www.theperlfisher.com/index.php/2019/11/24/rewriting-legacy-code-for-raku/ - I'm writing OLE::Storage_Lite from the original Perl 5 source, and this article series is my thoughts on the process so far.
Spoiler Alert: This weekly challenge deadline is due in a couple of days (December 22, 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.
Task # 1: Guest House
A guest house had a policy that the light remain ON as long as the at least one guest is in the house. There is guest book which tracks all guest in/out time. Write a script to find out how long in minutes the light were ON.
Write a program to encode text into binary encoded Morse code.
Before we can encode Morse code into its binary representation, we need to encode normal text into Morse code. As a former Woodcraft member, I was able to write the following lines by heart:
my %to_morse = qw( a .- b -... c -.-. d -.. e . f ..-. g --.
h .... i .. j .--- k -.- l .-.. m -- n -.
o --- p .--. q --.- r .-. s ... t - u ..-
v ...- w .-- x -..- y -.-- z --.. );
The encoding subroutine is straightforward: split each word into separate characters, then replace each with the value from the above hash.
Note that space is not present in the translation table, so it gets translated to an empty string, which creates the expected double slashes between words.
Well still in clean-up mode here in the Paws Pen trying to get the full t/10_response.t test case working.
I was having all sorts of fun with the 'GetBucketPolicy' action test. By fun I mean a good hour of frustration and cursing and gnashing of teeth as my real-time test script was working fine! I just could not get the test in 's3-get-bucket-policy.response.test.yml' to pass.
Then I stumbled on it.
This is the one very odd action on the AWS S3 API where it dose not return XML but returns JSON. Now I do handle this with this code
} elsif (exists($headers->{'content-type'})
and $headers->{'content-type'} eq 'application/json'
and $ret_class->can('_payload')){
$unserialized_struct->{$ret_class->_payload} = $content;
Create a script to accept a 7 digits number, where the first number can only be 1 or 2. The second and third digits can be anything 0-9. The fourth and fifth digits corresponds to the month i.e. 01,02,03…,11,12. And the last 2 digits represents the days in the month i.e. 01,02,03….29,30,31. Your script should validate if the given number is valid as per the rule and then convert into human readable format date.
Rules:
1) If 1st digit is 1, then prepend 20 otherwise 19 to the 2nd and 3rd digits to make it 4-digits year.
2) The 4th and 5th digits together should be a valid month.
3) The 6th and 7th digits together should be a valid day for the above month.
For example, the given number is 2230120, it should print 1923-01-20.
I ending up in my last post with a test that was running but most of the tests where failing.
ok 1 - Call S3->CreateBucket from /home/scolesj/aws-sdk-perl/t/09_requests/s3-create-bucket.request
ok 2 - Got content eq from result
…
ok 11 - Got method eq PUT from result
I had a look at the request object I was getting back