in reply to Re^2: Win32::File::SetAttributes not numeric?
in thread Win32::File::SetAttributes not numeric?

I am currently using the pragmas use strict; use warnings; use diagnostics;

I'd much prefer to keep the use Win32::File;at the top of the package, but apparently my module doesn't like that.

The subroutine contains the following:

my $setROattr = READONLY; my $unsetROattr = ~READONLY; # set file attributes to allow editing Win32::File::SetAttributes($file, $unsetROattr);
.. and the error with use Win32::File; at the top of the package is still...
Argument "READONLY" isn't numeric in subroutine entry
Thanks for the help!

Replies are listed 'Best First'.
Re^4: Win32::File::SetAttributes not numeric?
by ikegami (Patriarch) on Jun 05, 2009 at 19:57 UTC

    I am currently using the pragmas use strict; use warnings; use diagnostics;

    You only think you are. Just like use Win32::File; isn't working, neither is use strict;.

    $ perl -e'use strict; my $attr; $attr |= READONLY' Bareword "READONLY" not allowed while "strict subs" in use at -e line +1. Execution of -e aborted due to compilation errors.

    Without use strict;, READONLY would be considered the same as "READONLY", which is the symptom you described.

      Sorry I should have been more specific. You are right that I encountered that issue, but I am using use strict 'vars'; to avoid this.

      Thanks!
        Turning off strict is akin to turning off error checking. It doesn't make the problem go away. Don't do that.
Re^4: Win32::File::SetAttributes not numeric?
by afoken (Chancellor) on Jun 06, 2009 at 06:38 UTC

    You still don't show us your code. Post the first 10 or 20 lines of your module's source code. If you can't, for some legal reasons, make sure they look like this:

    package Your::Package; use strict; use warnings; use Win32::File;

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Thanks for the help. I didn't have the package statement in the right place. Matching your output helped and everything appears to be working again. It was also enlightening to realize that Win32::File was not working, so thanks to the person who let me know that. Getting away from the problem on my drive home on Friday helped out, as well. Thanks again all!