how to call an application in cgi and let it run in web browser

2004-07-12 Thread Xiangli Zhang
I want to call an application in cgi file, the
application runs when i run the cgi file at terminal
(which outputs several files), but the application
called  is not executed in the web browser, since no
files are generated.

Can anyone help me this issue?

The following is my code (the last three lines are
called applications not executed under web browser,
but executed under terminal command running).

Thanks a lot,

Justin

#!/usr/bin/perl -w


use strict 'refs';
use Shell;
#use Expect;
use lib '..';
use CGI qw(:standard);
use CGI::Carp qw/fatalsToBrowser/;




#system gedit /var/www/cgi-bin/file2.pl;
print header();
print start_html(File Upload Example);
#print strong(Version ),$CGI::VERSION,p;


print h1(Sequence Generating Page),
br,
'Using Phrep and Phrap',
#strong(Main Page: http://picard.mbb.sfu.ca.;),
br,
'Author:Justin Zhang. Contact: [EMAIL PROTECTED]',
p,
'Select the ',cite('browser'),' button to choose a
chromatographic file
to upload.  When you press the ',cite ('Process
File'),' button, the sequence will be shown below.';

my @types = ('count lines','count words','count
characters');

# Start a multipart form.
print start_multipart_form(),
Enter the file to process:,
filefield('filename','',45),
br,
checkbox_group('count',[EMAIL PROTECTED],[EMAIL PROTECTED]),
p,
reset,submit('submit','Process File'),
endform;

# Process the form if there is a file name entered
if (my $file = param('filename')) {

#phrap $file;
#print $cmd.\n;

my %stats;
my $tmpfile=tmpFileName($file);
my $mimetype = uploadInfo($file)-{'Content-Type'}
|| '';
print hr(),
  h2($file),
  h3($tmpfile),
  h4(MIME Type:,em($mimetype));

my($lines,$words,$characters,@words) = (0,0,0,0);
while ($file) {
$lines++;
$words += @words=split(/\s+/);
$characters += length($_);
}
close $file;
grep($stats{$_}++,param('count'));
if (%stats) {
print strong(Lines: ),$lines,br if $stats{'count
lines'};
print strong(Words: ),$words,br if $stats{'count
words'};
print strong(Characters: ),$characters,br if
$stats{'count characters'};
} else {
print strong(No statistics selected.);
}
}

print hr(),
a({href=http://picard.mbb.sfu.ca},main page),
   

end_html;

system( perl test1.pl);

system(phrap fasta1);

system(vi test.pl);





  





__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




how to call an application in cgi and let it run in web browser

2004-07-12 Thread Xiangli Zhang
Note: forwarded message attached.
		Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.---BeginMessage---
I want to call an application in cgi file, the
application runs when i run the cgi file at terminal
(which outputs several files), but the application
called  is not executed in the web browser, since no
files are generated.

Can anyone help me this issue?

The following is my code (the last three lines are
called applications not executed under web browser,
but executed under terminal command running).

Thanks a lot,

Justin

#!/usr/bin/perl -w


use strict 'refs';
use Shell;
#use Expect;
use lib '..';
use CGI qw(:standard);
use CGI::Carp qw/fatalsToBrowser/;




#system gedit /var/www/cgi-bin/file2.pl;
print header();
print start_html(File Upload Example);
#print strong(Version ),$CGI::VERSION,p;


print h1(Sequence Generating Page),
br,
'Using Phrep and Phrap',
#strong(Main Page: http://picard.mbb.sfu.ca.;),
br,
'Author:Justin Zhang. Contact: [EMAIL PROTECTED]',
p,
'Select the ',cite('browser'),' button to choose a
chromatographic file
to upload.  When you press the ',cite ('Process
File'),' button, the sequence will be shown below.';

my @types = ('count lines','count words','count
characters');

# Start a multipart form.
print start_multipart_form(),
Enter the file to process:,
filefield('filename','',45),
br,
checkbox_group('count',[EMAIL PROTECTED],[EMAIL PROTECTED]),
p,
reset,submit('submit','Process File'),
endform;

# Process the form if there is a file name entered
if (my $file = param('filename')) {

#phrap $file;
#print $cmd.\n;

my %stats;
my $tmpfile=tmpFileName($file);
my $mimetype = uploadInfo($file)-{'Content-Type'}
|| '';
print hr(),
  h2($file),
  h3($tmpfile),
  h4(MIME Type:,em($mimetype));

my($lines,$words,$characters,@words) = (0,0,0,0);
while ($file) {
$lines++;
$words += @words=split(/\s+/);
$characters += length($_);
}
close $file;
grep($stats{$_}++,param('count'));
if (%stats) {
print strong(Lines: ),$lines,br if $stats{'count
lines'};
print strong(Words: ),$words,br if $stats{'count
words'};
print strong(Characters: ),$characters,br if
$stats{'count characters'};
} else {
print strong(No statistics selected.);
}
}

print hr(),
a({href=http://picard.mbb.sfu.ca},main page),
   

end_html;

system( perl test1.pl);

system(phrap fasta1);

system(vi test.pl);





  





__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

---End Message---
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


how to call an application in cgi and let it run in web browser

2004-07-12 Thread Xiangli Zhang
Note: forwarded message attached.




__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail ---BeginMessage---
I want to call an application in cgi file, the
application runs when i run the cgi file at terminal
(which outputs several files), but the application
called  is not executed in the web browser, since no
files are generated.

Can anyone help me this issue?

The following is my code (the last three lines are
called applications not executed under web browser,
but executed under terminal command running).

Thanks a lot,

Justin

#!/usr/bin/perl -w


use strict 'refs';
use Shell;
#use Expect;
use lib '..';
use CGI qw(:standard);
use CGI::Carp qw/fatalsToBrowser/;




#system gedit /var/www/cgi-bin/file2.pl;
print header();
print start_html(File Upload Example);
#print strong(Version ),$CGI::VERSION,p;


print h1(Sequence Generating Page),
br,
'Using Phrep and Phrap',
#strong(Main Page: http://picard.mbb.sfu.ca.;),
br,
'Author:Justin Zhang. Contact: [EMAIL PROTECTED]',
p,
'Select the ',cite('browser'),' button to choose a
chromatographic file
to upload.  When you press the ',cite ('Process
File'),' button, the sequence will be shown below.';

my @types = ('count lines','count words','count
characters');

# Start a multipart form.
print start_multipart_form(),
Enter the file to process:,
filefield('filename','',45),
br,
checkbox_group('count',[EMAIL PROTECTED],[EMAIL PROTECTED]),
p,
reset,submit('submit','Process File'),
endform;

# Process the form if there is a file name entered
if (my $file = param('filename')) {

#phrap $file;
#print $cmd.\n;

my %stats;
my $tmpfile=tmpFileName($file);
my $mimetype = uploadInfo($file)-{'Content-Type'}
|| '';
print hr(),
  h2($file),
  h3($tmpfile),
  h4(MIME Type:,em($mimetype));

my($lines,$words,$characters,@words) = (0,0,0,0);
while ($file) {
$lines++;
$words += @words=split(/\s+/);
$characters += length($_);
}
close $file;
grep($stats{$_}++,param('count'));
if (%stats) {
print strong(Lines: ),$lines,br if $stats{'count
lines'};
print strong(Words: ),$words,br if $stats{'count
words'};
print strong(Characters: ),$characters,br if
$stats{'count characters'};
} else {
print strong(No statistics selected.);
}
}

print hr(),
a({href=http://picard.mbb.sfu.ca},main page),
   

end_html;

system( perl test1.pl);

system(phrap fasta1);

system(vi test.pl);





  





__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

---End Message---
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


Re: how to call an application in cgi and let it run in web browser

2004-07-12 Thread Gunnar Hjalmarsson
Xiangli Zhang wrote:
I want to call an application in cgi file, the application runs
when i run the cgi file at terminal (which outputs several files),
but the application called  is not executed in the web browser,
since no files are generated.
snip
You should test if the commands were successful!
system( perl test1.pl);
This is a better way to run another Perl program:
eval require 'test1.pl' or die Couldn't require test1.pl: $@;
system(phrap fasta1);
system(vi test.pl);
system(phrap fasta1) == 0 or die 'phrap fasta1' failed: $?;
system(vi test.pl) == 0 or die 'vi test.pl' failed: $?;
Please test the above, and let us know if it helped you figure out the
reason why no files are generated when you run the program via CGI.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Mailing Script

2004-07-12 Thread Bill Jones
--- Randal L. Schwartz [EMAIL PROTECTED] wrote:
  Werner == Werner Otto [EMAIL PROTECTED] writes:
 Werner $email   = param(email);

 Do *not* send email to addresses taken from forms.  Ever.


HTML + CGI + E-Mail = VeryBadThing...


Well, at any rate, the best place to see if you are listed is at:

http://groups.google.com/groups?hl=enlr=ie=UTF-8group=news.admin.net-abuse.sightings

Search that group for your domain and/or mail/mta host...


Enjoy!
-Sx-  :)


=
-Sx-
seeking employment: http://youve-reached-the.endoftheinternet.org/




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Mailing Script

2004-07-12 Thread Bill Jones
--- Gunnar Hjalmarsson [EMAIL PROTECTED] wrote:
 one submitted address, the messages are plain text, and the size is
 limited). If some idiot would use it for sending unsolicited messages
 (has never happened so far), I would know and would be able to take
 actions.
 
 The only realistic option is to skip the copy to the sender. But I
 don't want to do that. For the sake of convenience.


Um, your link is to a web server and you can display a web page --
convienent, no?

Why send mail outside your system anyway then?  One web surfer - one
web page.

:)
-Sx-

=
-Sx-
seeking employment: http://youve-reached-the.endoftheinternet.org/



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Mailing Script

2004-07-12 Thread Gunnar Hjalmarsson
Bill Jones wrote:
Gunnar Hjalmarsson wrote:
Gunnar Hjalmarsson wrote:
If you want to contact me privately, you can click the link 
below. If you fill the form, including your own email
address, and submit it, you'll receive a copy of the message.
That's for your record, for your convenience. Personally I
think that makes sense.
snip
Please, Camilo, it's a contact form, intended to serve the same 
purpose as a mailto-link. The risk with it is limited (it accepts
only one submitted address, the messages are plain text, and the
size is limited). If some idiot would use it for sending
unsolicited messages (has never happened so far), I would know
and would be able to take actions.

The only realistic option is to skip the copy to the sender. But
I don't want to do that. For the sake of convenience.
Um, your link is to a web server and you can display a web page -- 
convienent, no?

Why send mail outside your system anyway then?
I explained that in the part of the message you snipped. (Reinstated
above in this message.)
One web surfer - one web page.
Don't understand what you mean by that.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Fwd: Re: how to call an application in cgi and let it run in web browser

2004-07-12 Thread Xiangli Zhang
Dear Gunnar:

Following your instruction, I ran my cgi under
internet browser Mozzilla and at terminal. However, it
output correctly for terminal(it automatically open vi
editor and open the file test.pl), but some error
occurred for browser. The following is my result of
the browser.

Thanks a lot, you are really helpful.


Justin

Sequence Generating Page

Using Phrep and Phrap
Author:Justin Zhang. Contact: [EMAIL PROTECTED]

Select the browser button to choose a chromatographic
file to upload. When you press the Process File
button, the sequence will be shown below.
Enter the file to process:
count linescount wordscount characters

main pagetest.pl [readonly]
6L, 95C#!/usr/bin/perl -w print Content-Type:
text/html\n\n; print this is phrap testing file;
~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~
Vim: Error reading input, exiting...
Vim: Finished. 
Software error:

'vi test.pl' failed: 256 at
/var/www/cgi-bin/jun06_uploadFile.cgi line 78.

For help, please send mail to the webmaster
([EMAIL PROTECTED]), giving this error message and the
time and date of the error. 

Note: forwarded message attached.





__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail ---BeginMessage---
Xiangli Zhang wrote:
I want to call an application in cgi file, the application runs
when i run the cgi file at terminal (which outputs several files),
but the application called  is not executed in the web browser,
since no files are generated.
snip
You should test if the commands were successful!
system( perl test1.pl);
This is a better way to run another Perl program:
eval require 'test1.pl' or die Couldn't require test1.pl: $@;
system(phrap fasta1);
system(vi test.pl);
system(phrap fasta1) == 0 or die 'phrap fasta1' failed: $?;
system(vi test.pl) == 0 or die 'vi test.pl' failed: $?;
Please test the above, and let us know if it helped you figure out the
reason why no files are generated when you run the program via CGI.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response

---End Message---
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


perl.beginners.cgi Weekly list FAQ posting

2004-07-12 Thread casey
NAME
beginners-faq - FAQ for the beginners-cgi mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?
Send mail to [EMAIL PROTECTED]

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

[EMAIL PROTECTED].

  1.2 -  How do I unsubscribe?
Now, why would you want to do that? Send mail to
[EMAIL PROTECTED], and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

[EMAIL PROTECTED]

  1.3 - There is too much traffic on this list. Is there a digest?
Yes. To subscribe to the digest version of this list send an email to:

[EMAIL PROTECTED]

To unsubscribe from the digest, send an email to:

[EMAIL PROTECTED]

  1.4 - Is there an archive on the web?
Yes, there is. It is located at:

http://archive.develooper.com/beginners-cgi%40perl.org/

  1.5 - How can I get this FAQ?
This document will be emailed to the list once a month, and will be
available online in the archives, and at http://beginners.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?
Send an email to [EMAIL PROTECTED] with your suggestion.

  1.7 - Is there a supporting website for this list?
Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who do I complain to?
Complaints can be sent to [EMAIL PROTECTED]

  1.9 - Who currently maintains the FAQ?
Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) in question 1.6

  1.10 - Who will maintain peace and flow on the list?
Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large,
yet padded, clue-sticks to maintain peace and order on the list. If you
are privately emailed by one of these folks for flaming, being
off-topic, etc... please listen to what they say. If you see a message
sent to the list by one of these people saying that a thread is closed,
do not continue to post to the list on that thread! If you do, you will
not only meet face to face with a XQJ-37 nuclear powered pansexual
roto-plooker, but you may also be taken off of the list. These people
simply want to make sure the list stays topical, and above-all, useful
to Perl/CGI beginners.

  1.11 - When was this FAQ last updated?
Feb 04, 2004

2 -  Questions about the 'beginners-cgi' list.
  2.1 - What is the list for?
A list for beginning Perl programmers to ask questions in a friendly
atmosphere. The topic of the list is, of course, CGI with Perl.

  2.2 - What is this list _not_ for?
* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Non Perl/CGI questions or issues
* Lemurs

  2.3 - Are there any rules?
Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun

  2.4 - What topics are allowed on this list?
Basically, if it has to do with Perl/CGI , then it is allowed. If your
question has nothing at all to do with Perl/CGI, it will likely be
ignored.

  2.5 - I want to help, what should I do?
Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?
We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?
Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

perldoc perldoc

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

3 - Other Resources
  3.1 - What other websites may be useful to a beginner ?
* Perl.org - http://www.perl.org
* Perl Home Page - http://www.perl.com
* PerlMonks - http://www.perlmonks.org
* Perldoc - http://www.perldoc.com
* Perl Archives - http://www.perlarchives.com
* NMS Archive - http://nms-cgi.sourceforge.net/
* Unofficial Perl Beginners' Site - http://perl-begin.berlios.de

  3.2 - What resources may be harmful to a beginner?
Beware of Perl4-like code-- You might find some script archives and
unauthorized mirrors with old Perl4 versions of Selena Sol and Matt
Wright scripts. Don't use those scripts. They are outdated and may even
in some cases 

Re: Fwd: Re: how to call an application in cgi and let it run in web browser

2004-07-12 Thread Gunnar Hjalmarsson
Xiangli Zhang wrote:
Gunnar Hjalmarsson wrote:

system( perl test1.pl);
This is a better way to run another Perl program:
eval require 'test1.pl' or die Couldn't require test1.pl: $@;
system(phrap fasta1);
system(vi test.pl);
system(phrap fasta1) == 0 or die 'phrap fasta1' failed: $?;
system(vi test.pl) == 0 or die 'vi test.pl' failed: $?;
Following your instruction,
They were suggestions, not instructions. :)
I ran my cgi under internet browser Mozzilla and at terminal.
However, it output correctly for terminal(it automatically open vi 
editor and open the file test.pl),
Aha, are you trying to open the vi editor? Then I don't think I'm able
to help you; not sure if it's even possible to do that from a CGI script.
main pagetest.pl [readonly] 6L,
95C#!/usr/bin/perl -w print Content-Type: text/html\n\n;
print this is phrap testing file; ~ ~ ~
~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ 
Vim: Error reading input, exiting... Vim:
Finished.  Software error:

'vi test.pl' failed: 256 at /var/www/cgi-bin/jun06_uploadFile.cgi
line 78.
Among all the funny characters, I notice [readonly]. Can it possibly
be that you need to change the permissions for the file to make it
editable by CGI?
But, to be honest, I don't think that's enough. Hopefully somebody
else is willing to jump in and advise.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Fwd: Re: Fwd: Re: how to call an application in cgi and let it run in web browser

2004-07-12 Thread Xiangli Zhang

Gunnar:

If vi editor cannot be called through perl cgi under web browser, what I can do if i want tocall an application in my script. My case is "phrap"- a perl application, which can be used like phrap fasta1 at terminal to generate several text files.

Thanks a lot,

justinNote: forwarded message attached.__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---BeginMessage---
Xiangli Zhang wrote:
Gunnar Hjalmarsson wrote:

system( perl test1.pl);
This is a better way to run another Perl program:
eval require 'test1.pl' or die Couldn't require test1.pl: $@;
system(phrap fasta1);
system(vi test.pl);
system(phrap fasta1) == 0 or die 'phrap fasta1' failed: $?;
system(vi test.pl) == 0 or die 'vi test.pl' failed: $?;
Following your instruction,
They were suggestions, not instructions. :)
I ran my cgi under internet browser Mozzilla and at terminal.
However, it output correctly for terminal(it automatically open vi 
editor and open the file test.pl),
Aha, are you trying to open the vi editor? Then I don't think I'm able
to help you; not sure if it's even possible to do that from a CGI script.
main pagetest.pl [readonly] 6L,
95C#!/usr/bin/perl -w print Content-Type: text/html\n\n;
print this is phrap testing file; ~ ~ ~
~ ~ ~ ~ ~ ~ ~
~ ~ ~ ~ ~ ~ ~ 
Vim: Error reading input, exiting... Vim:
Finished.  Software error:

'vi test.pl' failed: 256 at /var/www/cgi-bin/jun06_uploadFile.cgi
line 78.
Among all the funny characters, I notice [readonly]. Can it possibly
be that you need to change the permissions for the file to make it
editable by CGI?
But, to be honest, I don't think that's enough. Hopefully somebody
else is willing to jump in and advise.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response

---End Message---
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


Re: Fwd: Re: how to call an application in cgi and let it run in web browser

2004-07-12 Thread Wiggins d Anconia
 Xiangli Zhang wrote:

snip

 
 Aha, are you trying to open the vi editor? Then I don't think I'm able
 to help you; not sure if it's even possible to do that from a CGI script.
 
  main pagetest.pl [readonly] 6L,
  95C#!/usr/bin/perl -w print Content-Type: text/html\n\n;
  print this is phrap testing file; ~ ~ ~
  ~ ~ ~ ~ ~ ~ ~
  ~ ~ ~ ~ ~ ~ ~ 
  Vim: Error reading input, exiting... Vim:
  Finished.  Software error:
  
  'vi test.pl' failed: 256 at /var/www/cgi-bin/jun06_uploadFile.cgi
  line 78.
 
 Among all the funny characters, I notice [readonly]. Can it possibly
 be that you need to change the permissions for the file to make it
 editable by CGI?
 
 But, to be honest, I don't think that's enough. Hopefully somebody
 else is willing to jump in and advise.


'vi' is a terminal based application, which is generally expecting to do
I/O on a terminal, or in a console/x window (in the case of gvim). 
Presumably you could manage a vi session with something like expect or
something, but that sounds like a nightmare.  Since 'vi' is just a file
editing app, and you are running over a stateless CGI session the normal
method would be to load a page with a form, drop the contents of the
file into a textarea and have that form submit back to a script that
stores the file.  Granted, then you can't use all the shortcuts and key
combos of Vi, but then you are doing this over a stateless connection
which has its benefits.  

What are you really trying to do...

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




PERL CGI on IIS

2004-07-12 Thread Mike Garner
I've written a PERL cgi script that I'd like to use to reset a user's
password within Microsoft's Active Directory.  The script runs well from the
command line of the web server and from any other windows box (with PERL
installed). However, when it is executed from IIS, the security of IIS
prevents it from completing one of the methods of the Win32::OLE module so
the script fails. Posing this question to general IIS/Windows support groups
returns the result of Ask the PERL folks. I'm hoping someone within this
forum can help (though I believe the problem to be IIS security related,
maybe someone here has experienced this themselves).

 

My script:

use strict;

use CGI ':standard';

use Win32::OLE;

use URI;

 

# snip -retrieve values from form, etc

 

###--Create LDAP Connection to Active Directory

my $adsinamespaces = CreateObject Win32::OLE 'ADsNameSpaces'||print qq(Nope,
step 1);

my $ldapnamespace= $adsinamespaces-getobject(,LDAP:)||print qq(nope,
step2);

my
$userdsobject=$ldapnamespace-OpenDSObject(LDAP://winad1.wsc.western.edu/OU
=Users,dc=wsc,dc=western,dc=edu,cn=$user,ou=$ou,OU=Users,dc=wsc,dc=western
,dc=edu,$old_password,1)||print qq(nope, step 3);

 

###--Bind to specific user account

my $ADsPath=LDAP://CN=$user,OU=$ou,OU=Users,DC=WSC,DC=western,DC=edu;||
print qq (nope, step 4);

 

##the next line always fails via CGI

my $u = Win32::OLE-GetObject($ADsPath)||print qq(nope, get object failed);

$u-SetPassword($new_password);

$u-SetInfo();

 

The script always fails on the GetObject method line when it is executed via
CGI. What is that command doing that IIS doesn't appreciate?

 

Any suggestions?

 

Thanks,

Mike



Art Gallery Perl Script.

2004-07-12 Thread Joe Echavarria
Hi there, 

  I am looking for an Art Gallery Perl script where i
can put the frame painting, a description of the art,
some text..., something like that. where can i find it
?, i won't reinvent the wheel... Free or paying..,
prefer free..

Thanks.

Joe.



__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response