{
    "content": [
        {
            "type": "text",
            "text": "# Variable::Magic (perldoc)\n\n## NAME\n\nVariable::Magic - Associate user-defined magic to variables from Perl.\n\n## SYNOPSIS\n\nuse Variable::Magic qw<wizard cast VMGOPINFONAME>;\n{ # A variable tracer\nmy $wiz = wizard(\nset  => sub { print \"now set to ${$[0]}!\\n\" },\nfree => sub { print \"destroyed!\\n\" },\n);\nmy $a = 1;\ncast $a, $wiz;\n$a = 2;        # \"now set to 2!\"\n}               # \"destroyed!\"\n{ # A hash with a default value\nmy $wiz = wizard(\ndata     => sub { $[1] },\nfetch    => sub { $[2] = $[1] unless exists $[0]->{$[2]}; () },\nstore    => sub { print \"key $[2] stored in $[-1]\\n\" },\ncopykey => 1,\nopinfo  => VMGOPINFONAME,\n);\nmy %h = (default => 0, apple => 2);\ncast %h, $wiz, 'default';\nprint $h{banana}, \"\\n\"; # \"0\" (there is no 'banana' key in %h)\n$h{pear} = 1;           # \"key pear stored in helem\"\n}\n\n## DESCRIPTION\n\nMagic is Perl's way of enhancing variables. This mechanism lets the user add extra data to any\nvariable and hook syntactical operations (such as access, assignment or destruction) that can be\napplied to it. With this module, you can add your own magic to any variable without having to\nwrite a single line of XS.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **FUNCTIONS**\n- **CONSTANTS**\n- **COOKBOOK** (3 subsections)\n- **PERL MAGIC HISTORY**\n- **EXPORT**\n- **CAVEATS**\n- **DEPENDENCIES**\n- **SEE ALSO**\n- **AUTHOR**\n- **BUGS**\n- **SUPPORT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Variable::Magic",
        "section": "",
        "mode": "perldoc",
        "summary": "Variable::Magic - Associate user-defined magic to variables from Perl.",
        "synopsis": "use Variable::Magic qw<wizard cast VMGOPINFONAME>;\n{ # A variable tracer\nmy $wiz = wizard(\nset  => sub { print \"now set to ${$[0]}!\\n\" },\nfree => sub { print \"destroyed!\\n\" },\n);\nmy $a = 1;\ncast $a, $wiz;\n$a = 2;        # \"now set to 2!\"\n}               # \"destroyed!\"\n{ # A hash with a default value\nmy $wiz = wizard(\ndata     => sub { $[1] },\nfetch    => sub { $[2] = $[1] unless exists $[0]->{$[2]}; () },\nstore    => sub { print \"key $[2] stored in $[-1]\\n\" },\ncopykey => 1,\nopinfo  => VMGOPINFONAME,\n);\nmy %h = (default => 0, apple => 2);\ncast %h, $wiz, 'default';\nprint $h{banana}, \"\\n\"; # \"0\" (there is no 'banana' key in %h)\n$h{pear} = 1;           # \"key pear stored in helem\"\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 127,
                "subsections": []
            },
            {
                "name": "FUNCTIONS",
                "lines": 158,
                "subsections": []
            },
            {
                "name": "CONSTANTS",
                "lines": 65,
                "subsections": []
            },
            {
                "name": "COOKBOOK",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Associate an object to any perl variable",
                        "lines": 32
                    },
                    {
                        "name": "Recursively cast magic on datastructures",
                        "lines": 41
                    },
                    {
                        "name": "Delayed magic actions",
                        "lines": 37
                    }
                ]
            },
            {
                "name": "PERL MAGIC HISTORY",
                "lines": 41,
                "subsections": []
            },
            {
                "name": "EXPORT",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DEPENDENCIES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SUPPORT",
                "lines": 11,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Variable::Magic - Associate user-defined magic to variables from Perl.\n",
                "subsections": []
            },
            "VERSION": {
                "content": "Version 0.62\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Variable::Magic qw<wizard cast VMGOPINFONAME>;\n\n{ # A variable tracer\nmy $wiz = wizard(\nset  => sub { print \"now set to ${$[0]}!\\n\" },\nfree => sub { print \"destroyed!\\n\" },\n);\n\nmy $a = 1;\ncast $a, $wiz;\n$a = 2;        # \"now set to 2!\"\n}               # \"destroyed!\"\n\n{ # A hash with a default value\nmy $wiz = wizard(\ndata     => sub { $[1] },\nfetch    => sub { $[2] = $[1] unless exists $[0]->{$[2]}; () },\nstore    => sub { print \"key $[2] stored in $[-1]\\n\" },\ncopykey => 1,\nopinfo  => VMGOPINFONAME,\n);\n\nmy %h = (default => 0, apple => 2);\ncast %h, $wiz, 'default';\nprint $h{banana}, \"\\n\"; # \"0\" (there is no 'banana' key in %h)\n$h{pear} = 1;           # \"key pear stored in helem\"\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Magic is Perl's way of enhancing variables. This mechanism lets the user add extra data to any\nvariable and hook syntactical operations (such as access, assignment or destruction) that can be\napplied to it. With this module, you can add your own magic to any variable without having to\nwrite a single line of XS.\n\nYou'll realize that these magic variables look a lot like tied variables. It is not surprising,\nas tied variables are implemented as a special kind of magic, just like any 'irregular' Perl\nvariable : scalars like $!, $( or $^W, the %ENV and %SIG hashes, the @ISA array, \"vec()\" and\n\"substr()\" lvalues, threads::shared variables... They all share the same underlying C API, and\nthis module gives you direct access to it.\n\nStill, the magic made available by this module differs from tieing and overloading in several\nways :\n\n*   Magic is not copied on assignment.\n\nYou attach it to variables, not values (as for blessed references).\n\n*   Magic does not replace the original semantics.\n\nMagic callbacks usually get triggered before the original action takes place, and cannot\nprevent it from happening. This also makes catching individual events easier than with\n\"tie\", where you have to provide fallbacks methods for all actions by usually inheriting\nfrom the correct \"Tie::Std*\" class and overriding individual methods in your own class.\n\n*   Magic is multivalued.\n\nYou can safely apply different kinds of magics to the same variable, and each of them will\nbe invoked successively.\n\n*   Magic is type-agnostic.\n\nThe same magic can be applied on scalars, arrays, hashes, subs or globs. But the same hook\n(see below for a list) may trigger differently depending on the type of the variable.\n\n*   Magic is invisible at Perl level.\n\nMagical and non-magical variables cannot be distinguished with \"ref\", \"tied\" or another\ntrick.\n\n*   Magic is notably faster.\n\nMainly because perl's way of handling magic is lighter by nature, and because there is no\nneed for any method resolution. Also, since you don't have to reimplement all the variable\nsemantics, you only pay for what you actually use.\n\nThe operations that can be overloaded are :\n\n*   *get*\n\nThis magic is invoked when the variable is evaluated. It is never called for arrays and\nhashes.\n\n*   *set*\n\nThis magic is called each time the value of the variable changes. It is called for array\nsubscripts and slices, but never for hashes.\n\n*   *len*\n\nThis magic only applies to arrays (though it used to also apply to scalars), and is\ntriggered when the 'size' or the 'length' of the variable has to be known by Perl. This is\ntypically the magic involved when an array is evaluated in scalar context, but also on array\nassignment and loops (\"for\", \"map\" or \"grep\"). The length is returned from the callback as\nan integer.\n\nStarting from perl 5.12, this magic is no longer called by the \"length\" keyword, and\nstarting from perl 5.17.4 it is also no longer called for scalars in any situation, making\nthis magic only meaningful on arrays. You can use the constants\n\"VMGCOMPATSCALARLENGTHNOLEN\" and \"VMGCOMPATSCALARNOLEN\" to see if this magic is\navailable for scalars or not.\n\n*   *clear*\n\nThis magic is invoked when the variable is reset, such as when an array is emptied. Please\nnote that this is different from undefining the variable, even though the magic is called\nwhen the clearing is a result of the undefine (e.g. for an array, but actually a bug prevent\nit to work before perl 5.9.5 - see the history).\n\n*   *free*\n\nThis magic is called when a variable is destroyed as the result of going out of scope (but\nnot when it is undefined). It behaves roughly like Perl object destructors (i.e. \"DESTROY\"\nmethods), except that exceptions thrown from inside a *free* callback will always be\npropagated to the surrounding code.\n\n*   *copy*\n\nWhen applied to tied arrays and hashes, this magic fires when you try to access or change\ntheir elements.\n\nStarting from perl 5.17.0, it can also be applied to closure prototypes, in which case the\nmagic will be called when the prototype is cloned. The \"VMGCOMPATCODECOPYCLONE\" constant\nis true when your perl support this feature.\n\n*   *dup*\n\nThis magic is invoked when the variable is cloned across threads. It is currently not\navailable.\n\n*   *local*\n\nWhen this magic is set on a variable, all subsequent localizations of the variable will\ntrigger the callback. It is available on your perl if and only if \"MGfLOCAL\" is true.\n\nThe following actions only apply to hashes and are available if and only if \"VMGUVAR\" is true.\nThey are referred to as *uvar* magics.\n\n*   *fetch*\n\nThis magic is invoked each time an element is fetched from the hash.\n\n*   *store*\n\nThis one is called when an element is stored into the hash.\n\n*   *exists*\n\nThis magic fires when a key is tested for existence in the hash.\n\n*   *delete*\n\nThis magic is triggered when a key is deleted in the hash, regardless of whether the key\nactually exists in it.\n\nYou can refer to the tests to have more insight of where the different magics are invoked.\n",
                "subsections": []
            },
            "FUNCTIONS": {
                "content": "\"wizard\"\nwizard(\ndata     => sub { ... },\nget      => sub { my ($ref, $data [, $op]) = @; ... },\nset      => sub { my ($ref, $data [, $op]) = @; ... },\nlen      => sub {\nmy ($ref, $data, $len [, $op]) = @; ... ; return $newlen\n},\nclear    => sub { my ($ref, $data [, $op]) = @; ... },\nfree     => sub { my ($ref, $data [, $op]) = @, ... },\ncopy     => sub { my ($ref, $data, $key, $elt [, $op]) = @; ... },\nlocal    => sub { my ($ref, $data [, $op]) = @; ... },\nfetch    => sub { my ($ref, $data, $key [, $op]) = @; ... },\nstore    => sub { my ($ref, $data, $key [, $op]) = @; ... },\nexists   => sub { my ($ref, $data, $key [, $op]) = @; ... },\ndelete   => sub { my ($ref, $data, $key [, $op]) = @; ... },\ncopykey => $bool,\nopinfo  => [ 0 | VMGOPINFONAME | VMGOPINFOOBJECT ],\n)\n\nThis function creates a 'wizard', an opaque object that holds the magic information. It takes a\nlist of keys / values as argument, whose keys can be :\n\n*   \"data\"\n\nA code (or string) reference to a private data constructor. It is called in scalar context\neach time the magic is cast onto a variable, with $[0] being a reference to this variable\nand @[1 .. @-1] being all extra arguments that were passed to \"cast\". The scalar returned\nfrom this call is then attached to the variable and can be retrieved later with \"getdata\".\n\n*   \"get\", \"set\", \"len\", \"clear\", \"free\", \"copy\", \"local\", \"fetch\", \"store\", \"exists\" and\n\"delete\"\n\nCode (or string) references to the respective magic callbacks. You don't have to specify all\nof them : the magic corresponding to undefined entries will simply not be hooked.\n\nWhen those callbacks are executed, $[0] is a reference to the magic variable and $[1] is\nthe associated private data (or \"undef\" when no private data constructor is supplied with\nthe wizard). Other arguments depend on which kind of magic is involved :\n\n*       *len*\n\n$[2] contains the natural, non-magical length of the variable (which can only be a\nscalar or an array as *len* magic is only relevant for these types). The callback is\nexpected to return the new scalar or array length to use, or \"undef\" to default to\nthe normal length.\n\n*       *copy*\n\nWhen the variable for which the magic is invoked is an array or an hash, $[2] is a\neither an alias or a copy of the current key, and $[3] is an alias to the current\nelement (i.e. the value). Since $[2] might be a copy, it is useless to try to\nchange it or cast magic on it.\n\nStarting from perl 5.17.0, this magic can also be called for code references. In\nthis case, $[2] is always \"undef\" and $[3] is a reference to the cloned anonymous\nsubroutine.\n\n*       *fetch*, *store*, *exists* and *delete*\n\n$[2] is an alias to the current key. Note that $[2] may rightfully be readonly if\nthe key comes from a bareword, and as such it is unsafe to assign to it. You can ask\nfor a copy instead by passing \"copykey => 1\" to \"wizard\" which, at the price of a\nsmall performance hit, allows you to safely assign to $[2] in order to e.g.\nredirect the action to another key.\n\nFinally, if \"opinfo => $num\" is also passed to \"wizard\", then one extra element is appended\nto @. Its nature depends on the value of $num :\n\n*       \"VMGOPINFONAME\"\n\n$[-1] is the current op name.\n\n*       \"VMGOPINFOOBJECT\"\n\n$[-1] is the \"B::OP\" object for the current op.\n\nBoth result in a small performance hit, but just getting the name is lighter than getting\nthe op object.\n\nThese callbacks are always executed in scalar context. The returned value is coerced into a\nsigned integer, which is then passed straight to the perl magic API. However, note that perl\ncurrently only cares about the return value of the *len* magic callback and ignores all the\nothers. Starting with Variable::Magic 0.58, a reference returned from a non-*len* magic\ncallback will not be destroyed immediately but will be allowed to survive until the end of\nthe statement that triggered the magic. This lets you use this return value as a token for\ntriggering a destructor after the original magic action takes place. You can see an example\nof this technique in the cookbook.\n\nEach callback can be specified as :\n\n*   a code reference, which will be called as a subroutine.\n\n*   a string reference, where the string denotes which subroutine is to be called when magic is\ntriggered. If the subroutine name is not fully qualified, then the current package at the\ntime the magic is invoked will be used instead.\n\n*   a reference to \"undef\", in which case a no-op magic callback is installed instead of the\ndefault one. This may especially be helpful for *local* magic, where an empty callback\nprevents magic from being copied during localization.\n\nNote that *free* magic is never called during global destruction, as there is no way to ensure\nthat the wizard object and the callback were not destroyed before the variable.\n\nHere is a simple usage example :\n\n# A simple scalar tracer\nmy $wiz = wizard(\nget  => sub { print STDERR \"got ${$[0]}\\n\" },\nset  => sub { print STDERR \"set to ${$[0]}\\n\" },\nfree => sub { print STDERR \"${$[0]} was deleted\\n\" },\n);\n\n\"cast\"\ncast [$@%&*]var, $wiz, @args\n\nThis function associates $wiz magic to the supplied variable, without overwriting any other kind\nof magic. It returns true on success or when $wiz magic is already attached, and croaks on\nerror. When $wiz provides a data constructor, it is called just before magic is cast onto the\nvariable, and it receives a reference to the target variable in $[0] and the content of @args\nin @[1 .. @args]. Otherwise, @args is ignored.\n\n# Casts $wiz onto $x, passing (\\$x, '1') to the data constructor.\nmy $x;\ncast $x, $wiz, 1;\n\nThe \"var\" argument can be an array or hash value. Magic for these scalars behaves like for any\nother, except that it is dispelled when the entry is deleted from the container. For example, if\nyou want to call \"POSIX::tzset\" each time the 'TZ' environment variable is changed in %ENV, you\ncan use :\n\nuse POSIX;\ncast $ENV{TZ}, wizard set => sub { POSIX::tzset(); () };\n\nIf you want to handle the possible deletion of the 'TZ' entry, you must also specify *store*\nmagic.\n\n\"getdata\"\ngetdata [$@%&*]var, $wiz\n\nThis accessor fetches the private data associated with the magic $wiz in the variable. It croaks\nwhen $wiz does not represent a valid magic object, and returns an empty list if no such magic is\nattached to the variable or when the wizard has no data constructor.\n\n# Get the data attached to $wiz in $x, or undef if $wiz\n# did not attach any.\nmy $data = getdata $x, $wiz;\n\n\"dispell\"\ndispell [$@%&*]variable, $wiz\n\nThe exact opposite of \"cast\" : it dissociates $wiz magic from the variable. This function\nreturns true on success, 0 when no magic represented by $wiz could be found in the variable, and\ncroaks if the supplied wizard is invalid.\n\n# Dispell now.\ndie 'no such magic in $x' unless dispell $x, $wiz;\n",
                "subsections": []
            },
            "CONSTANTS": {
                "content": "\"MGfCOPY\"\nEvaluates to true if and only if the *copy* magic is available. This is the case for perl 5.7.3\nand greater, which is ensured by the requirements of this module.\n\n\"MGfDUP\"\nEvaluates to true if and only if the *dup* magic is available. This is the case for perl 5.7.3\nand greater, which is ensured by the requirements of this module.\n\n\"MGfLOCAL\"\nEvaluates to true if and only if the *local* magic is available. This is the case for perl 5.9.3\nand greater.\n\n\"VMGUVAR\"\nWhen this constant is true, you can use the *fetch*, *store*, *exists* and *delete* magics on\nhashes. Initial \"VMGUVAR\" capability was introduced in perl 5.9.5, with a fully functional\nimplementation shipped with perl 5.10.0.\n\n\"VMGCOMPATSCALARLENGTHNOLEN\"\nTrue for perls that don't call *len* magic when taking the \"length\" of a magical scalar.\n\n\"VMGCOMPATSCALARNOLEN\"\nTrue for perls that don't call *len* magic on scalars. Implies \"VMGCOMPATSCALARLENGTHNOLEN\".\n\n\"VMGCOMPATARRAYPUSHNOLEN\"\nTrue for perls that don't call *len* magic when you push an element in a magical array. Starting\nfrom perl 5.11.0, this only refers to pushes in non-void context and hence is false.\n\n\"VMGCOMPATARRAYPUSHNOLENVOID\"\nTrue for perls that don't call *len* magic when you push in void context an element in a magical\narray.\n\n\"VMGCOMPATARRAYUNSHIFTNOLENVOID\"\nTrue for perls that don't call *len* magic when you unshift in void context an element in a\nmagical array.\n\n\"VMGCOMPATARRAYUNDEFCLEAR\"\nTrue for perls that call *clear* magic when undefining magical arrays.\n\n\"VMGCOMPATHASHDELETENOUVARVOID\"\nTrue for perls that don't call *delete* magic when you delete an element from a hash in void\ncontext.\n\n\"VMGCOMPATCODECOPYCLONE\"\nTrue for perls that call *copy* magic when a magical closure prototype is cloned.\n\n\"VMGCOMPATGLOBGET\"\nTrue for perls that call *get* magic for operations on globs.\n\n\"VMGPERLPATCHLEVEL\"\nThe perl patchlevel this module was built with, or 0 for non-debugging perls.\n\n\"VMGTHREADSAFE\"\nTrue if and only if this module could have been built with thread-safety features enabled.\n\n\"VMGFORKSAFE\"\nTrue if and only if this module could have been built with fork-safety features enabled. This is\nalways true except on Windows where it is false for perl 5.10.0 and below.\n\n\"VMGOPINFONAME\"\nValue to pass with \"opinfo\" to get the current op name in the magic callbacks.\n\n\"VMGOPINFOOBJECT\"\nValue to pass with \"opinfo\" to get a \"B::OP\" object representing the current op in the magic\ncallbacks.\n",
                "subsections": []
            },
            "COOKBOOK": {
                "content": "",
                "subsections": [
                    {
                        "name": "Associate an object to any perl variable",
                        "content": "This technique can be useful for passing user data through limited APIs. It is similar to using\ninside-out objects, but without the drawback of having to implement a complex destructor.\n\n{\npackage Magical::UserData;\n\nuse Variable::Magic qw<wizard cast getdata>;\n\nmy $wiz = wizard data => sub { \\$[1] };\n\nsub ud (\\[$@%*&]) : lvalue {\nmy ($var) = @;\nmy $data = &getdata($var, $wiz);\nunless (defined $data) {\n$data = \\(my $slot);\n&cast($var, $wiz, $slot)\nor die \"Couldn't cast UserData magic onto the variable\";\n}\n$$data;\n}\n}\n\n{\nBEGIN { *ud = \\&Magical::UserData::ud }\n\nmy $cb;\n$cb = sub { print 'Hello, ', ud(&$cb), \"!\\n\" };\n\nud(&$cb) = 'world';\n$cb->(); # Hello, world!\n}\n"
                    },
                    {
                        "name": "Recursively cast magic on datastructures",
                        "content": "\"cast\" can be called from any magical callback, and in particular from \"data\". This allows you\nto recursively cast magic on datastructures :\n\nmy $wiz;\n$wiz = wizard data => sub {\nmy ($var, $depth) = @;\n$depth ||= 0;\nmy $r = ref $var;\nif ($r eq 'ARRAY') {\n&cast((ref() ? $ : \\$), $wiz, $depth + 1) for @$var;\n} elsif ($r eq 'HASH') {\n&cast((ref() ? $ : \\$), $wiz, $depth + 1) for values %$var;\n}\nreturn $depth;\n},\nfree => sub {\nmy ($var, $depth) = @;\nmy $r = ref $var;\nprint \"free $r at depth $depth\\n\";\n();\n};\n\n{\nmy %h = (\na => [ 1, 2 ],\nb => { c => 3 }\n);\ncast %h, $wiz;\n}\n\nWhen %h goes out of scope, this prints something among the lines of :\n\nfree HASH at depth 0\nfree HASH at depth 1\nfree SCALAR at depth 2\nfree ARRAY at depth 1\nfree SCALAR at depth 3\nfree SCALAR at depth 3\n\nOf course, this example does nothing with the values that are added after the \"cast\".\n"
                    },
                    {
                        "name": "Delayed magic actions",
                        "content": "Starting with Variable::Magic 0.58, the return value of the magic callbacks can be used to delay\nthe action until after the original action takes place :\n\nmy $delayed;\nmy $delayedaux = wizard(\ndata => sub { $[1] },\nfree => sub {\nmy ($target) = $[1];\nmy $targetdata = &getdata($target, $delayed);\nlocal $targetdata->{guard} = 1;\nif (ref $target eq 'SCALAR') {\nmy $orig = $$target;\n$$target = $targetdata->{mangler}->($orig);\n}\nreturn;\n},\n);\n$delayed = wizard(\ndata => sub {\nreturn +{ guard => 0, mangler => $[1] };\n},\nset  => sub {\nreturn if $[1]->{guard};\nmy $token;\ncast $token, $delayedaux, $[0];\nreturn \\$token;\n},\n);\nmy $x = 1;\ncast $x, $delayed => sub { $[0] * 2 };\n$x = 2;\n# $x is now 4\n# But note that the delayed action only takes place at the end of the\n# current statement :\nmy @y = ($x = 5, $x);\n# $x is now 10, but @y is (5, 5)\n"
                    }
                ]
            },
            "PERL MAGIC HISTORY": {
                "content": "The places where magic is invoked have changed a bit through perl history. Here is a little list\nof the most recent ones.\n\n*   5.6.x\n\n*p14416* : *copy* and *dup* magic.\n\n*   5.8.9\n\n*p28160* : Integration of *p25854* (see below).\n\n*p32542* : Integration of *p31473* (see below).\n\n*   5.9.3\n\n*p25854* : *len* magic is no longer called when pushing an element into a magic array.\n\n*p26569* : *local* magic.\n\n*   5.9.5\n\n*p31064* : Meaningful *uvar* magic.\n\n*p31473* : *clear* magic was not invoked when undefining an array. The bug is fixed as of\nthis version.\n\n*   5.10.0\n\nSince \"PERLMAGICuvar\" is uppercased, \"hvmagiccheck()\" triggers *copy* magic on hash\nstores for (non-tied) hashes that also have *uvar* magic.\n\n*   5.11.x\n\n*p32969* : *len* magic is no longer invoked when calling \"length\" with a magical scalar.\n\n*p34908* : *len* magic is no longer called when pushing / unshifting an element into a\nmagical array in void context. The \"push\" part was already covered by *p25854*.\n\n*g9cdcb38b* : *len* magic is called again when pushing into a magical array in non-void\ncontext.\n",
                "subsections": []
            },
            "EXPORT": {
                "content": "The functions \"wizard\", \"cast\", \"getdata\" and \"dispell\" are only exported on request. All of\nthem are exported by the tags ':funcs' and ':all'.\n\nAll the constants are also only exported on request, either individually or by the tags\n':consts' and ':all'.\n",
                "subsections": []
            },
            "CAVEATS": {
                "content": "In order to hook hash operations with magic, you need at least perl 5.10.0 (see \"VMGUVAR\").\n\nIf you want to store a magic object in the private data slot, you will not be able to recover\nthe magic with \"getdata\", since magic is not copied by assignment. You can work around this\ngotcha by storing a reference to the magic object instead.\n\nIf you define a wizard with *free* magic and cast it on itself, it results in a memory cycle, so\nthis destructor will not be called when the wizard is freed.\n",
                "subsections": []
            },
            "DEPENDENCIES": {
                "content": "perl 5.8.\n\nA C compiler. This module may happen to build with a C++ compiler as well, but don't rely on it,\nas no guarantee is made in this regard.\n\nCarp (core since perl 5), XSLoader (since 5.6.0).\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "perlguts and perlapi for internal information about magic.\n\nperltie and overload for other ways of enhancing objects.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Vincent Pit, \"<perl at profvince.com>\", <http://www.profvince.com>.\n\nYou can contact me by mail or on \"irc.perl.org\" (vincent).\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Please report any bugs or feature requests to \"bug-variable-magic at rt.cpan.org\", or through\nthe web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Variable-Magic>. I will be\nnotified, and then you'll automatically be notified of progress on your bug as I make changes.\n",
                "subsections": []
            },
            "SUPPORT": {
                "content": "You can find documentation for this module with the perldoc command.\n\nperldoc Variable::Magic\n\nCOPYRIGHT & LICENSE\nCopyright 2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Vincent Pit, all rights\nreserved.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}