| Server IP : 89.117.53.150 / Your IP : 216.73.216.11 Web Server : Apache System : Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64 User : iscmbt-kufa-atu ( 1014) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/libvariable-magic-perl/examples/ |
Upload File : |
#!/usr/bin/perl
use strict;
use warnings;
use lib qw<blib/arch blib/lib>;
use Variable::Magic qw<wizard cast dispell>;
sub foo { print STDERR "got ${$_[0]}!\n" }
my $bar = sub { ++${$_[0]}; print STDERR "now set to ${$_[0]}!\n"; };
my $a = 1;
{
my $wiz = wizard get => \&foo,
set => $bar,
free => sub { print STDERR "deleted!\n"; };
cast $a, $wiz, qw<a b c>;
++$a; # "got 1!", "now set to 3!"
dispell $a, $wiz;
cast $a, $wiz;
my $b = 123;
cast $b, $wiz;
} # "deleted!"
my $b = $a; # "got 3!"
$a = 3; # "now set to 4!"
$b = 3; # (nothing)