Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts between the :shared attribute and lvalue subroutines #7405

Closed
p5pRT opened this issue Jul 4, 2004 · 6 comments
Closed

Conflicts between the :shared attribute and lvalue subroutines #7405

p5pRT opened this issue Jul 4, 2004 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 4, 2004

Migrated from rt.perl.org#30582 (status was 'resolved')

Searchable as RT30582$

@p5pRT
Copy link
Author

p5pRT commented Jul 4, 2004

From nigelsandever@btconnect.com

Created by nigelsandever@btconnect.com

The following snippet demonstrates a conflict between the :shared attribute and
lvalue subroutines.
Remove the :shared attribute from %things and the subject error goes away.

#! perl -slw
use strict;

package test;
use threads;
use threads​::shared;

my %things : shared;

sub new {
  my( $class, $thing ) = @​_;
  my $self = bless \$class, $class;
  $things{ $self } = $thing;
  return $self;
}

sub thing : lvalue {
  $things{ $_[ 0 ] };
}

sub DESTROY {
  delete $things{ $_[ 0 ] };
}

return 1 if caller;

package main;

my $test = test->new( '12345' );
print $test->thing;

$test->thing = 98765;
print $test->thing;

undef $test;
__END__
P​:\test>perl test.pm
12345
Can't return a temporary from lvalue subroutine at test.pm line 32.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.8.4:

Configured by ActiveState at Tue Jun  1 11:52:09 2004.

Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=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='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -
DNO_STRICT -DHAVE_DES_FCRYPT  -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -
DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"c:
\Perl\lib\CORE"  -machine:x86'
    libpth=C:\PROGRA~1\MICROS~3\VC98\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib 
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib 
msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib 
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib 
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf  -
libpath:"c:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    22751 Update to Test.pm 1.25
    21540 Fix backward-compatibility issues in if.pm


@INC for perl v5.8.4:
    C:/Perl/lib
    C:/Perl/site/lib
    .


Environment for perl v5.8.4:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32
\UnixTools;c:\perl584\bin;c:\perl561\bin;c:\perl581\bin;c:\perl561\bin;c:\cl;
    PERL_BADLANG (unset)
    SHELL (unset)







@p5pRT
Copy link
Author

p5pRT commented Jul 5, 2004

From @lizmat

At 7​:22 PM +0000 7/4/04, nigelsandever@​btconnect.com (via RT) wrote​:

# New Ticket Created by nigelsandever@​btconnect.com
# Please include the string​: [perl #30582]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org​:80/rt3/Ticket/Display.html?id=30582 >

This is a bug report for perl from nigelsandever@​btconnect.com,
generated with the help of perlbug 1.35 running under perl v5.8.4.

-----------------------------------------------------------------
[Please enter your report here]

The following snippet demonstrates a conflict between the :shared
attribute and
lvalue subroutines.

FWIW, it's the sharedness of the hash that's causing the problem, not
the attribute.

Remove the :shared attribute from %things and the subject error goes away.

#! perl -slw
use strict;

package test;
use threads;
use threads​::shared;

my %things : shared;

Replacing the above line with​:

my %things;
share( %things );

gives the same problem.

Liz

@p5pRT
Copy link
Author

p5pRT commented Jul 5, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 5, 2004

From @ysth

On Mon, Jul 05, 2004 at 09​:27​:52AM +0200, Elizabeth Mattijsen <liz@​dijkmat.nl> wrote​:

At 7​:22 PM +0000 7/4/04, nigelsandever@​btconnect.com (via RT) wrote​:

The following snippet demonstrates a conflict between the :shared
attribute and
lvalue subroutines.

FWIW, it's the sharedness of the hash that's causing the problem, not
the attribute.

Remove the :shared attribute from %things and the subject error goes away.

#! perl -slw
use strict;

package test;
use threads;
use threads​::shared;

my %things : shared;

Replacing the above line with​:

my %things;
share( %things );

gives the same problem.

Nothing to do with sharing; just magic​:

$ perl -MTie​::Hash -we'tie %x,"Tie​::StdHash"; sub foo​:lvalue {$x{foo}} foo=1'
Can't return a temporary from lvalue subroutine at -e line 1.

@p5pRT
Copy link
Author

p5pRT commented Jul 20, 2005

From @rgs

Fixed in bleadperl by :

Change 25194 on 2005/07/20 by rgs@​bloom

  Subject​: [PATCH] lvalue-subs returning elements of tied
hashes/arrays
  From​: Tassilo von Parseval <tassilo.von.parseval@​rwth-aachen.de>
  Date​: Wed, 20 Jul 2005 10​:43​:11 +0200
  Message-id​: <20050720084311.GA20332@​ethan>

@p5pRT
Copy link
Author

p5pRT commented Jul 20, 2005

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant