Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Limbic Region (3985)

Limbic Region
  (email not shown publicly)

I love to code perl. If you want to hire me, see details on my homepage.
Thursday May 05, 2005
02:54 PM

More Pugs Fun

[ #24555 ]
Ok - so I was pretty impressed to see that there is already an IRC::Bot written in p6 that Pugs supports.  I didn't like the fact that all the configuration settings were hardcoded in the script so I set out to implement Config::Tiny.

I ran into some things that may be bugs but are most likely my misunderstandings

1.  Bare blocks are NOT looping constructs like in Perl5.  Since next is not implemented yet in Pugs, I thought about doing a bare block with last and was suprised when it didn't work.

2.  $fh.say "foo"; doesn't work.  You need to use $fh.say("foo"); notice the parens

3.  Writing to a file with $fh.say("foo") will result in an empty file if you don't $fh.close.  I would have expected this to be automatically handled.

4.  I don't think //= doesn't do the right thing.  Consider the following:
my %hash;
%hash<foo> //= hash {};
%hash<foo><bar> = 42;

I would expect that to "just work".  Instead, Pugs makes the following complaint:

*** Error: Cannot cast into Hash: VRef <Array> at bug.p6 line 5, column 1-21

5.  I am not sure hash {} works correctly when assigning as the value of a hash key but unfortunately my attempts to reduce it to a simple test case have resulted in more problems.

6.  In trying to determine if problem number 5 was all hash refs or just with the "hash" keyword, I tried the following:

use v6;

my %foo = ( 'one' => 1, 'two' => 2);
my %bar = (
    'me' => 42,
    'you' => \%foo,
%bar<you>.<two> = 42;
say %foo<two>;

This resulted in the following error:
*** Error: Can't modify constant item: VUndef at bug.p6 line 8, column 1-21

I still need to come up with a test suite for Config::Tiny so this is all for now

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.