Questions tagged [perl-stash]

In Perl, the stash is another name for the symbol table.

In Perl, the stash is another name for the symbol table. Manipulating them can occasionally be necessary. Packages exist to make that task easier.

4 questions
9
votes
4 answers

In Perl, is there any difference between direct glob aliasing and aliasing via the stash?

In Perl, is there ever any difference between the following two constructs: *main::foo = *main::bar and $main::{foo} = $main::{bar} They appear to have the same function (aliasing all of the slots in *main::foo to those defined in *main::bar), but…
Eric Strom
  • 39,821
  • 2
  • 80
  • 152
8
votes
2 answers

In Perl, is there any way to tie a stash?

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 tried various permutations of the following idea,…
Eric Strom
  • 39,821
  • 2
  • 80
  • 152
6
votes
1 answer

How do I alias a long package name without affecting the main package?

If I have a really long package name, I can alias that package by making an entry in the symbol table: BEGIN { # Make "Alias" be an alias for "Some::Really::Long::Package"; *Alias:: = \*Some::Really::Long::Package::; # Equivalent to: …
Chris
  • 1,657
  • 1
  • 13
  • 20
3
votes
0 answers

Mojolicious templates accessing stash values set by a Controller

I'm fairly new to Mojolicious. I've tried researching this in docs, StackOverflow, and online examples. I haven't found an adequate answer, yet. Hopefully someone can help me. I have a Controller method/action that is supposed to display a User's…
Armitige3
  • 51
  • 7