title: How do I export Readonly variables with mod_perl?
body: <p>I'm trying to make it easier to follow some <a href="http://oreilly.com/catalog/9780596001735/" rel="nofollow noreferrer">Perl Best Practices</a> by creating a <code>Constants</code> module that exports several of the scalars used throughout the book.  One in particular, <code>$EMPTY_STRING</code>, I can use in just about every Perl script I write.  What I'd like is to automatically export these scalars so I can use them without defining them explicitly in each script.</p>
  
  <pre><code>#!perl
  package Example::Constants;
  
  use Exporter qw( import );
  use Readonly;
  
  Readonly my $EMPTY_STRING =&gt; q{};
  our @EXPORT = qw( $EMPTY_STRING );
  </code></pre>
  
  <p>An example usage:</p>
  
  <pre><code>#!perl
  use Example::Constants;
  print $EMPTY_STRING . 'foo' . $EMPTY_STRING;
  </code></pre>
  
  <p>Using the above code produces an error:</p>
  
  <pre><code>Global symbol "$EMPTY_STRING" requires explicit package name
  </code></pre>
  
  <p>If I change the <code>Readonly</code> declaration to:</p>
  
  <pre><code>Readonly our $EMPTY_STRING =&gt; q{}; # 'our' instead of 'my'
  </code></pre>
  
  <p>The error becomes:</p>
  
  <pre><code>Attempt to reassign a readonly scalar
  </code></pre>
  
  <p>Is this just not possible with mod_perl?</p>