tie Questions
3
Solved
I was trying to tie an hash (or hashref) in order of tracking variable usages.
Everything is working for simple cases, but when I tried to use my module on some real code I had this error:
hash- ...
1
I want to see every place when variable in perl script is created/accessed/destroyed
It is easily reachable using tie or Variable::Magic
But how to apply this magic automatically when variable is...
2
Solved
I want to do something like the following:
//std::vector<std::pair<TypeA, TypeB>> someInitializingFunction();
{
TypeA a;
TypeB b;
for (std::tie(a, b) : someInitializingFunction()) ...
Telekinesis asked 23/1, 2014 at 5:50
1
I noticed that with variables declared with the Readonly module, evaluating a variable multiple times can yield different results.
>perl -Mbigint -MReadonly -wE "Readonly my $V => 1; foreach...
Immediacy asked 17/1, 2014 at 12:5
1
Solved
2
Solved
Similar to the way AUTOLOAD can be used to define subroutines on demand, I am wondering if there is a way to tie a package's stash so that I can intercept access to variables in that package.
I've...
Heritage asked 27/4, 2011 at 20:2
2
Solved
I have this little perl script that is supposed to sort a file:
#!/usr/bin/perl
use strict;
use warnings;
use Tie::File;
tie my @lines, 'Tie::File', 'fileToBeSorted.txt' or die $!;
printf "line...
1
Solved
I am working on a project which deals with data in foreign languages. My Perl scripts were running fine.
I then wanted to use Tie::File, since this is a neat concept (and saves time and coding). ...
4
Solved
I have the following table structure for a table Player
Table Player {
Long playerID;
Long points;
Long rank;
}
Assuming that the playerID and the points have valid values, can I update the...
5
Solved
Here's a scenario. You have a large amount of legacy scripts, all using a common library. Said scripts use the 'print' statement for diagnostic output. No changes are allowed to the scripts - they ...
4
Solved
Given a hash in Perl (any hash), how can I extract the values from that hash, in the order which they were added and put them in an array?
Example:
my %given = ( foo => '10', bar => '20', b...
5
Solved
I often find it useful to be able to schedule code to be executed upon leaving the current scope. In my previous life in TCL, a friend created a function we called defer.
It enabled code like:
se...
2
Solved
I've just started to learn about tie. I have a class named Link which I would like to do the following thing:
if fetched, return the link's address
if stored, store the new address
be able to cal...
1
© 2022 - 2024 — McMap. All rights reserved.