Continues from previous week.
Feel free to submit a merge request or open a ticket if you found any issues with this post. We highly appreciate and welcome your feedback.
The common approach found in most submissions was to use the file test operator in Perl, where
-T was used to determine whether a file is a text or binary file.
CPAN modules used:
This was probably the only task where so many CPAN modules was used to solve this problem. And it seemed most participant were having a fun time building seven-segment LED display clock. Participants who took this approach were Duane Powell, Dave Jacoby (non-ticking), Prajith P, Roger Bell_West (non-ticking), Yet Ebreo, Pete Houston, Steven Wilson (non-ticking), Andrezgz, Colin Crain (non-ticking) and Julien Fiegehenn.
Of course, there were participants like Dave Cross, Athanasius, Lars Thegler, Ruben Westerberg, Kivanc Yazan, Feng Chang, Laurent Rosenfeld and Joelle Maslak (non-ticking) who decided to solve this task using the bare minimum approach. Just display the digital clock as it is using the default text at the console. While the output was the same, different participant used different approach to refresh the digital clock as shown in table below.
| Action | Dave Cross | Laurent Rosenfeld | Kivanc Yazan | |-----------------------------|-----------------------|-------------------|-------------------------| | Move cursor to first column | "\b\b\b\b\b\b\b\b" | "\r" | $console->Cursor(0, 0); | | Autoflush the output | STDOUT->autoflush(1); | $\|++ | cls(); |
A few things that caught our attention that deserved mentioned on its own.
Julien Fiegehenn’s submission was well-coded and adequately explained on why he did things in a certain manner, especially on the generation of the alphabet. Likewise for Yet Ebreo and Andrezgz. Julien was also the only participant that attached a
cpanfile file, which in our opinion, a nice touch to install all CPAN modules in one shot.
Both Duncan C. White and E. Choroba were the only participants whose solutions used the Tk toolkit. And the later solution was the only submission where you can adjust refresh rate of the clock ticking.
The most amusing solution came from Lubos Kolouch. Embrace the talking barnyard animals.
(1) Perl 6 Binary Clock by Arne Sommer
(2) Perl Weekly Challenge 028 by Adam Russell
(3) Fake Seven-Segment Displays with Perl and SVG by Dave Jacoby
(4) Perl Weekly Challenge 28: File Type and Digital Clock by Laurent Rosenfeld
(5) RogerBW’s Blog: Perl Weekly Challenge 28 by Roger Bell_West
(6) Perl Weekly Challenge 028: File Content and Digital Clock by E. Choroba