Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > REQUEST: Problem with Perl (Win32) on Windows98SE and reading files

Reply
Thread Tools

REQUEST: Problem with Perl (Win32) on Windows98SE and reading files

 
 
Jeff
Guest
Posts: n/a
 
      12-12-2003
Hi all

I don't usually follow these groups so replies to my email
(jeffcrow(AT)tpg.com.au) would be preferred in addition to posts to the
group. Thanks.

I am having problems reading a file from a perl script running under
windows98se. This seems to be a recent problem as I've had several scripts
in the past work fine. The general flow of data is;

Data in a spreadsheet in OpenOffice.org 1.1 is output as text file to a dir.
A perl script is kicked off to read all files in the dir and process the
data for output as webpages. I was trying to read files in a dir in a
scalar context but when I was having problems I changed to an array context.
A snip of code is now;

opendir(OUTDOOR, "${autodir}") || die "Can't open the dir ${autodir}";
@files = readdir(OUTDOOR);
closedir(OUTDOOR);
foreach $file (@files) {
TEST READABLE
IF !READABLE
CHANGE MODE TO READABLE OR DIE WITH ERROR MESSAGE
}

What I get as output is 'File is not readable and permissions can't be
changed'. I have checked the directories in the path (\auto\process0) to
ensure they are visible and readable. I have checked the files in the dir
are visible and readable. I have opened the files in a text editor and they
are readable and plain text. I have opened a console/MS-DOS Prompt window
and opened the file with "edit test.out" and viewed the contents fine.

I wrote a perl script that creates some file in the directory and puts some
text into the file. I then close the file, sleep for 30 seconds and then
readdir(directory) and again the files are reported as NOT readable and
permissions can't be changed. Again, the file I output is fine and readable
in consoles, editors etc.

I deleted the version of perl I was using (Activestate 5.?? I can't recall)
cleaned the REGISTRY and installed a GNU perl 5.004_02 and still the same
problem.

Short of running this under LINUX as I would ordinarily do, can any win32
Perl guru offer any assistance?

Thanks in advance for any and all for assistance provided.
Jeff


 
Reply With Quote
 
 
 
 
Jay Tilton
Guest
Posts: n/a
 
      12-13-2003
"Jeff" <jeffcrow(AT)tpg.com.au> wrote:

: opendir(OUTDOOR, "${autodir}") || die "Can't open the dir ${autodir}";
: @files = readdir(OUTDOOR);
: closedir(OUTDOOR);
: foreach $file (@files) {
: TEST READABLE
: IF !READABLE
: CHANGE MODE TO READABLE OR DIE WITH ERROR MESSAGE
: }
:
: What I get as output is 'File is not readable and permissions can't be
: changed'.

Murphy is telling me the problem is somewhere in those paraphrased lines.
It's impossible to diagnose boguscode accurately.

You've probably made a mistake using the return from readdir()--a mistake
so common that half of the documentation for readdir() is there to ensure
you don't make it.

[...]
If you're planning to filetest the return values out of a
"readdir", you'd better prepend the directory in question.
Otherwise, because we didn't "chdir" there, it would have
been testing the wrong file.

 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      12-13-2003
Jeff <jeffcrowtpg.com.au> wrote:

> @files = readdir(OUTDOOR);


> TEST READABLE


> Thanks in advance for any and all for assistance provided.



You should read the documentation for the functions that you use.


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
David Jackson
Guest
Posts: n/a
 
      12-14-2003
(E-Mail Removed) (Tad McClellan) wrote in message news:<(E-Mail Removed)>.. .
> Jeff <jeffcrowtpg.com.au> wrote:
>
> > @files = readdir(OUTDOOR);

>
> > TEST READABLE

>
> > Thanks in advance for any and all for assistance provided.

>
>
> You should read the documentation for the functions that you use.


Tad --

There's only been one "perfect" person I know of and we "nailed him to
a cross"....

Jeff --
You might for check/post http://perlmonks.com, maybe they'll remember
a time when they didn't not readying every man page for every function
for every program they wrote.

Sorry I cann't be of more help.

DJJ
 
Reply With Quote
 
Matt Garrish
Guest
Posts: n/a
 
      12-14-2003

"Jeff" <jeffcrow(AT)tpg.com.au> wrote in message
news:3fda88a4$(E-Mail Removed)...
>
> opendir(OUTDOOR, "${autodir}") || die "Can't open the dir ${autodir}";
> @files = readdir(OUTDOOR);
> closedir(OUTDOOR);
> foreach $file (@files) {
> TEST READABLE
> IF !READABLE
> CHANGE MODE TO READABLE OR DIE WITH ERROR MESSAGE
> }
>


It would help if you hadn't left out the most important part of the code. My
guess is that you're either trying to change the permissions on '.' and
'..', or your running the script in a different directory from the files and
not prepending the full path. But unless you'd care to share the rest of
your code, there's not much anyone can do for you.

Matt


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      12-14-2003
David Jackson <(E-Mail Removed)> wrote:
> (E-Mail Removed) (Tad McClellan) wrote in message news:<(E-Mail Removed)>.. .
>> Jeff <jeffcrowtpg.com.au> wrote:
>>
>> > @files = readdir(OUTDOOR);

>>
>> > TEST READABLE

>>
>> > Thanks in advance for any and all for assistance provided.

>>
>>
>> You should read the documentation for the functions that you use.

^^^^^^^^^^^^
^^^^^^^^^^^^

> You might for check/post http://perlmonks.com, maybe they'll remember
> a time when they didn't not readying every man page for every function
> for every program they wrote.



We don't expect that here either. You're making **** up.


> Sorry I cann't be of more help.



If he reads the documentation for the function that he is using
then he will have the solution to his problem.

I helped him, you did not help him.


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
Connecting Windows98SE Desktop to XP Laptop for printing/file shar =?Utf-8?B?TWFyYyAgRC4=?= Wireless Networking 3 06-17-2006 09:55 PM
Windows98se startup menu J & C Houghton Computer Support 8 11-24-2004 04:22 AM
pywin32 201.1 Windows98SE Problem? Bob Chapman Python 4 05-30-2004 05:14 AM
Upgrade from Windows98 to Windows98SE ? Steve Computer Information 5 12-31-2003 08:42 PM



Advertisments