Questions about Cro, a set of Perl 6 tools and libraries for building distributed systems.
Questions tagged [cro]
38 questions
8
votes
1 answer
In CommaIDE, what is the difference between running a cro service as a regular script and running it as a cro service?
I have run some cro microservices from CommaIDE (Community version 2020.05) without a glitch, before discovering I could also sun them as a cro service itself. However, there does not seem to be any visible difference; configuration screens are the…

jjmerelo
- 22,578
- 8
- 40
- 86
8
votes
1 answer
Handling connection failures with IO::Socket::Async
I'm working on a small project using IO::Socket::Async. I'm trying write some tests to make sure I'm handling a connection loss properly but my initial attempts didn't go as planned. I thought using a QUIT phaser would work but that didn't give any…

Amuro Ray
- 95
- 3
7
votes
2 answers
Cro Template as Object
The Scenario
I've been using templates in Cro (documented at https://cro.services/docs/reference/cro-webapp-template), and have enjoyed that there are subs in them.
I currently have a 'main' template, and some reports, let's say report1, report2,…

Timothy Nelson
- 565
- 3
- 5
7
votes
1 answer
Cro: How to define port for each services in .cro.yml?
After creating stub services with cro stub http test test, I have defined TEST_PORT environment variable in .cro.yml:
---
id: test
cro: 1
name: "test"
endpoints:
-
id: http
name: HTTP
protocol: http
host-env: TEST_HOST
…

Mimosinnet
- 743
- 3
- 8
7
votes
1 answer
Using Cro run for rebuilding changed client side files
cro run stops the server, recompiles, restarts the server when anything in the directory tree changes. That's great.
But when developing the client side UI, and using NPX/yarn/webpack, there is an additional step that is needed to produce the…

Richard Hainsworth
- 1,585
- 7
- 9
7
votes
1 answer
WebApp::Template condition behaviour and use of variables
Using the template language provided I always have access to $_ or or Hash referent for iteration which is fine.
# In routes
get -> 'somestuff' {
my $stuff = %{ arr => [ {stuff => 'stuff1' , nbr => 1 }, {stuff => 'stuff2', nbr => 2 } ] };
…

kolikov
- 73
- 3
7
votes
1 answer
Reference for Log classes
Line 13 of stub Routes.pm6 creates new instance of Cro::HTTP::Log::File
Where can I find documentation to this class? For example, if I want to have logs and errors sent to the same file?
I tried using a string for :logs, and got an error. The class…

Richard Hainsworth
- 1,585
- 7
- 9
7
votes
2 answers
Problem with Raku and SSL on Windows Machine
I just installed perl6 on windows server and windows 7.
I want to port a script which is already running on openbsd to a windows machine.
I tested this code:
my $resp = await Cro::HTTP::Client.get('https://www.perl6.org/');
And I'll get is this on…

Wahnburger
- 91
- 5
7
votes
2 answers
Cro user session gets forgotten
I'm trying to learn out Cro (and Perl6 simultaneously) ;)
My study app is based on the documentation of Cro. I added some authentication which does work, but the user session gets forgotten immediately.
You can check out the code at…

Erik Colson
- 103
- 6
6
votes
0 answers
Concurrency, general guidance on application design
I asked this question over at the rakulang sub reddit and was suggested to post here:
I keep falling back to Perl 5 for a lot of my work so I can "get it done" simply because I am so much more familiar with Perl 5.
However, I have the need to build…

camstuart
- 623
- 3
- 13
6
votes
2 answers
How to share a variable between two routers module in cro?
I try to use Cro to create a Rest API that will publish messages in rabbitMQ. I would like to split my routes in different modules and compose them with an "include". But I would like to be able to share the same connection to rabbitMQ in each of…

STH
- 63
- 3
6
votes
1 answer
Where should "Cro Endpoint HTTP" be defined?
The console shows this this message after starting cro ('cro run'):
▶ Starting JoanPujol (JoanPujol)
**Endpoint HTTP will be at http://localhost:20000/**
JoanPujol Listening at http://localhost:3000
JoanPujol Shutting down...
♻ Restarting…

Mimosinnet
- 743
- 3
- 8
5
votes
1 answer
How can I insert some route-checking middleware in Cro?
Say I need to check some URI before I serve some result. I can do something like this:
sub type-routes {
route {
get -> Str $type where $type ∈ @food-types {
my %ingredients-table = $rrr.calories-table;
my @result…

jjmerelo
- 22,578
- 8
- 40
- 86
5
votes
0 answers
Make sure email is stored as a string [Raku]
Not sure how to close this, but I can no longer delete it either...
The issue is resolved
I have a form where users input an email and CRO tries to query the email in an accounts database to find a match. The problem is that Sqlite3 sees the @…

3leggedquid
- 67
- 1
- 4
5
votes
0 answers
Cro run throwing connection reset by peer
I am trying to implement the Cro Service from the Cro getting started documentation. It compiled fine but when I tried to access the link using browser, it shows cannot reach the site and throws "Connection reset by peer" error with no other…

Abeer
- 153
- 6