| Server IP : 85.214.239.14 / Your IP : 216.73.216.27 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/proc/3/task/3/root/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>;
my $wiz = wizard
fetch => sub { print STDERR "$_[0] FETCH KEY $_[2]\n" },
store => sub { print STDERR "$_[0] STORE KEY $_[2]\n" },
'exists' => sub { print STDERR "$_[0] EXISTS KEY $_[2]\n" },
'delete' => sub { print STDERR "$_[0] DELETE KEY $_[2]\n" };
my %h = (foo => 1, bar => 2);
cast %h, $wiz;
print STDERR "foo was $h{foo}\n";
$h{foo} = 3;
print STDERR "now foo is $h{foo}\n";
print STDERR "foo exists!\n" if exists $h{foo};
my $d = delete $h{foo};
print STDERR "foo deleted, got $d\n";
dispell %h, $wiz;