New Perl project. Interactive Perl coding tasks to run in the browser
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)
This is the link:
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.
I'm very happy that it is possible not only to create a task "write a script", or "write a sub", but also a type of task "write one-liner". I use Perl in the command line a lot, I think this is a very strong side of Perl and I want to make it possible to create tasks about one-liners.
This is the very first version of the project. There are a lot of things that I think should be done better (for example I really don't like that the system does not explain what is wrong with your submission, it just tell you that it does not accept it). But I think that this version is good enough to show to you and to listen to your feedback.
This is something like https://leetcode.com or https://www.hackerrank.com But it is million times smaller and dedicated to Perl.
There is a great project created by Mohammad Sajid Anwar — Perl Weekly Challenge. It is dedicated to Perl & Raku and it about solving Perl tasks. I really like the ideas behind this project and I'm fascinated how this project inspires people to write blog posts about the tasks. (And I'm also impressed how much handwork Mohammad is doing) I really like it, but I don't use it for a couple of reasons: I want to be sure that I have solved the task correctly. I want the system run tests for my solution and to check that it is working exactly as planned even in corner cases. The other thing — I want more freedom. Sometimes there are weeks that I'm not able to spend time on this challenge, but sometimes I have time and I'm in the mood to spend several hours with solving problems. So as an experiment, or you can call it as as a proof of concept I've created the new project.
I'm planning to add more interactive problems to the site.
Information about new tasks will be posted on https://twitter.com/SquarePerl, so, If you are interested, you can follow that account. Or, you can watch GitHub repo to get notifications about the changes in the tasks.
I would love to hear from you what you think. Do you like it? Do you think that it should be done in some other way?
It should be "Ineractive Perl problems".
Wow, this is great! It's kind of difficult to type into the input field though:
1. My auto-correct "helped" me by turning $I into
$I. This site says that can be turned off by adding
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"to the textarea: https://davidwalsh.name/disable-autocorrect
2. The Tab key changes focus. There are in-browser editors you could use to fix that, but I find that the friendliest thing to do is just to allow the Tab key to insert a tab. This StackOverflow post has a few ways to do it: https://stackoverflow.com/questions/6140632/how-to-handle-tab-in-textarea
Great job so far! I look forward to seeing what else you come up with!
Thank you! I think that I have fixed all "Interactive" on all the places on the site.
This is fun Perl quiz!
I registered and login it now.
Can I register my Perl problem from Web Interface?
I'm made two changes on the site.
1. I haven't thought about such simple improvements of textarea. I've added all that attributes to the site, so the textarea should work a bit better.
2. I agree that when you enter code the tab button should not move focus to the next element on the page. I've read stackoverflow answers that you mention, but I don't like the idea to enter tab symbol "\t" when pressing tab. To check for the solution the system compares the results of code execution with expected result. I'm afraid that adding "\t" to the code can add difficulties to finding out why the solution does not pass. So, I've implemented a bit different approach — when the tab button is pressed four spaces are added. That is not a perfect (the number of spaces should be vary), but it it much better than moving the focus out of the textarea when the tab button is pressed.
I'm sorry, but I'm not sure that I understood your question that correctly.
After registration you can submit solution to the problems via web interface https://upload.bessarabov.ru/bessarabov/mCSAHUt20oRzjS_Bhj6apdFrXoA.png?a
If you are asking about the interface to add new problems to the system, there is no such interface. To add new problems you need to create files in open github repo. Here is an example of one task — https://github.com/bessarabov/squareperl_problems/blob/main/data/en/check-ipv4-address.cells
Suggest this change:
The solution that you have entered does not work as expected. See the PerlBanjo link above for errors.
But THANK YOU! Now I can stop using perl -e at the command line for short snippets that invarialbly become programming sessions!
>If you are asking about the interface to add new problems to the system, there is no such interface.
I understand current SquarePerl.com features now.
I feel if a problem is added from web form, and answers are also added from web form, it will become interactive communication by a teacher and students.
> Suggest this change:
> ... See the PerlBanjo link above for errors.
Thank you for you suggestion! I'm sorry, but I'm not sure this is the text I'm looking for. For example the FooBar problem. There can be no errors in the output, but the system still does not accept solution because there are some differences between the PerlBanjo output and the expected output. I was trying to put it into short and and simple phase, but I failed. I have some ideas how to change interface to make it more clear, but I'm not sure when I will implement it.
> But THANK YOU! Now I can stop using perl -e at the command line for short snippets that invarialbly become programming sessions!
Oh, Thank you! I'm always very happy to hear that this small project is useful not only for me!
> I feel if a problem is added from web form, and answers are also added from web form, it will become interactive communication by a teacher and students.
I agree. Creating a file in some format on GitHub is not as user friendly as using a tool created exactly for that purpose. For this project I wanted that there is a way to change/add new problems from the very beginning. And as a cheap and easy solution I've used GitHub repo to allow edits.
We'll see what will happen in the future. If there is a demand for simple problem editing tool it is quite possible that I will create it. Or, maybe, somebody else will create some good tool to edit problem source code (for example it can be created as a VSCode plugin, or something like this)