KevinADC 192 Practically a Posting Shark

did you still need help?

KevinADC 192 Practically a Posting Shark

But since $celToFah has no value it will never equal "true". If there is a radio button in the form you have to import it's value to your script using the param() function just like you did for:

$temp = param('temp');

or you can do this:

if (param('celToFah')) [
   do this
}
else {
   do this other thing
}

you don't really need to checks if value since it can only have one value, you just need to check that it has any value which the above does.

KevinADC 192 Practically a Posting Shark

this line:

if $celToFah eq "true" {

needs parenthesis:

if ($celToFah eq "true") {

KevinADC 192 Practically a Posting Shark

Post code and sample data. On a side note do not use parenthesis in your print statements:

print("$HeaderHash{'Deal Name'}\n");

better written as:
print "$HeaderHash{'Deal Name'}\n";

while this is not the source of your problem, using parenthesis with the print command is in general a bad habit to get into. Se the print documentation for some details:

http://perldoc.perl.org/functions/print.html

KevinADC 192 Practically a Posting Shark

aside from any other problems, this line is wrong:

push my @alpha_carbon, my $alpha_carbon;

You can't declare your variables with "my" during the push() function. You have to predeclare them. Also, $alpha_carbon is not defind, not even initialized, in the code you posted.

I don't understand what you are trying to do here:

and calculate the distance between every two CA atom in a xzy-plane
and if the distance is over 4.3 it should give me the position of the two
CA atoms.

Give an example from the PDB file. Have you searched CPAN for any PDB modules?

KevinADC 192 Practically a Posting Shark

It's a poorly written perl script. You would be better off starting from scratch.

KevinADC 192 Practically a Posting Shark

anyways, why should anyone just correct your code for you even if there is a problem? This is not a code debugging/ script writing service, it's a help forum.

KevinADC 192 Practically a Posting Shark

My impression could be wrong, in which case you are right trudge. Hopefully the OP will clarify.

KevinADC 192 Practically a Posting Shark

Sorry mate, I have little experience with LWP and it's sub classes. I also think I misunderstood your question.

KevinADC 192 Practically a Posting Shark

Few sites just have a login page, they generally use sessions/cookies to track you while on the site. Otherwise you can simply bypass the login screen and go directly to the content pages.

KevinADC 192 Practically a Posting Shark

i thought that the filename is different every iteration of the loop.

Actually, that was the impression I had too. So you might be correct. Maybe the OP will clarify.

KevinADC 192 Practically a Posting Shark

plus this question is cross-posted on another perl forum where it has many replies. The OP obviously has no clue, there is no way the code posted would perform division. The forward slashes are strings not operators.

KevinADC 192 Practically a Posting Shark

search CPAN for RSS modules. I have no specific recommendations.

KevinADC 192 Practically a Posting Shark

first check if the module you are using has a method to find the process by name.

KevinADC 192 Practically a Posting Shark

the poster did not use the code tags so smilies get automatically inserted into the post.

use NET::SMTP;

use NET::SMTP;
KevinADC 192 Practically a Posting Shark

Some reading if you are interested:

http://users.easystreet.com/ovid/cgi_course/lessons/lesson_two.html

You should also be using Taint mode with all CGI scripts.

Ask on www.perlmonks.com why you should not use the form parsing code you posted above and you should get some more opinions. Mine is my own, the opinion of others may vary. Exposure to more opinions may at first be confusing but hopefully it will be educational.

KevinADC 192 Practically a Posting Shark

it's probably those smilies in the code..... I don't think perl handles smilies too well...... ;)

KevinADC 192 Practically a Posting Shark

untested but should work

use CGI;
my $query = CGI->new;
my %form_results = $query->Vars;
my $file_string = join ('|',map {$form_results{$_}} sort keys %form_results);
print $file_string;

read the CI module documentation. I know it is long and some parts are a bit hard to follow, but the part about importing all the params as a list or hash or array is easy to understand.

KevinADC 192 Practically a Posting Shark

This is the terrible code I refer to:

if ( $ENV{'CONTENT_LENGTH'} > 0 )
{
# ~~~~~~~~~~~~~~~~~~~~~~ GETTING FORM INFO FOR $file_string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# get form info from POST method
read(STDIN, $text, $ENV{'CONTENT_LENGTH'});
my @value_pairs = split (/&/,$text);
my %form_results = ();
foreach $pair (@value_pairs) {
($key, $value) = split (/=/,$pair);
$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
$form_results{$key} = $value; # store the key in the results hash
}

You have loaded the CGI module and created a CGI object ($query)

use CGI;

$query = new CGI;

That is what you shoud use to get all the form data, like you do in some parts of the code:

$query->param('bill_to')
KevinADC 192 Practically a Posting Shark

why are you mixing that terrible form parsing code in with CGI anyway? Use the CGI module to get all the form data, don't mix it with that insecure code you are using. Also, when the script reads the data from STDIN:

read(STDIN, $text, $ENV{'CONTENT_LENGTH'});

it empties the buffer, so any subsequent attemptsto read the same data will fail. That may explain your situation, but i did not take a close look at your code.

KevinADC 192 Practically a Posting Shark

Something along these lines should work.

#!/usr/bin/perl

use CGI;
use CGI::Carp qw/fatalsToBrowser/;

my $query = CGI->new;

# Output the HTTP header
print $query->header( );

my $firstname = $query->param("firstname");
my $surname   = $query->param("surname");
my $attend    = $query->param("attend");
my $guests    = $query->param("guests");
my $barbie    = $query->param("barbie");
my $comments  = $query->param("comments");
my $email     = $query->param("email");

my $message = "This is the message if the box is not checked.";
my $thanks  = "Sorry you could not attend."; 
if ($attend) {
   $message = "This is the message if the box is checked.";
   $thanks  = "Thanks for taking the time to fill in the form $firstname.";
}
	
open ( MAIL, "| /usr/lib/sendmail -t" );
print MAIL "From: $email\n";
print MAIL "To: whoever\@mydomain.com\n";
print MAIL "Subject: \n\n";
print MAIL "This data was submitted through mydomain.com\n\n";
print MAIL "$input$ENV{HTTP_USER_AGENT}\n";
print MAIL "$input$ENV{SERVER_NAME}\n";
print MAIL "Received from IPinput$ENV{REMOTE_ADDR}\n\n\n";

print MAIL "firstname\ = $firstname\n";
print MAIL "surname\ = $surname\n";
print MAIL "attend\ = $attend\n";
print MAIL "guests\ = $guests\n";
print MAIL "barbie\ = $barbie\n";
print MAIL "comments\ = $comments\n";
print MAIL "email\ = $email\n\n";

print MAIL "\n.\n";
close ( MAIL );

open ( MAIL, "| /usr/lib/sendmail -t" );
print MAIL "From: someone\@mydomain.com\n";
print MAIL "To: $email\n";
print MAIL "Bcc: someoneelse\@theirdomain.com\n";
print MAIL "Subject: hello\n\n\n";

print MAIL "$message\n\n\n";

print MAIL "\n.\n";
close ( MAIL );

print qq~
<html>
<head>
<style type="text/css">
body {
margin: 0;
padding: 10;
background-color: #000;
background-image: url(../images/cp.gif);
background-repeat: repeat-x y;
}
hr {
width: 100%;
height: 2px;
color: #FFCC00;
}
</style>
</head>
<p align="left">
<img border="0" …
KevinADC 192 Practically a Posting Shark

You are using a module:

use CGI;

all you have to do is check for $attend

if ($attend) {
   the box was checked
   do what you want here
}
else {
   the box was not checked
   do what you want here
}
KevinADC 192 Practically a Posting Shark

It will depend on how your current perl script is coded. Does it use the CGI module?

KevinADC 192 Practically a Posting Shark

As far as I know the answer is yes.

KevinADC 192 Practically a Posting Shark

You can, but IIS has to be setup/configured to run CGI scripts. You can ask how to do that on a IIS forum if you don't already know how. I persoanlly don't know much about IIS so can't help you in that regards.

KevinADC 192 Practically a Posting Shark

You did not say what output it is giving, but judging by your other thread it just displays the perl code. That means your http server is not setup correctly to run scripts. You need to find a tutorial for the specific http server you are using and find out how to configure it to run scripts.

KevinADC 192 Practically a Posting Shark

You will need an http server installed and setup to run CGI scripts on your local PC.

KevinADC 192 Practically a Posting Shark

You are running a CGI script. It is expecting data from a CGI form:

$name = param ('Salesperson');
$sales = param ('Sales');
$rate = param ('Rate');

the above scalars will have no values (they are uninitialized).

Why are you running a CGI script from the command line? That is OK to check for certain errors but CGI scripts are meant to run in a client /server environment (like http). The CGI module can accept arguments from STDIN so you can run and check CGI script from the command line, read the CGI.pm module documentation. Or you can define values for the input:

$name = param ('Salesperson') || 'Tom';
$sales = param ('Sales') || 100;
$rate = param ('Rate') || 5;

that will at least give you something to work with for now.

KevinADC 192 Practically a Posting Shark

replace script.pl with the name of your perl script.

KevinADC 192 Practically a Posting Shark

c:\>perl\bin\perl.exe script.pl

KevinADC 192 Practically a Posting Shark

but the file it is giive in .txt.bak

that is a backup copy of the original file, nothing should be removed from that file. The original file will have the lines removed that start with HETATM.

KevinADC 192 Practically a Posting Shark
#!/usr/bin/perl
{
   local @ARGV = ('path/to/yourfile.txt');
   $^I = '.bak';
   while(<>) {
      print if !/^HETATM/;
   }
}
KevinADC 192 Practically a Posting Shark

You don't want to do this:

$md-1

I explained why in your other thread.


Where is $x getting defined?

KevinADC 192 Practically a Posting Shark

what have you tried?

KevinADC 192 Practically a Posting Shark

Your question is very confusing. I can not understand what date you are trying to convert into another date. But this makes no sense to me: ($md-8)

Why are you subtracting 8 from the day of the month? Then later you add 7 days worth of seconds to the date: $epochtime+604800

All of your adjustments to the date should only be made after converting to epoch seconds, except for the month, you have to subtract one to coincide with the 0-11 format of localtime() before converting to epoch seconds. Then you add or subtract seconds from the epoch time as needed and then convert back into a human readable time format.

KevinADC 192 Practically a Posting Shark

I don't understand what you are asking. Post your perl code.

Are you trying to use the open() function to read a file on another server? That will not work.

KevinADC 192 Practically a Posting Shark

You can certainly use the open() command to read a file, any file, as long as your script has permission to open the file. We will assume it does.

There are perl modules for reading CSV files too:

http://search.cpan.org/~hmbrand/Text-CSV_XS-0.31/CSV_XS.pm

This gets into the "you need to install the module" discussion though. But if you can tackle the installation problem the above module works well.

You may very well be able to use MySQL but you need to ask on the MySQL forum.

KevinADC 192 Practically a Posting Shark

ask this question on www.perlmonks.com where you will get some replies

KevinADC 192 Practically a Posting Shark

No configuration is necessary. But you will need the DBI module and the mysql drivers. Read the activestate help files for informati0n about using PPM to install modules. The install the DBI module and the mysql drivers.

KevinADC 192 Practically a Posting Shark

There are a number of currecny formatting modules on CPAN. The are also conversion modules to convert between currencies. If you are simply wanting to format an existing USA monetary value into a fixed format you can role your own function.

$foo = 1999999.99;
print USA_Format($foo);

sub USA_Format { 
(my $n = shift) =~ s/\G(\d{1,3})(?=(?:\d\d\d)+(?:\.|$))/$1,/g; 
return "\$$n USD"; 
}

I think the above regexp was taken from the Perl FAQs 4 section of the perl documentation.

KevinADC 192 Practically a Posting Shark

ignore

KevinADC 192 Practically a Posting Shark

see other forum where you have this question posted.

KevinADC 192 Practically a Posting Shark

I knew I should have copyrighted that script.

KevinADC 192 Practically a Posting Shark

That is too much code to try and explain what it all does.

KevinADC 192 Practically a Posting Shark

answer posted on the other forum where you posted this same question

KevinADC 192 Practically a Posting Shark

answer postd on other form to this question

KevinADC 192 Practically a Posting Shark

I guess you prefer katharnakh's help so I will stop trying to help you with your questions.

Regards
Kevin

KevinADC 192 Practically a Posting Shark

hi,

in fact, i need that url to be displayed in different interface.
cuz, i'll get many url s as a result. so i want all the url s to be displayed in one interface as hyperlinks. i don't mind if the interface is internet browser.

chandrag

OK, but you have not asked a question. It sounds like you need to use a CGI script (can be written in perl). How are you currently getting the urls?

KevinADC 192 Practically a Posting Shark

hi

i'm getting the below result when i run it.

content-type: text/html

Quarter Dime Nickel<br />QuarterDimeNickel


but why did it print <br /> as it is?

It printed <br /> because you told it to.

The terminal has no concept of what <br /> is like a web browser does. If you want the html code parsed you have to run the perl script from a web browser and http server.

KevinADC 192 Practically a Posting Shark

save the data to a file with an html extension and then up it up in a browser. Or access the url from the internet using a browers.