Home » Computer » Perl Hash...

Net::OpenID::ConsumerGoogleOpenID 登入時一直讀不到,trace 後找到問題出在 args

my $csr = Net::OpenID::Consumer->new(
    ua => LWPx::ParanoidAgent->new,
    args => sub { $self->request->query_parameters->{shift} },
    consumer_secret => 'some random string',
    required_root => 'http://example.com/'
);

vim 裡面突然看到 shift 顏色不太對,才突然想到,是不是 Perl 把「shift」當作是一個字串?

果然改成 shift() 就都正常了...

PS:用 Tatsumaki 拆 Controller 的部份還不錯...

One Reply to “Perl Hash...”

  1. c9s says:

    記得可以用 { +shift } 避免 parser 把 shift 當作 key 的 string. :-P

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Archives