Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 123385
Status: open
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: joseluis.martinez [...] capside.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



X-MS-Exchange-Crosstenant-Fromentityheader: Hosted
Spamdiagnosticmetadata: NSPM
MIME-Version: 1.0
Spamdiagnosticoutput: 1:99
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
Content-Type: multipart/alternative; boundary="_000_VI1PR06MB3117455F4798AD63086F3B08F0440VI1PR06MB3117eurp_"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Exchange-Antispam-Report-Test: UriScan:(211171220733660);
X-Spam-Score: -1.898
X-MS-Publictraffictype: Email
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 4311C240384 for <cpan-bug+Moose [...] hipster.bestpractical.com>; Thu, 26 Oct 2017 02:20:44 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Tna145V0M1W for <cpan-bug+Moose [...] hipster.bestpractical.com>; Thu, 26 Oct 2017 02:20:43 -0400 (EDT)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id EC6E224027D for <bug-Moose [...] rt.cpan.org>; Thu, 26 Oct 2017 02:20:42 -0400 (EDT)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id E0F6D11DEE5 for <bug-Moose [...] rt.cpan.org>; Wed, 25 Oct 2017 23:20:40 -0700 (PDT)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 489BB11DA68 for <bug-Moose [...] rt.cpan.org>; Wed, 25 Oct 2017 23:20:33 -0700 (PDT)
Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0089.outbound.protection.outlook.com [104.47.2.89]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 33CE411DEE5 for <bug-Moose [...] rt.cpan.org>; Wed, 25 Oct 2017 23:20:20 -0700 (PDT)
Received: from VI1PR06MB3117.eurprd06.prod.outlook.com (10.170.230.20) by VI1PR06MB3120.eurprd06.prod.outlook.com (10.170.230.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Wed, 25 Oct 2017 22:44:57 +0000
Received: from VI1PR06MB3117.eurprd06.prod.outlook.com ([fe80::c80f:1b6b:2156:e695]) by VI1PR06MB3117.eurprd06.prod.outlook.com ([fe80::c80f:1b6b:2156:e695%13]) with mapi id 15.20.0178.007; Wed, 25 Oct 2017 22:44:57 +0000
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] capsidebcn.onmicrosoft.com
Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=joseluis.martinez [...] capside.com;
X-MS-Exchange-Antispam-Srfa-Diagnostics: SSOS;
Delivered-To: cpan-bug+Moose [...] hipster.bestpractical.com
Subject: Native trait initializing attribute
Thread-Index: AQHTTeIGdzEMZIRyskqNHA5FhvfeRQ==
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=capsidebcn.onmicrosoft.com; s=selector1-capside-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GA8d3tpQxXCabDG/muUPs5H2hp8qiULG9f7njVO5h94=; b=brwq4XfNIjhn8wz2TNBNy9R56eN8/NMVBMteC+SVHdwxGt3dMCpQzUs8jKqtUMdXaMpUG0uy64AVA5we30Mjte3jpV4hDcMROGIcb+AO5/LlbSMUgLK1f4/gTDwu+Dgrt02g9Z4U7Rn+L7/b1tTHHPG5H59orC7caYBjUXnmk20=
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_50_70 0.1, HTML_NO_HTTP 0.1, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, SPF_PASS 0, WEBMAIL_SOURCE 0, WEBMAIL_XOIP 0, WEBMAIL_X_IP_HDR 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HAS_XOIP 0, __HTML_TAG_DIV 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __RDNS_OUTLOOK 0, __SANE_MSGID 0, __STYLE_RATWARE_NEG 0, __STYLE_TAG 0, __SUBJ_ALPHA_END 0, __TAG_EXISTS_HTML 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NO_NAME 0, __zen.spamhaus.org_ERROR '
Date: Wed, 25 Oct 2017 22:44:56 +0000
X-Originatororg: capside.com
X-MS-Office365-Filtering-Correlation-ID: cb834f28-2e3b-4d09-8f59-08d51bfa0449
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2017.10.26.60916
X-MS-Exchange-Crosstenant-ID: bae0b7bb-6fd0-479e-931b-b28a7cfd5530
To: "bug-Moose [...] rt.cpan.org" <bug-Moose [...] rt.cpan.org>
X-Exchange-Antispam-Report-Cfa-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231020)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(2016111802025)(20161123558100)(6072148)(6043046)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR06MB3120;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR06MB3120;
X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4603075)(4627075)(201702281549075)(2017052603199);SRVR:VI1PR06MB3120;
X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(376002)(346002)(189002)(199003)(55016002)(316002)(189998001)(478600001)(81166006)(3660700001)(54356999)(50986999)(8676002)(66066001)(25786009)(2906002)(101416001)(3480700004)(3280700002)(33656002)(68736007)(74316002)(8936002)(5250100002)(5640700003)(54896002)(14454004)(2900100001)(99286003)(7736002)(53936002)(81156014)(102836003)(6116002)(3846002)(86362001)(6436002)(6506006)(9686003)(2501003)(106356001)(105586002)(6916009)(97736004)(2351001)(19627405001)(5660300001)(7696004)(6606003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR06MB3120;H:VI1PR06MB3117.eurprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en;
X-MS-Exchange-Crosstenant-Network-Message-ID: cb834f28-2e3b-4d09-8f59-08d51bfa0449
X-Spam-Status: No, score=-1.898 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, SPF_FAIL=0.001] autolearn=no
Received-SPF: None (protection.outlook.com: capside.com does not designate permitted sender hosts)
X-Microsoft-Exchange-Diagnostics: 1;VI1PR06MB3120;6:7mkxm/Vz4q4uwkZN80H3eaurs0ef9OTJcRM87zJq5fwGWKF1JCcNbljASWENvR1frgDBYPEEIdGyjkAG//L7jy6inZDOK8+NAkzjnzdy0ldk1NjMLN6ts3a+PxODv5M9WjbyuElKsnmDAvzLrDrzlLiKrm21gkJsmh53cMpZqaAAz+2hsIxGpcMbk4TwvSZCzzreD70DfDnLarp4fadb8vXV/wrgwiXJ2tvd9MX7qTNagbiSy++ssqaBOkOMMKoyEhyXtDMf+GuNPSSWWB42f9nD0u/lEwfMuXy7iv5ASaQt58zxBo2SuXtio/B0yK9CF6vv/b4ZM9GmjMLRwgsJYQ==;5:Mj+ZiJLIh5K0A+1FUArwjldWBtmzUNmYYAzNottGPskZbqJM1FMba7FmNGIdbBBWejKORUMxIy7VncdpNNXKomBGdtKxyYm2kcVaoz8H5xFMiPTd93x6JuqDWge7GfrUAYKtKYO+cGN+wIUcb1K6sw==;24:yIcO/btSUiWjym0wK87QgHawbSl/8TbmXpTlj36IiVPhDK/zwtvdqa+E1lyEQgC4oq0v2b6Kfw8iR/JWX8ZTGLDU4dE8K9sfKB2ZmTpRywE=;7:og1ykiKuudnZN4PQEOeYOKBGKWfihD6/kYZF0j9PY/32SC5QMkc+b89+oFcu6Vh8ONgOkliExzr+p1eOx58ya1rY/ZXaYwHyC2L8cqbx/v6Uy90VUIiJgx7Q0lQS82q2aK9KQyHoDl+bEDlzEbGEfMta0awLgmubou3m6GvNID+ZD/TPHd893cR6cDfv/ecTs8lehVSlQgTBBpAdYPH5DUTerOE+BBhALQD7rfMFXRE=
X-MS-Traffictypediagnostic: VI1PR06MB3120:
Content-Language: es-ES
Message-ID: <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>
X-Microsoft-Antispam-PRVS: <VI1PR06MB3120243B3108754102980706F0440 [...] VI1PR06MB3120.eurprd06.prod.outlook.com>
X-MS-Tnef-Correlator:
Return-Path: <joseluis.martinez [...] capside.com>
X-MS-Exchange-Crosstenant-Originalarrivaltime: 25 Oct 2017 22:44:56.8778 (UTC)
X-Original-To: cpan-bug+Moose [...] hipster.bestpractical.com
X-RT-Mail-Extension: moose
X-Forefront-PRVS: 0471B73328
X-Greylist: delayed 18059 seconds by postgrey-1.34 at xx1.develooper.com; Wed, 25 Oct 2017 23:20:22 PDT
Thread-Topic: Native trait initializing attribute
X-MS-Has-Attach:
X-Originating-Ip: [37.223.243.148]
Accept-Language: es-ES, en-US
X-MS-Exchange-Transport-Crosstenantheadersstamped: VI1PR06MB3120
From: Jose Luis Martínez Torres <joseluis.martinez [...] capside.com>
X-RT-Interface: Email
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: iso-8859-1
Content-Length: 583
Download (untitled) / with headers
text/plain 583b
Hi, I've discovered this behaviour. I'm reporting it as a bug because it seemed strange: #!/usr/bin/env perl use Test::More; package Test { use Moose; has prop => (is => 'ro', isa => 'HashRef', traits => [ 'Hash' ], handles => { count_prop => 'count' }); } my $instance = Test->new; ok(not(defined $instance->prop), 'prop is undefined'); $instance->count_prop; ok(not(defined $instance->prop), 'prop is undefined'); prop gets initialized to a {} when count_prop is called, which is unexpected (it breaks later comparisions for "definedness") Best Regards, Jose Luis
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1440
MIME-Version: 1.0
In-Reply-To: <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-5750-1509044036-608.123385-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1092
On 2017-10-26 01:20:45, joseluis.martinez@capside.com wrote: Show quoted text
> Hi, > > > I've discovered this behaviour. I'm reporting it as a bug because it > seemed strange: > > > #!/usr/bin/env perl > use Test::More; > package Test { > use Moose; > has prop => (is => 'ro', isa => 'HashRef', traits => [ 'Hash' ], > handles => { count_prop => 'count' }); > } > > my $instance = Test->new; > ok(not(defined $instance->prop), 'prop is undefined'); > $instance->count_prop; > ok(not(defined $instance->prop), 'prop is undefined'); > > prop gets initialized to a {} when count_prop is called, which is > unexpected (it breaks later comparisions for "definedness")
This is definitely a real issue. The fix is to have to tweak our Hash (and Array too) native trait code generation to check that the slot is populated before doing any further operations. This shouldn't too hard, just somewhat tedious because the code is a bit complex. If you wanted to help then updating the test suite to test that the various native trait methods don't auto-vivify the underlying reference would be very helpful!
X-MS-Exchange-Crosstenant-Fromentityheader: Hosted
Spamdiagnosticmetadata: NSPM
MIME-Version: 1.0
Spamdiagnosticoutput: 1:99
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Content-Type: multipart/alternative; boundary="_000_VI1PR06MB3117641E12E5D31482F72E93F0450VI1PR06MB3117eurp_"
X-Spam-Score: -3.898
X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(211171220733660);
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] capsidebcn.onmicrosoft.com
Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=joseluis.martinez [...] capside.com;
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 253322403A4 for <cpan-bug+Moose [...] hipster.bestpractical.com>; Thu, 26 Oct 2017 17:47:42 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cBhLY7DvfJ+P for <cpan-bug+Moose [...] hipster.bestpractical.com>; Thu, 26 Oct 2017 17:47:40 -0400 (EDT)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id C2AEC240268 for <bug-Moose [...] rt.cpan.org>; Thu, 26 Oct 2017 17:47:39 -0400 (EDT)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 7118311D360 for <bug-Moose [...] rt.cpan.org>; Thu, 26 Oct 2017 14:47:38 -0700 (PDT)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 08B2C120013 for <bug-Moose [...] rt.cpan.org>; Thu, 26 Oct 2017 14:47:35 -0700 (PDT)
Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0055.outbound.protection.outlook.com [104.47.2.55]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 051EE11D360 for <bug-Moose [...] rt.cpan.org>; Thu, 26 Oct 2017 14:47:22 -0700 (PDT)
Received: from VI1PR06MB3117.eurprd06.prod.outlook.com (10.170.230.20) by VI1PR06MB3119.eurprd06.prod.outlook.com (10.170.230.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Thu, 26 Oct 2017 21:47:12 +0000
Received: from VI1PR06MB3117.eurprd06.prod.outlook.com ([fe80::c80f:1b6b:2156:e695]) by VI1PR06MB3117.eurprd06.prod.outlook.com ([fe80::c80f:1b6b:2156:e695%13]) with mapi id 15.20.0178.007; Thu, 26 Oct 2017 21:47:12 +0000
X-MS-Publictraffictype: Email
Delivered-To: cpan-bug+Moose [...] hipster.bestpractical.com
X-MS-Exchange-Antispam-Srfa-Diagnostics: SSOS;
Subject: Re: [rt.cpan.org #123385] Native trait initializing attribute
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=capsidebcn.onmicrosoft.com; s=selector1-capside-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CL1CvVYwvyjAjEJVAB8cOXd609Lz0VHIapBctsAXrmQ=; b=fjqynRUdYzIGXYxnrAf3gib8v76cYOc74h26VT7sGYkX/zXGHZHF20v5VinQeSX01ZNR87EOam7YueH15UGR7JKqP1o+L/GomVMhy3wcm+rk8c9ZrY92mYOTB/YPA2KapWPbvm9gF13fcGfkmsDKTeQNpptJDXXLh6radpaQsBI=
Thread-Index: AQHTTeIGdzEMZIRyskqNHA5FhvfeRaL2e8mAgAAvuQg=
Date: Thu, 26 Oct 2017 21:47:12 +0000
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' SUPERLONG_LINE 0.05, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTH_SIZE_3000_MORE 0, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_6000_6999 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, SPF_PASS 0, URI_ENDS_IN_HTML 0, URI_WITH_PATH_ONLY 0, WEBMAIL_SOURCE 0, WEBMAIL_XOIP 0, WEBMAIL_X_IP_HDR 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FORWARDED_MSG 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HAS_XOIP 0, __HIGHBITS 0, __HTML_AHREF_TAG 0, __HTML_TAG_DIV 0, __HTTPS_URI 0, __IN_REP_TO 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __MULTIPLE_URI_HTML 0, __MULTIPLE_URI_TEXT 0, __RDNS_OUTLOOK 0, __SANE_MSGID 0, __STYLE_RATWARE_NEG 0, __STYLE_TAG 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TAG_EXISTS_HTML 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NOT_IMG 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0, __zen.spamhaus.org_ERROR '
X-Originatororg: capside.com
X-Spam-Level:
X-MS-Office365-Filtering-Correlation-ID: e94e2805-9075-4d25-e1ec-08d51cbb1db5
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2017.10.26.213315
X-MS-Exchange-Crosstenant-ID: bae0b7bb-6fd0-479e-931b-b28a7cfd5530
To: "bug-Moose [...] rt.cpan.org" <bug-Moose [...] rt.cpan.org>
X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4603075)(4627075)(201702281549075)(2017052603199);SRVR:VI1PR06MB3119;
X-Exchange-Antispam-Report-Cfa-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(3231020)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123562025)(20161123564025)(2016111802025)(20161123560025)(6072148)(6043046)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR06MB3119;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR06MB3119;
X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(346002)(377424004)(189002)(199003)(24454002)(4001150100001)(966005)(6506006)(54896002)(33656002)(105586002)(2351001)(19627405001)(5660300001)(86362001)(6306002)(85202003)(106356001)(53936002)(7736002)(3660700001)(7696004)(3280700002)(478600001)(8936002)(53546010)(50986999)(97736004)(8676002)(76176999)(2900100001)(54356999)(6606003)(2906002)(606006)(6116002)(3846002)(2950100002)(102836003)(6916009)(5250100002)(9686003)(6246003)(6436002)(66066001)(101416001)(81156014)(85182001)(5640700003)(81166006)(2501003)(14454004)(74316002)(99286003)(316002)(189998001)(55016002)(25786009)(68736007)(229853002)(236005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR06MB3119;H:VI1PR06MB3117.eurprd06.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en;
X-MS-Exchange-Crosstenant-Network-Message-ID: e94e2805-9075-4d25-e1ec-08d51cbb1db5
In-Reply-To: <rt-4.0.18-5750-1509044037-648.123385-6-0 [...] rt.cpan.org>
X-Spam-Status: No, score=-3.898 tagged_above=-99.9 required=10 tests=[AWL=2.000, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FROM_OUR_RT=-4, HTML_MESSAGE=0.001, SPF_FAIL=0.001] autolearn=ham
X-Microsoft-Exchange-Diagnostics: 1;VI1PR06MB3119;6:toJzUOBqSh+T/GSks+I7n/lLowNWpDZtv5rC0w3pOuBEV6aBy9wKnKr7b+sYWvprBiRmlh4MU5vYl9ecPXG7O35VptupACCXIV1RO4ywJYL7GEto7PFEmhErI/WOIQpXWrvJX214qUttcWxcfq69jtU36DxbEN0Mo9h5CLsqyRDN4CS2aRnSW8Nh2xn63p6j1Mtco6ffmLbJl1nz+BFmcvpP8i9ChqU2NsJ3jAS5H0je87QZY7H0mOAqe4Juwbb5CTN97PieAo06TIxKqJ2yOiJBC/2mf4/k20Hu/cHMFtKxD/N0TxreiXoVetsfrUfutzh0AP2ngJT3mtnRgF7fbLdpesR+DIy980vC7A1CgDc=;5:+i3o6WFHyd6ZoPNTYcVCvq6v4BxE4qYIpHHmeBEv5P6xd4FDZ5QJTQUP5R8G5+VHg2pI6mdpkQbORdfJrLIixO/U/hw8hERMBSrhg7iIp+TYRVDgSAbIU416a3jJIY2r+zXMUUj+nHnFgxyLpAMr5WjveNH2/pwtl0Taj4+tGMk=;24:OuYcH9nINA/4E0h94uCo53M7/bkSoamP2yMrkwVwoXVS+HLGMwLDfrXa24ZcPVugIVU1Idh/gZQ1s/0SZInua2tiU9Mjk3HrBL0u36IOz4Q=;7:cksL/dfW1ghcwi4Lq273FTDcpD23BfdHb9Vmr8yXcv08imWlAH1mWCm/rSXbl6Zn9GMDltDxZmDz72TDYiAWcjCb1SNdNWVk7F68eJvSLKHrWOJArS0nqSHZbZfPAp5EPL370r5pcrplh7KafkfeWOh/bhCK9XOxfs2IP7EkjrMby5NqsKpM5Qv5CtPzXIGorQArnsYY/m35Mm2PIsZsYiEpoShDKQWhvQFYAGgnWCI1KY/71WAGno9t5C794LbD
X-MS-Traffictypediagnostic: VI1PR06MB3119:
Received-SPF: None (protection.outlook.com: capside.com does not designate permitted sender hosts)
X-RT-Interface: API
Content-Language: es-ES
References: <RT-Ticket-123385 [...] rt.cpan.org> <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>,<rt-4.0.18-5750-1509044037-648.123385-6-0 [...] rt.cpan.org>
Message-ID: <VI1PR06MB3117641E12E5D31482F72E93F0450 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>
X-MS-Tnef-Correlator:
X-Microsoft-Antispam-PRVS: <VI1PR06MB3119708114D176659FB13856F0450 [...] VI1PR06MB3119.eurprd06.prod.outlook.com>
Return-Path: <joseluis.martinez [...] capside.com>
X-RT-Mail-Extension: moose
X-Original-To: cpan-bug+Moose [...] hipster.bestpractical.com
X-MS-Exchange-Crosstenant-Originalarrivaltime: 26 Oct 2017 21:47:12.4308 (UTC)
X-Forefront-PRVS: 04724A515E
X-MS-Has-Attach:
Thread-Topic: [rt.cpan.org #123385] Native trait initializing attribute
X-Originating-Ip: [37.223.243.148]
Accept-Language: es-ES, en-US
From: Jose Luis Martínez Torres <joseluis.martinez [...] capside.com>
X-MS-Exchange-Transport-Crosstenantheadersstamped: VI1PR06MB3119
RT-Message-ID: <rt-4.0.18-16311-1509054463-972.123385-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: utf-8
Content-Length: 1709
Download (untitled) / with headers
text/plain 1.6k
Hi, I've written the test here: https://github.com/moose/Moose/pull/153. Curiously, I've found that undefined attributes with Array delegated methods die. IMHO they should work like the Hash delegated methods (not dying, and returning 0, undef, etc). Hope it helps 😊 Jose Luis Martinez Show quoted text
________________________________ De: Dave Rolsky via RT <bug-Moose@rt.cpan.org> Enviado: jueves, 26 de octubre de 2017 20:53 Para: Jose Luis Martínez Torres Asunto: [rt.cpan.org #123385] Native trait initializing attribute <URL: https://rt.cpan.org/Ticket/Display.html?id=123385 > On 2017-10-26 01:20:45, joseluis.martinez@capside.com wrote:
> Hi, > > > I've discovered this behaviour. I'm reporting it as a bug because it > seemed strange: > > > #!/usr/bin/env perl > use Test::More; > package Test { > use Moose; > has prop => (is => 'ro', isa => 'HashRef', traits => [ 'Hash' ], > handles => { count_prop => 'count' }); > } > > my $instance = Test->new; > ok(not(defined $instance->prop), 'prop is undefined'); > $instance->count_prop; > ok(not(defined $instance->prop), 'prop is undefined'); > > prop gets initialized to a {} when count_prop is called, which is > unexpected (it breaks later comparisions for "definedness")
This is definitely a real issue. The fix is to have to tweak our Hash (and Array too) native trait code generation to check that the slot is populated before doing any further operations. This shouldn't too hard, just somewhat tedious because the code is a bit complex. If you wanted to help then updating the test suite to test that the various native trait methods don't auto-vivify the underlying reference would be very helpful!
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: utf-8
Content-Length: 3015
MIME-Version: 1.0
In-Reply-To: <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-19902-1510456761-1389.123385-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 445
Download (untitled) / with headers
text/plain 445b
I started looking at this some more and realize that how native trait delegations should handle unset attributes is really poorly defined. For getters returning undef or an empty list may make sense, but for setter methods it seems like an explicit exception is preferable. But then I wonder if we should throw an exception for _all_ types of methods. I'm trying to start a discussion on the #moose-dev IRC channel to see if anyone has thoughts.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-19902-1510456761-1389.123385-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <VI1PR06MB3117455F4798AD63086F3B08F0440 [...] VI1PR06MB3117.eurprd06.prod.outlook.com> <rt-4.0.18-19902-1510456761-1389.123385-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-14241-1510559346-1231.123385-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 971
Download (untitled) / with headers
text/plain 971b
On Sat Nov 11 22:19:21 2017, DROLSKY wrote: Show quoted text
> I started looking at this some more and realize that how native trait > delegations should handle unset attributes is really poorly defined.
Yep! I started suspecting that when seeing how the test cases behave different for Arrays and Hashes Show quoted text
> For getters returning undef or an empty list may make sense, but for > setter methods it seems like an explicit exception is preferable.
I'm more of the opinion that setters should autovivify the attribute, finally doing what they are told to do without imposing a special case on the consumer (after all he is already saying that the attribute is a Hashref, so "set this key to this value" setter should just create the new Hash and set the key, or push onto an Array should create the new array and push to it). Show quoted text
> I'm trying to start a discussion on the #moose-dev IRC > channel to see if anyone has thoughts.
Thanks for starting the discussion! Best Regards, Jose Luis


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.