Re: Nasty

2001-07-13 Thread David Labatte

heheheh now that all depends.  If I run:

 perl -e'package hell; print *holes;'

Then I get as output:

*hell::holes

Which actually more closely describes where programmers usually find
employment, not the programmers that are employed there.  Common
mistake that.  use strict and -w from now on and it will help you to not
make these kinds of mistakes in the future. :)


Camilo Gonzalez wrote:

 I don't work with a lot of programmers. I hope to get into a situation where
 I do. Is it fair to say the majority are *holes?

 --

--
Perl, because 600 billion oysters can't be wrong
   Canadian Consulting Services' pet perl hacker
   David Labatte [EMAIL PROTECTED]





Re: Problem with my code

2001-06-27 Thread David Labatte

First you should always use strict. It'll help catch things like your misspeling
of jonh.  The request you are sending is for a POST, which means that the
form data has to be passed in the body of the request, which you forgot to do.

So just add:

$req-content($john);

Correct the spelling mistake, use strict, my all your variables,  and it should
work fine.. except that your query isn't understood by their cgi.

I used this query for testing:

my $john =
qq|order=symbolinclude=selected*limit=500_Species_key=1op%3Asymname=beginssymname=symnameBreadth=CWSop%3Achromosome=%3Dchromosome=op%3AcytogeneticOffset=beginscytogeneticOffset=op%3A_primary=begins_primary=refid=id=cmp_Species_key=op%3Acmp_chromosome=%3Dcmp_chromosome=op%3Acmp_cytogeneticOffset=beginscmp_cytogeneticOffset=|;

p.s. interesting project :)


--
my edited  version:

use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent-new;
my $req = HTTP::Request-new(POST =
'http://www.informatics.jax.org/searches/homology_report.cgi');
$req-content_type(application/x-www-form-urlencoded);
my $john =
qq|order=symbolinclude=selected*limit=500_Species_key=1op%3Asymname=beginssymname=symnameBreadth=CWSop%3Achromosome=%3Dchromosome=op%3AcytogeneticOffset=beginscytogeneticOffset=op%3A_primary=begins_primary=refid=id=cmp_Species_key=op%3Acmp_chromosome=%3Dcmp_chromosome=op%3Acmp_cytogeneticOffset=beginscmp_cytogeneticOffset=|;

$req-content($john);
# print $req-as_string();
my $res = $ua-request($req);
print $res-code,'\n';
print $res-content();



Greg Touchton wrote:

 I can't get any response from the location I am trying to contact. I can reach
 an external location like www.yahoo.com without any problem. When I use my web
 browser I have no problem receiving a response from the CGI even if I give bad
 information to the POST. I know I am not using a proxy. Please pardon my email
 program for the wordwrap...

 use LWP::UserAgent;
 $ua = LWP::UserAgent-new;
 my $req = HTTP::Request-new(POST =
 'http://www.informatics.jax.org/searches/homology_report.cgi');
 $req-content_type(application/x-www-form-urlencoded);
 $john =
 qw(order=symbolinclude=*limit=0_Species_key=op:symname=begins);
 $john .= qw(symname=abl1);
 $jonh.=qw(symnameBreadth=CWScmp_Species_key=);
 my $res = $ua-request($req);
 print $res-code,'\n';

 Thank you,

 Greg Touchton\\   /=|
 540-552-5967  \\ //  =|
 338 Shenandoah Cir \//   =|

--
Perl, because 600 billion oysters can't be wrong
   Canadian Consulting Services' pet perl hacker
   David Labatte [EMAIL PROTECTED]





Re: INSERTing problems

2001-06-07 Thread David Labatte

It's been some time since I've done any access programming but the error
your getting is consistent with using a reserved world for a table or field
name.

According to the below reference from Microsoft's site the world 'Full' is
a indeed a reserved word in access and could be the cause of your
problem.  If so then your going to have to rename that table.

http://support.microsoft.com/support/kb/articles/Q209/1/87.asp


If that's not it I'm stumped since everything else your doing looks good.


SAWMaster wrote:

 snip of actual code and excellently detailed info on problem


--
Perl, because 600 billion oysters can't be wrong
   Canadian Consulting Services' pet perl hacker
   David Labatte [EMAIL PROTECTED]






Re: testing null strings for form field values

2001-06-04 Thread David Labatte

Randal is of course right.  I apologize for my extremely confusing
and idiom riddled post.

Randal L. Schwartz wrote:

  David == David Labatte [EMAIL PROTECTED] writes:

 David The why though is most likely that: undef ne ''

 That's not true.  undef eq ''.


Sorry I meant that statement in the english phrase sense not in the
literal perl sense.  I'll translate it from garbledslash.psudogeekese and
never use that particularly poor and confusing dialect here again:

undef is undef, '' is ''.  Occasionally perl will care.  Best to treat them
differently until your comfortable with their differences.

Not even close to what I actually said, but it's what I meant. I guess
I was expecting the reader to somehow divine my actual thoughts.



 David What I usually do if I have code that expects an empty string
 David instead of an undef is append an empty string onto it when I read
 David the cgi.pm value into it.

 David $formdata{view_name} = $query-param('view_name') . '';

 David That way undefined form elements have a consistent value and
 David it's easy to just send them back out to the user if I have to
 David without mangling them for display.


 This is voodoo programming.  You must've had some problem that this
 appeared to solve at some point, but it isn't needed for what you are
 answering here, so I don't know how that can help.


Sorry your right, this is bad programming and way beyond the scope of
what was asked in this question and should not have been mentioned.
Since I've badly explained myself already, I'll waste a little more time
and say it's a useful idiom to force the cgi.pm return value to a true ''
so the differences between it and undef don't bite you unexpectedly.
I'll try to be more on topic with my responses from now on.


 undef acts for all intents and purposes the same as an empty string.
 If you have warnings on, you'll get messages when you use it as an
 empty string, but you would have got a message on that first
 concatenate as well.



Very true, and sorry this post is not very clear, lucid or representative
of what I was thinking.  Not the best of contributions on my part, and
I'm sorry for anyone I've confused. I will improve.  I promise :)

Thank you Randal for being there giving me a standard to improve to.

--
Perl, because 600 billion oysters can't be wrong
   Canadian Consulting Services' pet perl hacker
   David Labatte [EMAIL PROTECTED]