2008年06月27日

404 Blog Not Found:perl - Const released -- True Readonly

実は、Perl 5.8以降では、Internals::SvREADONLY()という関数がuseなしで使えるようになっていて、Internals::SvREADONLY($scalar, 1)で$scalarをREADONLY flagをonに、Internals::SvREADONLY($scalar, 0)でoffにできます。
知らなかった!
SvREADONLYはwakaponが解説してるよ!

これは universal.c にて実装されていて、使い方は lib/Internals.t を見るべし。
Hash::Utilでも使われてるよ。

danさんの

ただし、これではscalarしかflagをいじれません。というわけで、同様のことをXSでやるようにするモジュールを書いたというわけです。
これは間違いでARRAYもHASHも弄れます。
use strict;
use warnings;
my @values;
Internals::SvREADONLY(@values, 1);
push @values, 1;
これは
Modification of a read-only value attempted at ./ro.pl line 5.
と怒られる。
Internals::SvREADONLY($values[0], 1);
とか局所的にするのも可能。
HASHも同様である。
ちなみにリファレンスの形
Internals::SvREADONLY(¥@values, 1);
では渡せない。

なにが言いたいかというとConstがUNAUTHORIZEDだという事

Posted by Yappo at 2008年06月27日 11:48 | TrackBack | Perl
Comments

Gold in WoW is usually called wow gold, which is as popular as wow power leveling among WoW gamers. Some even strive to find cheapest wow gold with fast delivery online. The same, warhammer gold and warhammer power leveling are hot topic in any game forums. As one of the most popular game, lineage 2 is also well known, running after lineage 2 adena is an interesting thing, too. Since last year, Aion released, we also provide gamers with cheap aion gold, aion account, aion cd key, aion power leveling and aion time card, which are necessities in the game. I believe a seasoned player, you would not be unfamiliar with darkfall online, maybe you are playing it now. If you really playing it, you can get cheapest darkfall gold, darkfall power leveling, darkfall account, darkfall cd key and darkfall time card in an instant from us. More, we are supplying age of conan gold (somebody call it aoc gold by short), lotro gold in Lord of the Ring Online, silkroad gold, the gold name in silk road, maple story mesos, which is the particular gold game in Maple Story, eve isk (the only currency in EVE Online), ffxi gil (also the gold in FFXI), eq2 gold and eq2 plat are the short forms of EverQuest II Platinum as well as rom gold that the gold in Runes of Magic, atlantica gold, gamers are chasing all the time and spellborn gold which mean your status in the game. Just come here now.

Posted by: wow gold at 2009年07月08日 16:14
Post a comment









Remember personal info?






コメントを投稿する前に↓の場所にnospamと入力してください。