hash keys are read-only but they're not really readonly ... so Scalar::Util::readonly has bug in that it doesn't document the nuances of readonlyness :)
#!/usr/bin/perl -- use strict; use warnings; use Devel::Peek qw/ Dump /; use Readonly; Readonly::Scalar my $rs => 66; my %hh = qw/ A B /; while( my( $k, $v ) = each %hh ){ Dump( $k ); Dump( $v ); } for( 1 ){ Dump( $_ ); ## the readonliest } Dump( $rs ); __END__
SV = PV(0x3f7b44) at 0x99b8ac
  REFCNT = 1
  FLAGS = (PADMY,POK,FAKE,READONLY,pPOK)
  PV = 0x99ce88 "A"
  CUR = 1
  LEN = 0
SV = PV(0x3f7b4c) at 0xaca8bc
  REFCNT = 1
  FLAGS = (PADMY,POK,pPOK)
  PV = 0xadf504 "B"\0
  CUR = 1
  LEN = 12
SV = IV(0xae0670) at 0xae0674
  REFCNT = 2
  FLAGS = (PADTMP,IOK,READONLY,pIOK)
  IV = 1
SV = PVMG(0xad50e4) at 0x3f9bac
  REFCNT = 1
  FLAGS = (PADMY,GMG,SMG,RMG)
  IV = 0
  NV = 0
  PV = 0
  MAGIC = 0x99402c
    MG_VIRTUAL = &PL_vtbl_packelem
    MG_TYPE = PERL_MAGIC_tiedscalar(q)
    MG_FLAGS = 0x02
      REFCOUNTED
    MG_OBJ = 0x3f9adc
    SV = IV(0x3f9ad8) at 0x3f9adc
      REFCNT = 1
      FLAGS = (ROK)
      RV = 0xad353c
      SV = PVMG(0xad50c4) at 0xad353c
        REFCNT = 1
        FLAGS = (PADMY,OBJECT,IOK,pIOK)
        IV = 66
        NV = 0
        PV = 0
        STASH = 0xacab0c        "Readonly::Scalar"

Oh, and http://perldoc.perl.org/perlapi.html#sv_magic is unreadable ...

http://search.cpan.org/dist/illguts/index.html, redefining Internals::SvREADONLY


In reply to Re: Readonly problems (Devel::Peek, Scalar::Util::readonly bug) by Anonymous Monk
in thread Readonly problems by runrig

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.