perl interpreter seems not to work properly opening files

Status
Not open for further replies.

xtrain

New Member
Messages
8
Reaction score
0
Points
0
Since July 8th I'm experiencing a strange behavior in perl interpreter: it seems that it cannot open a file, but no error is shown.
I don't know if these days issues can produce this kind of problem. I am on starka and I can easily access cpanel, my db an so on.
This is the part of the code, perfectly working before that date:
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
$file=$ARGV[0];
open(FILE, "<$file") || die "*Error [0.0]* Opening the file $file\n\n";
while ($new_row = <FILE>) {
#Print the file
print "$new_row";
}#endWhile
close(FILE);

Is there anybody who knows the reason of that?
Thank you.

Bye,
Alex
 

bhupendra2895

New Member
Messages
554
Reaction score
20
Points
0
Hi, Check the permission of file to open is set to 755 or not.
Well you are saying that this don't show any error.So the reason could be others and moderators can tell about it.
 

xtrain

New Member
Messages
8
Reaction score
0
Points
0
Hi, Check the permission of file to open is set to 755 or not.
Well you are saying that this don't show any error.So the reason could be others and moderators can tell about it.

hi bhupendra,

Thank you for your reply.
Permission is already set to 755.
If I put a print instruuction just before the open command, I can read the result of this print, so the file is executed.

It seems the perl code is reading the file I pass it (otherwise my print error command would be shown), but no file contents are printed...mmmmmh!

Alex
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
hi bhupendra,

Thank you for your reply.
Permission is already set to 755.
If I put a print instruuction just before the open command, I can read the result of this print, so the file is executed.

It seems the perl code is reading the file I pass it (otherwise my print error command would be shown), but no file contents are printed...mmmmmh!

Alex

Sounds like your code is bad..

Try doing:

Code:
print('Start.');
#your code here
print('End');


And see if both are printed.. If they are, it's most likely a problem with your code.

And don't forget your shebang in the code I posted.
 

xtrain

New Member
Messages
8
Reaction score
0
Points
0
My cpanel has started to behave in a bad way (loading error, no pages found, etc.), so the problem was not in my code.
I think I only have to wait for.

Bye,
Alex
 
Status
Not open for further replies.
Top