🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.perl
2 messages
2 total messages Started by felippe Tue, 23 Mar 2010 09:57
MooseX::Method::Signatures - default dla zmiennych nazwanych
#51840
Author: felippe
Date: Tue, 23 Mar 2010 09:57
33 lines
1960 bytes
Witam

Taki problem - w dokumentacji do MooseX::Method::Signatures na cpan
jest przykład na nazwane parametry z wartością domyślną. Problem w
tym, że nawet ten przykład nie działa...

Uproszczona wersja kodu:

package Foo;

    use Moose;
    use MooseX::Method::Signatures;

    method greet ( Int :$type = 1 ) {
        if ($type == 1) {
            print("ONE\n");
        }
        else {
            print("TWO\n");
        }
    }


my $foo = Foo->new();
$foo->greet();


Wynik:
Use of uninitialized value in numeric eq (==) at nazwane.pl line 7.
TWO


Ktoś może zgłębiał/rozwiązał ten problem?
Re: MooseX::Method::Signatures - default dla zmiennych nazwanych
#51841
Author: Krzysztof Krzyżaniak
Date: Tue, 23 Mar 2010 10:31
49 lines
2037 bytes
felippe <fbalicki@gmail.com> writes:

> Witam
>
> Taki problem - w dokumentacji do MooseX::Method::Signatures na cpan
> jest przykład na nazwane parametry z wartością domyślną. Problem w
> tym, że nawet ten przykład nie działa...
>
> Uproszczona wersja kodu:
eloy@jumon:/tmp$ more test.pl 
package Foo;

use Moose;
use MooseX::Method::Signatures;

method greet ( Int :$type = 1 ) {
    if ($type == 1) {
    print("ONE\n");
    }
    else {
    print("TWO\n");
    }
}

package main;
my $foo = Foo->new();
$foo->greet();

> Wynik:
> Use of uninitialized value in numeric eq (==) at nazwane.pl line 7.
> TWO

eloy@jumon:/tmp$ perl test.pl
ONE

> Ktoś może zgłębiał/rozwiązał ten problem?

eloy@jumon:/tmp$ dpkg -l perl libmoosex-method-signatures-perl
[..]
ii  libmoosex-method-signatures-p 0.30-1
ii  perl                          5.10.1-11

sprawdź czy masz najnowsze wersje pakietów.

  eloy
-- 
-------e-l-o-y----------------------------e-l-o-y-@-k-o-f-e-i-n-a-.-n-e-t------

       jak to dobrze, że są oceany - bez nich byłoby jeszcze smutniej
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads