Windows Perl Scripting Forums » Scripts

Memory-Problems with Win32::Perms

(1 post)
  • Started 10 years ago by lennu

Tags:


  1. lennu
    Member

    Hi,

    I encountered a memory problem with Win32::Perms and hope somebody has got a hint for me.

    I've got a file containing a list of thousands of files and directories (one object per line) and wrote a script to take each file/directory and read the permissions.

    Code extract of my first try:


    open(LISTFILE, "< xyz.txt");
    while(my $line = <LISTFILE>) {
      chomp $line;
      next if (!-e $line);
      checkPermissions($line);
    }
    close LISTFILE;

    sub checkPermissions {
      my ($obj) = @_;
      my $Perm = new Win32::Perms($obj);
      #...do something with $Perm...
      $Perm->Close();
    }



    Code extract of my second try:


    my $Perm = new Win32::Perms($0);
    open(LISTFILE, "< xyz.txt");
    while(my $line = <LISTFILE>) {
      chomp $line;
      next if (!-e $line);
      checkPermissions($line);
    }
    close LISTFILE;
    $Perm->Close;

    sub checkPermissions {
      my ($obj) = @_;
      $Perm->Remove(-1);
      $Perm->Import($obj);
      #...do something with $Perm...
      $Perm->Close();
    }



    In both cases the memory usage increases. Is this a memory handle bug in the Perm.dll or am I doing something wrong?

    Regards,
    Lennart Freyberg

    (Perl version: 5.8.7 813, Windows 2k)
    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.