143 karma · joined November 7, 2013
use warnings;
use autodie;
To get similar functionality as the implicit Perl 6 IO error system.Baliador is meant to be a take on Dancer from Perl 5 which is somewhere between Sinatra and Rails in complexity. In the Perl 5 world the equivalent of Rails would be Catalyst. But even that isn't really as monolithically well integrated.
The point I'm making is Rails wasn't built in a day and to date Perl 6 has had quite a few people want to kickstart a Rails initiative but they always do it with new code and new ideas cloning a previous paradigm. A better plan is to embed yourself in what's there especially the core language. With grammars you could write a complete DSL as a web framework with all of the power of Perl 6. But it would take someone knowing the core language well to make something that's slick. For behind the scenes there is little reason to reimplement HTTP parsing/serving since there are a couple of modules that are tested against every release of the Rakudo compiler already.
B) All of the below is core language, not a use or import anywhere required. Error reporting is also handled for you without autodie and friends.
Reading from a file:
#Efficiently line by line for STDIN
for lines() -> $line {
$line.say;
}
#Get everything in RAM right now
my $string = "filename".IO.slurp;
#Lazy list will do IO as you request into the list
my @lines = "filename".IO.lines;
#Listing of directories if the path is a directory
my @directories = "coolstuff".IO.dir if "coolstuff".IO.d;
Playing with dates:
#Get a DateTime for right now
my $date = DateTime.now;
#Does what it says on the tin
say "Yippee" if $date.later(:5years).is-leap-year;https://github.com/ufobat/Bailador
https://github.com/tokuhirom/p6-Crust
https://github.com/skaji/Frinfon
https://github.com/nunorc/p6-Pekyll
https://github.com/retupmoca/P6-Web-RF
https://github.com/drforr/perl6-App-prancer
https://github.com/sergot/BreakDancer
https://github.com/supernovus/perl6-web-app-ballet
Testing https://github.com/azawawi/perl6-selenium-webdriver
Even desktop style web applications with Electron https://github.com/azawawi/perl6-electron
It's all there just no one engages with any of the development because its not trending on HN every five seconds or has the eye of the tweener set of developers who blog and vlog.
The first major implementation of Perl 6 back in the early/mid 00s was Pugs written in Haskell where Perl 6 picked up a tonne of functional heritage both in the compiler at the time and the language spec. The more recent Rakudo compiler has a lead architect who often works in C# where the compiler and the language spec picked up and redefined a reactive programming concurrency model with lots of nice new syntax like the react/whenever block.
Rakudo Perl 6 and Pugs and the host of other early implementations have been around a while and released often when they were worked on, monthly in the case of Rakudo with the first publicised release in 2010. Rakudo is also releasing a version of the compiler compliant with the newly frozen and released specification.
For example all of the literate style POD6 comments are accessible within a variable as a fully structured tree in the $=pod variable. The 'q' quoting context in the main language allows you to use any matched quote/bracket from unicode as the markers of the start and end of a string or regex, or comments as you've picked up on.
This is super helpful if you want all sorts of weird quotes and brackets inside of a string and still have it interpolated for variables for example.
say q⧚This string has a "'weirdly quoted bit in'"!⧛;
Will print out: This string has a "'weirdly quoted bit in'"!
To see some examples of how extreme you can have these characters be from unicode check out http://xahlee.info/comp/unicode_matching_brackets.html 1 + ൭ == 8