🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
uzl[m] tbrowder: It'd be great if you could add some image to the module's readme showcasing the result from Draw2D::Furniture 00:06
lizmat++ for keeping on top of things ;-)!
tbrowder uzl[m]: good idea, i'll see what i can do... 00:08
[Coke] MasterDuke: working on a response. 01:02
[Coke] gives up for tonight and posts this as his work in progress: 01:37
gist.github.com/coke/91e50f577cfe7...6d44541a3a 01:45
Feel free to steal any of that if you're putting together a response.
ToddAndMargo Anybody home? 02:03
What is the opposite of "get". I want to send something to the Internet 02:04
Grinnz depends what the server expects but usually POST or PUT
ToddAndMargo Thank you! I want to send an smtp command 02:05
Grinnz I was assuming you were talking HTTP of course, which you weren't :P
en.wikipedia.org/wiki/Simple_Mail_...l_overview describes how SMTP works at a high level 02:07
ToddAndMargo I saw an example of "get" to read an http address, so I presumes a little too much. :'(
Grinnz it's quite unrelated to HTTP
except that both are TCP-based
ToddAndMargo do we have a library written for smtp?
Grinnz well, first of all, you usually only need sendmail if your local system already has a working sendmail 02:08
smtp is a second choice after that, because you need to authenticate with the smtp server
direct smtp, i should say 02:09
ToddAndMargo if wish. I have to cross platform Linux and Windows. And pain-in-the-neck, I have to talk to OAuth2 servers
Grinnz I don't see an analogue to Email::Sender for raku, though (which would be your sendmail-or-smtp wrapper) 02:10
there is modules.raku.org/dist/Net::SMTP::C...:HANENKAMP
Grinnz for smtp specifically, but you probably want to use another module to build the MIME message 02:11
modules.raku.org/dist/Email::MIME:cpan:RBT
ToddAndMargo I have all the mime stuff down. 02:11
Grinnz OAuth2 is an HTTP authentication scheme, so I'm not sure how it would apply to sendmail or SMTP 02:13
ToddAndMargo indeed. You have to get all that stuff ready first, then include the token with your smtp command 02:14
ToddAndMargo Where I am stopped is the syntax to send the token 02:15
Grinnz it is probably a message header 02:16
may even be the same Authorization header a normal HTTP request would use
ToddAndMargo not seeing a way to add a header to Email::MIME:cpan:RBT. Or a way to talk to the author 02:19
Grinnz in the example header-str's value appears to be the set of headers
rbt Sorry, I didn't write it. Just took over maintaining it. I mostly use it for parsing messages. 02:20
ToddAndMargo how do I include an OAuth2 token in the run string? 02:21
rbt Good question. It's a port of the perl5 version. Perhaps the docs here will help: metacpan.org/pod/Email::MIME 02:24
ToddAndMargo metacpan.org/pod/Email::MIME#header Do we have `header_str_pairs` in our port somewhere? 02:25
rbt Yes 02:26
header-str-pairs()
ToddAndMargo Maybe I am on the wrong module. I am on modules.raku.org/dist/Net::SMTP::C...:HANENKAMP and my search function comes up zero on "header" 02:27
Grinnz that is the module for sending the message, not building it 02:30
ToddAndMargo where should I be? 02:32
rbt Both? Build a message (Email::MIME), then take the resulting Str and send it (Net::SMTP*) 02:33
ToddAndMargo Got it. Thank you! I have been doing this with a call to cURL (no Auth2 support). I am looking at my module right now 02:37
ToddAndMargo Looks like I just stick it here: my $email = Email::MIME.create(...) 02:39
[Coke] off topic: any MTG Arena players here?
if so, feel free to DM me friend details. 02:40
cpan-raku New module released to CPAN! Concurrent::PChannel (0.0.1) by 03VRURG 02:42
ToddAndMargo rbt; if I get this working, would you mind if I sent you details so you can add it as an example?
rbt That would be great. 02:43
ToddAndMargo best method to contact you? 02:44
rbt Can you make a github ticket? 02:47
github.com/retupmoca/p6-Email-MIME
ToddAndMargo Will do when I get it figured out. Eventually I am going ot wrap CobiaN Backup with it, as Cobian does not support Auth2 is is not longer supported (split infinitive) plus all my Linux call home programs on the servers I support when Google stops supporting Less Secure Apps on g-suite come July 02:51
I also have a pythod example, if tht means anything to you guys: stackoverflow.com/questions/114455...2-possible 02:54
timotimo ToddAndMargo: i assume using Inline::Python is a bit too annoying to deploy to your target systems? 03:38
ToddAndMargo I want to learn python and installing it on Windows machine like I want a hole in the head. I love Raku. I actually enjoy programming in it. 03:40
ToddAndMargo what is this all about? K:\Windows\NtUtil>zef install OAuth2::Client::Google===> Searching for: OAuth2::Client::GoogleEnabled extracting backends [git path psunzip] don't understand C:\Users\tony/.zef/tmp\1585022838.2848.5555.088006717173\OAuth2-Client-Google-0.1.1.tar.gzYou may need to configure one of the following backends, or install its 04:07
underlying software - [tar p5tar unzip]
epony if you get spammed (info freenode.net/kb/answer/usermodes) set: /mode yournick +R 05:10
lizmat clickbaits rakudoweekly.blog/2020/03/23/2020-...ification/ 09:40
Altreus clicks 10:12
dammit! Baited!
[ptc] that happens to me every week too! 10:21
Kaiepi releasable6, status 10:22
releasable6 Kaiepi, Next release in ≈4 days and ≈8 hours. 4 blockers. Changelog for this release was not started yet
Kaiepi, Details: gist.github.com/a384e152a37bcbdda5...848833aa6d
Altreus I was confused why it had the volkswagen logo as the favicon but then I realised it was wordpress 10:29
tadzik . o O ( VolksWörter ) 10:31
tbrowder .tell uzl[m] take a look at the Draw2D::Furniture now 10:33
tellable6 tbrowder, I'll pass your message to uzl[m]
El_Che tadzik: vox populi elsewhere :) 10:38
cpan-raku New module released to CPAN! P5pack (0.0.11) by 03ELIZABETH 10:46
tbrowder uzl[m]: short of gihub pages (haven't used yet) that's the only thing i know how to do 10:51
Kaiepi i have a library that's ready for release once v2020.03 gets released that'll be of interest to anyone who likes their code to be strictly typed github.com/Kaiepi/p6-Data-Record 13:41
can also be used to sanitize data
lizmat Kaiepi: cool, and funny to see p6 in that repo's name :-) 13:45
rypervenche lizmat: I love seeing your consistency with the name change. :D 13:54
lizmat I'm afraid I put that on me, when I suggested the name change :-) 13:55
Kaiepi eh, i'll change the prefix i use for raku repos to ra at some point or other
lizmat * to actually doing the name change
Kaiepi there are around a dozen i'll have to do and rerelease to cpan 13:56
MasterDuke tadzik: ping (in case you've turned off github notifications). github.com/tadzik/Grammar-BNF/pull/15 13:57
tadzik MasterDuke: I have indeed. Thanks :) 13:58
MasterDuke tadzik++ 13:59
tadzik no, MasterDuke++ :)
rypervenche It's still very nice to see people pushing and insisting on changes to ultimately have consistency. It's nice to see it taken seriously. :) 14:04
Kaiepi wait, when renaming repos, does the old name redirect to the new one? 14:05
jnthn Yes 14:07
nine is glad to have never used a language prefix for his repos :)
Kaiepi ah, then there's no problem renaming them then 14:10
Altreus That blog post from brian d foy says "The reduction operator ... knows what operations to do first" 15:10
But the assertion doesn't seem relevant to the topic at hand and is not expounded upon
Can anyone explain what he is referring to? 15:11
thundergnat Altreus, As I understand it he is referring to the associativity of the operator. EG. [**] 2,3,4 is 2**(3**4) not (2**3)**4) 15:17
m: say [**] 2,3,4;
camelia 2417851639229258349412352
Altreus But that's the same as what reduce does already 15:18
Is there an example where it's associative the other way?
2 OP (3 OP 4)
Cos he specifically says it doesn't just apply the operator to the first two and replace them with its result, right? 15:19
But that's indistinguishable from the ** example
thundergnat But.. but it _doesn't_ just do the first two and replace them with its result. 15:20
m: say (2**3)**4; say 2**(3**4); say [**] 2,3,4
camelia 4096
2417851639229258349412352
2417851639229258349412352
thundergnat It does the _last_ two and replaces them with its value, because ** is right associative 15:21
thundergnat m: say [/] 40,4,5; say (40 / 4 ) / 5; say 40 / ( 4 / 5 ); # division on the other hand is left associative 15:26
camelia 2
2
50
colomon Is there a clever zef trick for getting a list of the currently installed modules? 15:31
(getting modules installed on new version is my primary headache with upgrading raku) 15:32
timotimo yes zef list --installed
timotimo a new rakudo will just™ recompile the modules from source so you shouldn't have to reinstall modules i think? 15:32
colomon might still be using rakudobrew 15:35
timotimo++
colomon Inline::Perl5 not installing on 20.2.1? Failed to find dependencies: perl 15:56
Geth doc: sztanyi++ created pull request #3282:
change perl method to raku method
16:07
guifa lizmat++ for weekly 16:10
guifa :-( 17:03
Houston conference just got cancelled
MasterDuke amsterdam too i think 17:04
tbrowder possible project for the Gnome* modules: a configurable Unicode character widget for copy pasting into Raku source code. any interest as a community project? 17:10
dakkar like `gucharmap`? 17:12
guifa MasterDuke: it’s sad, but understandable. I was really looking forward to it though, would have been my first tech conf 17:51
tbrowder dakkar: ?, i'll check it...no, not configurable that i can see, but useful anyway, thnx 17:52
tellable6 tbrowder, I'll pass your message to dakkar
tbrowder i want one that i can configure to a limited set of oft-used chars, best in separate tabs to group them 17:53
anyone using comma? what is expected to be in the "Raku SDK"? 17:55
ah, found it "/path/to/my/raku" 17:57
lizmat guifa: there will be other conferences... 18:19
guifa lizmat: of course! And actually, now that I know I have a place to stay at in NL (one of my good friends is working at the university in Utrecht), maybe I could do the AMS one too 18:21
wildtrees is there a way I can do postgres transactions with DBIish? or should I be using some other pg database library? 18:57
moritz wildtrees: sure, you can execute a "BEGIN WORK" followed by "COMMIT" or "ROLLBACK" statements 19:00
wildtrees can I pass in parameters? I can't seem to use prepare , do seems to work a bit though 19:04
rbt $db.do(q{BEGIN}); 19:05
wildtrees, FYI I fixed the array thing. Just waiting for someone to merge it. github.com/raku-community-modules/...h/pull/176
wildtrees I had found a workaround using string_to_array and @array.join(',') , rbt, thanks 19:06
rbt Postgresql doesn't support prepared queries for transaction control statements (BEGIN/COMMIT, etc.)
wildtrees so how can I pass in parameters into a transaction and see if it is successful in DBIish? 19:07
kinda new to all of this, have done a small amount of sql in the past 19:08
rbt You mean things like isolation level?
You need to build the begin statement yourself. 'BEGIN WORK ISOLATION LEVEL %s'.sprintf('SERIALIZABLE');
wildtrees whats isolation level 19:09
rbt Hmm What did you mean by "parameters into a transaction"
wildtrees I want to basically update two different array columns in two different rows either all together or not at all , as an atomic change
rbt Okay.
wildtrees so I build the query string myself and pass it to $dbh.do($query) ? 19:10
rbt Each statement needs to be it's own string.
So do(q{BEGIN});
Then $sth = $db.prepare(q{UPDATE ... SET foo = $1}); $sth.execute($param);
Then do(q{COMMIT}); 19:11
Erm, I suppose if you want to be fancy you can also use Common Table Expressions for the same thing in a single statement; but that's fairly advanced SQL. 19:12
wildtrees so like do BEGIN, $h1 = prepare($statement1) ; $h.execute ; $h2 = prepare($statement2) ; h2.execute ; do COMMIT (in pseudocode) ?
rbt Yes.
wildtrees how do I know if the transaction is successful or not? 19:13
rbt CATCH {}
The Pg driver throws very nice exceptions. 19:14
wildtrees rbt, where can I read about the possible errors thrown by the Pg driver? 19:15
rbt "Statement Exceptions" github.com/raku-community-modules/DBIish 19:16
Database level errors are converted into Raku exceptions. 19:17
PostgreSQL error classes are documented here: www.postgresql.org/docs/10/errcode...endix.html
wildtrees so if I do something like this do BEGIN ; select $1 <> $2 ; some insert ; do Commit ; why does the insert go through even when $1 = $2? how do I condition a transaction? thought the select <> returns false so it will cause the transaction to fail/abort 19:33
sena_kun wildtrees, are you asking from DBIish perspective or sql perspective? 19:35
wildtrees well I am doing it from dbiISH, but I guess it's more of a pg-sql question, 19:36
sena_kun I am not a dbiish pro, but if you're doing a select and then an insert, there is no condition between them. You might want to explicitly `do` (or prepare/execute, whatever) some postgres query with a conditiona insertion, and examples of those are easy to look up 19:37
*conditional 19:39
rbt wildtrees, `SELECT $1 <> $2` is not an assertion. It simply returns false. 19:50
Or true
wildtrees should I just do the check for raku for now?
Grinnz sql does not condition transactions. that's up to your program logic
wildtrees do the check in raku for now 19:51
rbt yes.
wildtrees is starting to see the pieces slowly coming together
rbt Generally you want to do most of the basic checks first before starting to work with the database.
Grinnz i don't know what DBIish provides, but generally, transaction helpers in code work like: you start a transaction in a scope, if you leave the scope with an exception or otherwise early, it rolls back, otherwise it commits 19:52
so structuring your code to work like that has the best chance of being useful 19:53
wildtrees just had a type mismatch in a transaction (just test code don't need the actual transaction for now) and it seems to hang the transaction block for further requests 19:59
rbt Yep. You need to CATCH exceptions and cleanup state. 20:04
Grinnz your code will need to call either commit or rollback at some point 20:07
always
rbt sub write($a, $b) {
# Pre-write tests
die('A must be larger than B') unless $a > $b;
try {
$db.do: q{BEGIN};
my $sth = $db.prepare: q{INSERT INTO ...};
$sth.execute($a);
$sth.execute($b);
$db.do: q{COMMIT};
CATCH { 20:08
default {
# log?
$db.do: q{ROLLBACK};
}
}
}
write($a, $b);
You'll end up with something like that.
Grinnz ideally you'd also have it rollback if someone leaves the block without reaching COMMIT, but you can also just avoid doing that 20:08
rbt And retry loops for serialization, network, and other temporary errors ... 20:13
vrurg Can't change a github repo status in travis-ci. Can anybody check if this is my local problem or it's something global? 20:21
cpan-raku New module released to CPAN! Termbox (0.0.2) by 03JJATRIA 20:31
cpan-raku New module released to CPAN! Termbox (0.0.3) by 03JJATRIA 21:02
tbrowder what is the raku version of perl's do block (do {})? 22:01
i'm guessing "=> {}" 22:02
Altai-man_ tbrowder, what's the semantics?
tellable6 2020-03-22T18:25:50Z #raku-dev <AlexDaniel> Altai-man_ btw you can use #whateverable channel to abuse the bots
2020-03-22T18:26:16Z #raku-dev <AlexDaniel> Altai-man_ you don't seem to do it often but maybe that's because you don't want to spam on main channels :)
Altai-man_ tbrowder, I think just `{}` is enough, no? 22:04
tbrowder the do block "returns value of last command in the block"
Altai-man_ m: my $a = { 1; 2; 42; }; say $a;
camelia WARNINGS for <tmp>:
-> ;; $_? is raw = OUTER::<$_?> { #`(Block|84735176) ... }
Useless use of constant integer 2 in sink context (line 1)
Useless use of constant integer 1 in sink context (line 1)
Altai-man_ m: my $a = { say 1; say 2; 42; }; say $a;
camelia -> ;; $_? is raw = OUTER::<$_?> { #`(Block|65343328) ... }
tbrowder i'll try it...thnx 22:05
tbrowder m: say {23} 22:05
camelia -> ;; $_? is raw = OUTER::<$_?> { #`(Block|54582040) ... }
tbrowder say "{23; 1}" 22:06
evalable6 WARNINGS for /tmp/DhJbIVEIyj:
1
Useless use of constant integer 23 in sink context (line 1)
sena_kun m: say do { say 42; 5000 }; 22:07
camelia 42
5000
tbrowder m: my $a = do {1;2}; say $a 22:09
camelia WARNINGS for <tmp>:
2
Useless use of constant integer 1 in sink context (line 1)
tbrowder m: my $a = sub {1;2}; say $a 22:13
camelia WARNINGS for <tmp>:
sub { }
Useless use of constant integer 1 in sink context (line 1)
tbrowder m: my $a = => { 1,2}; say $a 22:14
camelia 5===SORRY!5=== Error while compiling <tmp>
Preceding context expects a term, but found infix => instead.
at <tmp>:1
------> 3my $a = =>7⏏5 { 1,2}; say $a
tbrowder m: sub f(){1;2}; f 22:15
camelia WARNINGS for <tmp>:
Useless use of constant integer 1 in sink context (line 1)
tbrowder m: sub f(){1;2}; say f 22:16
camelia WARNINGS for <tmp>:
2
Useless use of constant integer 1 in sink context (line 1)
vrurg m: say do { 1; 2; 42 } 22:17
camelia WARNINGS for <tmp>:
42
Useless use of constant integer 1 in sink context (line 1)
Useless use of constant integer 2 in sink context (line 1)
vrurg m: say do { say 1; say 2; 42 } 22:18
camelia 1
2
42
lizmat weekly: O'Reilly stopping *all* conference events permanently: www.oreilly.com/conferences/from-l...ldwin.html
notable6 lizmat, Noted! (weekly)
tbrowder looks to me like the p5 do block is some kind of inline function (lamda?)
vrurg tbrowder: not sure. It's just invoking a block. 22:19
perl5 has only anonymous subs, if I still remember it right.
Grinnz do BLOCK just allows you to place a block in expression context 22:21
tbrowder but the p5 code i'm looking at...i'll gist it in a few minutes
Grinnz (in perl)
Grinnz it's not a loop and can't be returned from 22:22
just returns the last expression
tbrowder the raku do "creates a supply..."
so are you saying our bare block should be the same? sounds right as sena_kun said, too, but why can't we assign it to a var? 22:25
tobs tbrowder: that can't be true. Maybe you're confusing the do BLOCK syntax with the do method on a Supply?
vrurg tbrowder: why can't?
m: my &f = { say $_ }; f(pi) 22:26
camelia 3.141592653589793
tbrowder well i don't see the do block in our docs
vrurg tbrowder: ^ this?
tobs tbrowder: docs.raku.org/language/control#ind...flow_do-do
Grinnz nope, that's a sub
vrurg tbrowder: docs.perl6.wakelift.de/language/con...flow_do-do 22:27
Grinnz: what is a sub?
m: my $a = { say $_ }; $a(42) 22:28
camelia 42
tbrowder ok, i couldn't find that in the search box, thnx
Grinnz you're storing code to execute, rather than just immediately running a block and returning the result as perl's do BLOCK does
vrurg tbrowder: type 'do' and around the middle of the suggestions list you'll see control flow do 22:29
Grinnz: Look at my earlier example.
Grinnz yeah that looks more like it
vrurg Grinnz: I was answering tbrowder question about assigning a block to a variable.
tbrowder i was lead astray by the nutshell docs about using repeat instead of do :-D 22:30
tobs oh yeah, that usage of do seems to have been disambiguated from Perl to Raku. Apparently do in Raku can never be made to loop. 22:31
tbrowder ok, thanks much folks! 22:32
Grinnz do BLOCK while ... is a strange special case in perl anyway, mostly meant to emulate C
Xliff . 23:09
tony-o . 23:43
tony-o .tell tbrowder did you express wanting to help test zeco? 23:47
tellable6 tony-o, I'll pass your message to tbrowder
wildtrees m: say {say 1; 2}() ; 23:57
camelia 1
2