in reply to Blessing with unknown classnames
You don't reveal the answer on purpose?
The package/class is created.
you can check by inspecting the %main:: stash, where all packages live
DB<30> bless [1,2,3] => 'nonexistent' DB<31> p $main::{'nonexistent::'} *main::nonexistent:: DB<32>
and I think ° it's not only the typeglob but also the stash %nonexistent:: is created, which will result in several hundreds of bytes of overhead
DB<32> p *{$main::{'nonexistent::'}}{HASH} HASH(0x2e7b830) DB<33>
So better don't try to automatically bless into millions of pseudo packages ...
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
PS: According to some statistics this was my 10000st post here ... frightening.
°) I couldn't find a pure Perl way to check if the HASH slot of a package:: like entry is filled, without autovivifying that package. It's a very quantum-brainf*ck thing, the observation is changing the result.
For clarification: using bless to solve the semipredicate problem is totally fine in my eyes.
Just be aware that the package will exist. And this globally.
So you should care about a naming convention in your own namespace.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Blessing with unknown classnames
by choroba (Cardinal) on Apr 01, 2021 at 23:44 UTC | |
by Discipulus (Canon) on Apr 02, 2021 at 07:45 UTC | |
by LanX (Saint) on Apr 02, 2021 at 08:46 UTC | |
by LanX (Saint) on Apr 03, 2021 at 01:04 UTC | |
by LanX (Saint) on Apr 03, 2021 at 01:46 UTC | |
by LanX (Saint) on Apr 02, 2021 at 00:04 UTC |