Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > Re: Example Inp...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 1376 of 1496
Post > Topic >>

Re: Example Input Datas

by pangj@[EMAIL PROTECTED] (Jeff Pang) Mar 8, 2007 at 08:13 PM

print FILE,$_;

Here comma is not needed.
change to:

print FILE $_;

Also I'd suggest you always add the "use strict" at the begin of your cgi
s=
cripts.

-----Original Message-----
>From: Rodrigo Tavares <digolinopage@[EMAIL PROTECTED]
>
>Sent: Mar 8, 2007 8:04 PM
>To: beginners-cgi@[EMAIL PROTECTED]
>Subject: Re: Example Input Datas
>
>Hello Jeff,
>
>Well, thanks your help.=20
>More one thing.
>When I try to run the cgi in browser come this message
>=20
>
>Software error:
>
>No comma allowed after filehandle at
>/home/faria/public_html/cgi-bin/perl/entrada-dados.cgi
>line 19.
>
>See my below code.
>
>print header;
>print start_html("Modify Information");
>open FILE,"/opt/croc/postgresql.conf" or die $!;
>my @[EMAIL PROTECTED]
 =3D <FILE>;
>close FILE;
>
>open FILE,">","/opt/croc/postgresql.conf" or die $!;
>for (@[EMAIL PROTECTED]
)
>  {
>     #system("perl -pi -e 's/192.168.1.1/10.0.0.1/g'
>/opt/crocodilo/postgresql.conf");
>     s/192.168.1.85/10.0.0.1/g
>     print FILE,$_;
>  }
>close FILE;
>print end_html;
>
>What's wrong ?
>
>Best regards,
>
>Rodrigo Faria
>
>>
>>>I'm beginner in Perl with CGI.
>>>I create a two input box;
>>>
>>>In the first input box, I'll put the ip adress.
>>>In the second input box I'll put the ****t
>>>
>>>Then when i click em submit, the cgi must make:
>>>
>>>perl -pi -e 's/192.168.1.1/10.0.0.1/g' /opt/myfile
>>>
>>>How I can to do it ?
>>>
>>
>> At first you need to ensure that your cgi script has
>the privileges to
>> write/modify the file "/opt/myfile".
>> Then you may call:
>> system "perl -pi -e ..."
>> to do the things you wanted in the cgi script.
>>
>> But I think the good way is something like:
>>
>> # copy the old content in that file to an array
>> open FILE,"/opt/myfile" or die $!;
>> my @[EMAIL PROTECTED]
 =3D <FILE>;
>> close FILE;
>>
>> # re-write the new content to the file
>> open FILE,">","/opt/myfile" or die $!;
>> for (@[EMAIL PROTECTED]
) {
>>    s/192.168.1.1/10.0.0.1/g;
>>    print FILE,$_;
>> }
>> close FILE;
>>
>>
>> Is it?
>> Hope this helps.
>
>__________________________________________________
>Fale com seus amigos  de gra=C3=A7a com o novo Yahoo! Messenger=20
>http://br.messenger.yahoo.com/=20
>
>--=20
>To unsubscribe, e-mail: beginners-cgi-unsubscribe@[EMAIL PROTECTED]
>For additional commands, e-mail: beginners-cgi-help@[EMAIL PROTECTED]
>http://learn.perl.org/
>
>
 




 2 Posts in Topic:
Re: Example Input Datas
pangj@[EMAIL PROTECTED]   2007-03-08 20:13:41 
Re: Example Input Datas
digolinopage@[EMAIL PROTE  2007-03-08 09:53:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 11:29:46 CST 2008.