develooper Front page | perl.perl5.porters | Postings from August 2010

Re: mauve::reftype()

Thread Previous | Thread Next
August 30, 2010 03:46
Re: mauve::reftype()
Message ID:
On 30 August 2010 12:33, Zsbán Ambrus <> wrote:
> On Mon, Aug 30, 2010 at 11:37 AM, demerphq <> wrote:
>> On 30 August 2010 11:07, Zsbán Ambrus <> wrote:
>>> a reftype that does away with the REF/GLOB/LVALUE/whatever madness
>> Actually its interesting you ask this. For various reasons I kinda
>> reworked sv_reftype() and while doing so observed it is somewhat
>> capricious about this. Take a look at the documentation in
>> for reftype(), which is generated from parsing the code in
>> sv_reftype(), to see all the "kinds" of types that we might report. I
>> tried to include sample code of either how to dereference the thing,
>> or code to create one, but some of them im not sure how to create.
> Please tell which types you're talking about if you need help from p5p
> about this.

Here is what is in the pod.

You can generate this with:

            perl -MText::Wrap -le'local $/; $_= <>; while (
m!SV_REFTYPE_RETURN\("(\w+)"\);\s*[/][*]\s*(.*?)\s*[*][/]!gs) {
                $i=$1; ($t=$2)=~s/\s+/ /g; $o.=wrap("\n\n=item
$i\n\n","",$t);} print "=over 4\n$o\n\n=back\n"' sv.c

from a git checkout of blead. Please patch the sv.c sv_reftype_len()
and not the pod.

=over 4


Has special v-string magic

=item REF

Is a reference to another ref (C<< $$ref >>)

=item SCALAR

Is a reference to a scalar (C<< $$scalar >>)

=item LVALUE

An lvalue reference - B<NOTE>, tied lvalues appear to be of type C<SCALAR>
for backwards compatibility reasons

=item ARRAY

An array reference (C<< @$array >>)

=item HASH

A hash reference (C<< %$hash >>)

=item CODE

A subroutine reference (C<< $code->() >>)

=item GLOB

A reference to a glob (C<< *$glob >>)

=item FORMAT

A format reference (C<< *IO{FORMAT} >>)

=item IO

An IO reference (C<< *STDOUT{IO} >>)

=item BIND

A bind reference

=item REGEXP

An executable regular expression (C<< qr/../ >>)


This should never be seen


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About