Hi, I found and fixed a bug in ParseLex-2.15.  I tried to contact the author, but his email bounces.  Here's what I found:

The module Parse::ALex which is the abstract base class of other concrete classes has a method called "from"

The following code causes strings to be imported into the Parse::ALex module in perl5.005_03:

sub from {
  my $self = shift;
  my $debug = 0;
    # From STREAM
  local *X = $_[0];
  print STDERR "arg: $_[0] ", fileno(X) , "\n" if $debug;
  if (defined(fileno(X))) {
.
.
.

If you call it with $parser->from("hello")

it will create *Parse::ALex::hello = \"hello" and set *Parse::ALex::X to point to that.  The memory for *Parse::ALex::hello is never reclaimed.

If your strings are large, you get both large symbol names, and huge memory usage which is not reclaimed.

I changed my local copy of the file to the following:

sub from {
  my $self = shift;
  my $debug = 0;
    # From STREAM
  if (UNIVERSAL::isa($_[0],'GLOB') || UNIVERSAL::isa(\$_[0],'GLOB') || UNIVERSAL::isa($_[0], 'IO::Handle')) {
.
.
.

Can someone please let me know how to get this bug fix released?

Thank you!

-SCR

Reply via email to