develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #120122] Buggy smartmatch on tied array

Thread Previous | Thread Next
From:
Sanko Robinson
Date:
October 6, 2013 15:50
Subject:
[perl #120122] Buggy smartmatch on tied array
Message ID:
rt-3.6.HEAD-26210-1381074623-30.120122-75-0@perl.org
# New Ticket Created by  Sanko Robinson 
# Please include the string:  [perl #120122]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=120122 >


This is a bug report for perl from sanko@cpan.org,
generated with the help of perlbug 1.39 running under perl 5.16.3.


-----------------------------------------------------------------
More tie() tinkering... I've found that the now experimental smartmatch
operator does not work well with tied arrays. Simple example:

    use Tie::Array;
    tie my @array_t, 'Tie::StdArray';
    @array_t = qw[aaa bbb ccc ddd eee];
    print "tied smatch:  " . (/a/ ~~ @array_t) . "\n";
    print "tied grep:    " . (grep {/a/} @array_t) . "\n";

Smartmatch correctly calls the FETCHSIZE method but the magic is ignored
when it's time to get the individual elements. FETCH is never called and
undefined values are matched instead. FWIW, matching against tied hashes
seems to work as it should.

Original discussion on PerlMonks: http://perlmonks.org/?node_id=1057045
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.16.3:

Configured by strawberry-perl at Tue Mar 12 13:56:09 2013.

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname='Win32 strawberry-perl 5.16.3.1 #1 Tue Mar 12 13:55:20 2013 i386'
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags =' -s -O2 -DWIN32  -DPERL_TEXTMODE_SCRIPTS
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing
-mms-bitfields',
    optimize='-s -O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long
long', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE"
-L"C:\strawberry\c\lib"'
    libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib
    libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32
-lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool
-lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid
-lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=, so=dll, useshrplib=true, libperl=libperl516.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -s
-L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"'

Locally applied patches:


---
@INC for perl 5.16.3:
    C:/strawberry/perl/site/lib/MSWin32-x86-multi-thread
    C:/strawberry/perl/site/lib
    C:/strawberry/perl/vendor/lib
    C:/strawberry/perl/lib
    .

---
Environment for perl 5.16.3:
    HOME=C:\Users\Sanko
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Ruby193\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Mercurial;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program
Files\Python32\Lib\site-packages\PyQt4;C:\Program
Files\Prio;C:\Program Files\git-cola\bin;C:\Program
Files\Git\cmd;C:\Program Files\Git\bin;;
    PERL_BADLANG (unset)
    PERL_CPANM_OPT=--mirror http://cpan.cpantesters.org --verbose
--notest --force
    SHELL (unset)
-- 
Sanko Robinson
sanko@cpan.org


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About