Re: use CGI qw(:standard);

2004-06-11 Thread Owen Cook

On Fri, 11 Jun 2004, Werner Otto wrote:

> I am making use of use CGI qw(:standard); to create my form. I need to 
> amend the size of a submit button and need to tell the button which script 
> to call (ie. action=test.cgi). Where can I find documentation on all the 
> attributes of the components, or an example for my two queries would be 
> appreciated.


perldoc CGI

look for HOW TO CREATE A SUBMIT BUTTON etc.



Owen 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: how to call installed program

2004-07-18 Thread Owen Cook


On Sun, 18 Jul 2004, Xiangli Zhang wrote:

> In my perl cgi(say sequence.cgi), i want to call an
> installed perl script application (phredPhrap under
> directory /usr/local/bin).
> 
> I use system("phredPhrap"); to call it in my cgi file.
> 
> When I run my cgi file at command terminal
> "phredPhrap" is executed, it works, but at web
> browser, "phredPhrap" was not executed actually.
> 
> How may call phredPhrap? Anybody can give me some
> suggestion?
> 



You may have to give the full path name for phredPhrap

> system("phredPhrap");

eg, system ("/usr/somewhere/bin/phredPhrap");




phredPhrap is probably in you path for the command line, but that's not
appropriate for a cgi script



Owen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Hi, strange problem on calculation

2005-12-07 Thread Owen Cook

On Wed, 7 Dec 2005 [EMAIL PROTECTED] wrote:

> Hi,
> 
> I don't know why the result of my calculation doesn't make sense!
> 
> 
> foreach('0.43','-0.12','-0.08','-0.17','-0.06') {
>$value = $value + ($_);
> }
> print $value . "";
> 
> Value = -2.77555756156289e-17
> Should be 0.00


What is the difference between -2.77555756156289e-17 and 0.00?

It's all to do with the way numbers are represented in computers.

Do a "perldoc -f sprintf" and have a read.


Owen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Storing a search string

2005-12-15 Thread Owen Cook

On Thu, 15 Dec 2005, Thom Hehl wrote:

> I have a screen that is gotten to by a rather elaborate search string. I 
> want to put a button on that page that calls a CGI and passes it 
> location.href, which has all of the parameters I need to get back to 
> that page. The problem is, how do I do that without it mucking up the 
> search string with all of the ? and &s?
> 
> Anyone?


Well perhaps I misunderstand the question, but all those  ?  and  &s are
the way cgi works. If you do not send them the cgi script will have
nothing to parse (or collect) and nothing will be done.

If you are worried about line wrap, then as long as there is no new line
character in the string, it should be ok

Also if you are worried about constructing the string, it may be best to
build it up, like

my $search_string = '?query=';
my $first_query ='car';
my $search_string = "my $search_string$first_query";

and so on


Owen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: What is the reason for different outputs for a cgi script run from a browser and run from the command line?

2006-06-20 Thread Owen Cook



On Tue, 20 Jun 2006, sfantar wrote:

> David Dorward a écrit :
> > On Tue, Jun 20, 2006 at 10:25:33AM +0200, sfantar wrote:
> >> Why are there differences between the output of the CGI mentioned below 
> >> which displays the content of $ENV{HOME} et $ENV{PATH}?
> > 
> > The environment the webserver runs is different to the environment
> > your shell runs.
> > 
> Where can I find how the environment of the webserver is configured 
> concerning perl?
> 
> 

try something like this (untested);

#!/usr/bin/perl

print "Content-type: text/html\n\n";

foreach $key(sort keys(%ENV)) {
 print "$key = $ENV{$key}";

}
-- 



Owen


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to Send Form Output to Multiple Mailing Lists

2007-01-11 Thread Owen Cook
On Thu, Jan 11, 2007 at 03:23:34PM -0500, Akbar Ehsan wrote:
> Hi,
> 
> My knowledge of Perl CGI is very limited. I am trying to modify a form
> that currently send form output to one email address and from there it
> is sent manually via email to different mailing lists. 
> 
> How can I modify the form so that depending on the checkboxes selected,
> the form automatically sends the output to different email addresses or
> mailing lists? 
> 


What is the form?

Where are the relevant pieces of code?

Generally you will have to look through the code to find the "sendmail" part 
and modify that



Owen

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




Re: How to Send Form Output to Multiple Mailing Lists

2007-01-11 Thread Owen Cook
On Thu, Jan 11, 2007 at 04:04:38PM -0500, Akbar Ehsan wrote:

> The form has a bunch of check boxes:
> 
> 
> Anderson
> 
> Bloomington
> 
> 
> Columbus 
> 
> East Chicago
> 
> Elkhart


At this point you need to assign different names to the checkboxes, 
field2,field3 etc 



> The value of the checkbox is part of the out. To this the recipient adds
> @somewhere.com and mails it.



> 
> The relevant CGI code is:
> 
> # got the report in memory, ready to put in email
> # checking who goes to
> 


> 
> # Get the list of fields into an array
> my @locs = split(/,/, $locations);
> my @fields = split(/,/, $in{'field_names'});
> my $mailto = $locs["$in{'field1'}"];
> $mailto .= "[EMAIL PROTECTED]";   

Yes, that prepends the single value submitted to the domain 


Something missing here, or maybe I have been using CGI.pm too long and 
forgotten what how it was 
done in the early years. 

Do you have a statement at the start of your cgi script that says something 
like;

use CGI; or

require cgi-lib.pl; 

> 
> # Email whoever's in $mailto

That's the clue to work backwards from. all your addressess have to be in 
$mailto, but that's a 
scalar

You need an array of collected email addresses, in CGI.pm parlance, thats

@names = $q->param;  but I don't know what library you are using


Then with the array, you can add further addresses to it, and finally, go 
through the array and 
send your e-mails


foreach my $address(@names){ do the send mail routine }


Owen





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




Re: END ing in a cgi script

2007-02-16 Thread Owen Cook
On Fri, Feb 16, 2007 at 08:27:38PM -0800, Mary Anderson wrote:
> 
> Hi all,
>My perl-cgi application creates some temporary files and a temporary 
> table which I would like to clean up as I exit the program.  I tried 
> writing a perl END block, but found that did not work.  It appeared that 
> to the cgi interpreter END{} had no special meaning and the code inside 
> the END block was just executed in turn, instead of at the exit of the 
> program.  Are there techniques to clean up the environment on leaving the 
> application?


Well I just use 'unlink'


Owen

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