Capturing warning

2012-07-12 Thread Gabor Szabo
Hi, is there a way to capture warnings in Perl 6 - similar to $SIG{__WARN__} in Perl 5 ? Gabor

Re: Capturing warning

2012-07-12 Thread Tadeusz Sośnierz
On Thu, 12 Jul 2012 13:27:26 +0200, Gabor Szabo wrote: Hi, is there a way to capture warnings in Perl 6 - similar to $SIG{__WARN__} in Perl 5 ? Gabor CONTROL block seems to be the solution. $ perl6 -e 'warn "oh noes"; CONTROL { default { say "caught: $_" } }' caught: oh noes -- Tadeusz So

Re: Capturing warning

2012-07-12 Thread Gabor Szabo
On Thu, Jul 12, 2012 at 2:31 PM, Tadeusz Sośnierz wrote: > On Thu, 12 Jul 2012 13:27:26 +0200, Gabor Szabo wrote: > >> Hi, >> >> is there a way to capture warnings in Perl 6 - similar to >> $SIG{__WARN__} in Perl 5 ? >> >> Gabor > > > CONTROL block seems to be the solution. > > $ perl6 -e 'warn "

Re: Capturing warning

2012-07-12 Thread Gabor Szabo
On Thu, Jul 12, 2012 at 2:50 PM, Gabor Szabo wrote: > On Thu, Jul 12, 2012 at 2:31 PM, Tadeusz Sośnierz wrote: >> On Thu, 12 Jul 2012 13:27:26 +0200, Gabor Szabo wrote: >> >>> Hi, >>> >>> is there a way to capture warnings in Perl 6 - similar to >>> $SIG{__WARN__} in Perl 5 ? >>> >>> Gabor >> >>

Re: Capturing warning

2012-07-12 Thread Moritz Lenz
Am 12.07.2012 13:50, schrieb Gabor Szabo: On Thu, Jul 12, 2012 at 2:31 PM, Tadeusz Sośnierz wrote: On Thu, 12 Jul 2012 13:27:26 +0200, Gabor Szabo wrote: Hi, is there a way to capture warnings in Perl 6 - similar to $SIG{__WARN__} in Perl 5 ? Gabor CONTROL block seems to be the soluti

File content is not written if close not called

2012-07-12 Thread Gabor Szabo
The following script leaves and epty 'data.txt' behind. Only if I call $fh.close is the file contents saved. Is this a feature? use v6; my $fh = open 'data.txt', :w; $fh.print("hello\n"); Gabor

Re: File content is not written if close not called

2012-07-12 Thread Patrick R. Michaud
On Thu, Jul 12, 2012 at 05:36:58PM +0300, Gabor Szabo wrote: > The following script leaves and epty 'data.txt' behind. > Only if I call $fh.close is the file contents saved. > > Is this a feature? > > use v6; > > my $fh = open 'data.txt', :w; > $fh.print("hello\n"); While Rakudo and Parrot _sho