转储 mod_perlified 变量——本地命名空间是什么?

发布于 2024-08-24 12:50:14 字数 623 浏览 1 评论 0原文

我有一个 mod_perl 脚本:

use strict;
use warnings FATAL => 'all';
use 5.010001;

my $face = 'ugly';

use Data::Dump qq(pp);
die pp($ModPerl::ROOT::ModPerl::Registry::C_3a_www_test_2epl::face);

它在 C:/www/test.pl 第 8 行处 undef 死亡。

我原以为在 C:/www/test.pl 第 8 行处 “丑陋”。< /code>

如果我

die pp(%ModPerl::ROOT::ModPerl::Registry::C_3a_www_test_2epl::);

......重新启动服务以清除所有缓存的变量后,face 甚至不会列出。

我可以发誓这段代码在我上次使用它时是有效的...我围绕这种命名局部变量的方式编写了一个完整的 die 钩子,以便我可以获取某些局部变量来转储调试信息。

什么是本地命名空间?

I have a mod_perl script:

use strict;
use warnings FATAL => 'all';
use 5.010001;

my $face = 'ugly';

use Data::Dump qq(pp);
die pp($ModPerl::ROOT::ModPerl::Registry::C_3a_www_test_2epl::face);

It dies undef at C:/www/test.pl line 8.

I was expecting "ugly" at C:/www/test.pl line 8.

If instead I

die pp(%ModPerl::ROOT::ModPerl::Registry::C_3a_www_test_2epl::);

...after restarting the service to clear any cached variables, face is not even listed.

I could have sworn this code was working the last time I used it...I wrote a whole die hook around this way of naming local variables so that I could get at certain local variables to dump debug information.

What's the local namespace?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫腻 2024-08-31 12:50:14

只有使用 our 共享的变量才能通过这种方式访问​​。

Only variables shared using our are accessible this way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文