eAuction
  Not just another Perl script
Google
Welcome, Guest. Please Login or Register


If you use eAuction a lot and like it or if you make money from eAuction or from eAuction-related activities ...
then the project asks you for a donation in favor of the further development.



The forums are protected by
AccessControl
(written by Dieter Werner)
Click here if you want to check your IP against the most important RBLs of the net.
Click here in order to visite the AccessControl forums.


<< Visit the international e Auction Marketplace >>
Buy and sell PC and Consumer Electronic components






  HomeHelpSearchLoginRegister
 



Pages: 1 2 3 
readdir: file order (Read 1389 times)
Wotan
eAuction Novice
*
Offline



Posts: 4
Novosibirsk, Russia
Gender: male
readdir: file order
02/10/05 at 19:21:07
 
Hello,

today I moved my client's eAuction based web-site on a new hosting server (Fedora linux, perl 5.8.3). After this I got an error. Let me skip all the investigations I did, and show only the result.

The folder /cgi-bin/auctiondata/antiques1 has 3 files:
1110645496.dat, 1110645545.dat, 1110645936.dat.

I run a very simple script:
opendir THEDIR, "$config{'basepath'}$form{'category'}" or &oops("Category directory $form{'category'} could not be opened.");

my @test = readdir THEDIR;
my $file;
foreach $file (@test) {
 print '<br>:';
 print $file;
}

And the result is:
:..
:test
:1110645936.dat
:1110645545.dat
:.
:1110645496.dat

Please note that . and .. are not the very first entries. Consequently, the auction script fails when it tries to open the . file and read from it.

I found ~250 readdir in all the files, and wouldn't like to fix it manually. Any suggestions?

Thanks a lot,
Max
Back to top
 
 


Advertising
View Profile   IP Logged
Dieter Werner
Administrator
*****
Offline

Dipl. Paranoiac ®

Posts: 1161
Germany
Gender: male
Re: readdir: file order
Reply #1 - 02/11/05 at 11:28:20
 
Run this:
Code:
opendir THEDIR, "$config{'basepath'}$form{'category'}"
or die("Category directory $form{'category'} could not be opened.");

my @test = grep /\.dat$/, readdir THEDIR;
my $file;
foreach $file (@test) {
       print '<br>File: ';
       print $file;
}  



or this:
Code:
opendir THEDIR, "$config{'basepath'}$form{'category'}"
or die("Category directory $form{'category'} could not be opened.");

readdir THEDIR for 0 .. 1;
my @test = readdir THEDIR;
my $file;
foreach $file (@test) {
       print '<br>File: ';
       print $file;
}  



and let me know the result.

Back to top
 
 

Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Greetings from Germany
Dieter Werner




Advertising
View Profile | WWW   IP Logged
Wotan
eAuction Novice
*
Offline



Posts: 4
Novosibirsk, Russia
Gender: male
Re: readdir: file order
Reply #2 - 02/17/05 at 14:34:00
 
The first script produces the following (correct) result:
Code:
File: 1110645936.dat
File: 1110645545.dat
File: 1110645496.dat




The second doesn't work correctly:
Code:
File: 1110645545.dat
File: .
File: 1110645496.dat



Back to top
 
 


Advertising
View Profile   IP Logged
Pages: 1 2 3 


If you like eAuction, please Rate it.
If you don't like eAuction, please Rate it too.


1 is being poor and 10 is being excellent


EveryScript

ip-location


AccessControl - Members Only