Loading ...
Sorry, an error occurred while loading the content.

61093Re: Apache::PerlRun - Constant subroutine redefined

Expand Messages
  • David Radunz
    Oct 4, 2004
    • 0 Attachment
      Your quite right about constants in perl - they are a big hack. I could
      have used the internals of constant.pm to determine for sure if
      something was a constant (see: TECHNICAL NOTES documentation of the
      constant man page). However, that doesnt work when using imported
      (Exporter) constants because they arent setup using constant.pm, rather
      pointers set to the reference of the parent package. So this is the only
      way I can think of.

      Thanks for your feedback

      On Tue, 2004-10-05 at 03:29, Perrin Harkins wrote:
      > On Mon, 2004-10-04 at 08:15, David Radunz wrote:
      > > My patch:
      >
      > This looks like a good idea to me. I'd say we should put it in.
      >
      > > For example:
      > >
      > > print STDERR 'time_constant = '. &time_constant(). "\n";
      > > sub time_constant () {
      > > time. ' '. $$;
      > > }
      > >
      > > running under 'httpd -X'
      > >
      > > would produce a different time each request, and the same process id.
      >
      > That's okay, since it would give a different time under CGI as well.
      >
      > My advice in general is that you just shouldn't use constants in Perl.
      > The subroutine thing is kind of a hack, and the confusing problems with
      > stringification are not worth the performance boost. Just use package
      > variables instead. This doesn't work so well for running other people's
      > code though.
      >
      > - Perrin
      --
      David Radunz,
      Developer / Programmer

      Netspace Online Systems Pty Ltd
      Ground Floor, 293 Camberwell Road
      Camberwell, Victoria 3124
      Ph: +613 9811 0087
      Fx: +613 9811 0044
      Mo: +614 0549 9719
      Em: david.radunz@...

      This email and any files transmitted with it are confidential and intended solely for the
      use of the individual or entity to whom they are addressed. Please notify the sender
      immediately by email if you have received this email by mistake and delete this email
      from your system. Please note that any views or opinions presented in this email are solely
      those of the author and do not necessarily represent those of the organisation.
      Finally, the recipient should check this email and any attachments for the presence of
      viruses. The organisation accepts no liability for any damage caused by any virus
      transmitted by this email.


      --
      Report problems: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
    • Show all 16 messages in this topic