Re: Why perl lost steam...

2010-09-21 Thread Randal L. Schwartz
>>>>> "Eko" == Eko Budiharto  writes:

Eko> it is true many people are using CMS more often and I think all CMS
Eko> are using PHP instead of perl.

You are mistaken.

PHP is only one of many viable options for CMS.  Perl is another.  So
are Ruby and Python and [insert any modern language here].

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: Auto detect timezone

2009-05-25 Thread Randal L. Schwartz
>>>>> "Jayesh" == Jayesh Thakrar  writes:

Jayesh> There's a webservice that you can invoke. See -

Jayesh> 
http://www.xmethods.net/ve2/ViewListing.po?key=uuid:6F25C11C-7087-73ED-20B8-71AF6DC69E42

Jayesh> And you can use SOAP:Lite to query the web service with minimal effort.

Ugh.  If "SOAP" is part of your answer, you asked the wrong question.

See Geo::GeoNames in the CPAN:

use Geo::GeoNames;
my $result = Geo::GeoNames->new->search(q => 'Portland, Oregon',
   maxRows => 1,
   style => 'FULL');
print $result->[0]{timezone}{content}, "\n";

==>

America/Los_Angeles

As I would expect.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: FormMail within a CGI Script

2008-09-20 Thread Randal L. Schwartz
>>>>> "Mike" == Mike Flannigan <[EMAIL PROTECTED]> writes:

This is Perl...

Mike> sub redirectmail {
Mike> print header,
Mike>start_html('Mail Info'),
Mike>h1('Mail Info'),

But this isn't...

Mike> 
ACTION="http://somewebhost/forms?login=myusername&to=myaddress&confirm=confirmed.html&error=error.html";
Mike> METHOD="POST">,
Mike>     ,
Mike> ,

You need a Perl program, not a mashup of two different things.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

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




Re: CGI query and FORM

2007-12-13 Thread Randal L. Schwartz
>>>>> "Praki" == Praki  <[EMAIL PROTECTED]> writes:

Praki> This comes first of all the lines in my cgi file. so it parse all the
Praki> POST and GET methods..
Praki> i m not able to the values from FORM varible..

Praki> $query = new CGI;
Praki> $sid = $query->cookie('CGISESSID') || $query->param('CGISESSID') ||
Praki> undef;

Praki> after the abouve line
Praki> if ($FORM{'lab'} eq "pager") {

That's not how it works.  See "perldoc CGI", and you'll find that
%FORM is set up *only* if you especially ask for it.  And that's only
for backward compatibility... you would be better to use the "param()" calls:

use CGI qw(param);

if (param('lab') eq 'pager') { ... }

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Stripping HTML code from emails

2006-11-09 Thread Randal L. Schwartz
>>>>> ""Richard" == "Richard Bagshaw" <[EMAIL PROTECTED]> writes:

"Richard> I'm writing some code that basically checks a pop mailbox and puts the
"Richard> information into a mysql database, however if the person sends an 
email
"Richard> in HTML format it looks messy, I am looking for a perl module that 
will
"Richard> convert it to plain text or just strip the HTML.  Does anyone have any
"Richard> ideas on a module to-do this?

See my article "A MIME is a terrible thing to waste",
<http://www.stonehenge.com/merlyn/UnixReview/col37.html>.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Tracking/Blocking IPs.

2005-11-03 Thread Randal L. Schwartz
>>>>> "Sara" == Sara  <[EMAIL PROTECTED]> writes:

Sara> I have been running a public forum (no registration required)
Sara> with over 50,000 visits per day.

There's your mistake.  Looks like you'll have to implement a
round-trip registration.  Of course, if your site is highly visible,
expect *that* to be automated and worked around.

There is no "ultimate" solution.  Only a series of solutions depending
on your willingess to spend money to keep the bad guys out.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Taking Multiple Values for The Same Form Field.

2005-10-29 Thread Randal L. Schwartz
>>>>> "Ovid" == Ovid  <[EMAIL PROTECTED]> writes:

Ovid> As of CGI.pm version 2.63, if the name is supplied in the query string
Ovid> but has no value, CGI.pm should return an empty string for that.  This
Ovid> should let you keep your @name and @email arrays in synch.  Even if you
Ovid> are using a POST, there should be a query string in the entity-body and
Ovid> CGI.pm *should* handle this correctly.

... unless the browser is returning only one email value (because the
other two are not touched), which is quite possible.

If you need to correlate fields, use distinct names:

name1   email1
name2   email2
name3   email3

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Book Recommendation: Secure web programming ?

2005-10-08 Thread Randal L. Schwartz
>>>>> "Elfyn" == Elfyn McBratney <[EMAIL PROTECTED]> writes:

Elfyn>   * Escape [shell] `meta'-characters - `"', `;', '|', etc. - in all user
Elfyn> input.  This is especially important if you hand-off user-supplied
Elfyn> input to an external program (for example, `sendmail');

Even better, don't let such things get near a shell.  Use multi-arg exec
or system, or multi-arg open to fork-and-pipe.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: New Website for Perl Beginners: perlmeme.org

2005-10-02 Thread Randal L. Schwartz
>>>>> "Shlomi" == Shlomi Fish <[EMAIL PROTECTED]> writes:

Shlomi> Hi good people,
Shlomi> there's a new web-site for Perl beginners - perlmeme.org - 

Shlomi> http://perlmeme.org/

Unless it's hidden, I'm not finding any obvious link there to the
defacto standard location for Perl beginners, <http://learn.perl.org>.
I think this represents broken integrity on your part, since you
appear to be trying to replace learn.perl.org, not supplement it, so
you're attempting to fracture the community, not enhance it.

If you add a prominent link to learn.perl.org, I will withdraw my
complaint.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Help w/Modules

2005-09-25 Thread Randal L. Schwartz
>>>>> "Bill" == Bill Stephenson <[EMAIL PROTECTED]> writes:

Bill> Wouldn't it be more efficient for the server to run a small script
Bill> that contains only the set-up and sub-routines needed to process a
Bill> single "run-mode" instead of loading all the data needed to process
Bill> all the "run-modes" used in an entire application?

That's why I created CGI::Prototype::Hidden... to lazy-load the code
for the particular step of the application.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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 big is too big?

2005-09-17 Thread Randal L. Schwartz
>>>>> "Bill" == Bill Stephenson <[EMAIL PROTECTED]> writes:

Bill> How many lines of code does it take in a single CGI script to be
Bill> considered too big?

There are days when I wanna answer that as "3". :)

... time passes ...

And I was just going to leave that as a joke answer, but on serious
reflection, your CGI "scripts" should be nothing more than
configuration and method calls against a testable module.  It's hard
to test a script, but easy to test a module.  Maybe that's why I like
frameworks such as Catalyst and my own CGI::Prototype so much...  all
the heavy lifting is in testable modules.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: What about perlcc?

2005-06-20 Thread Randal L. Schwartz
>>>>> "Augusto" == Augusto Flavio <[EMAIL PROTECTED]> writes:

Augusto> Hi
>>> did you pay attention to ANY of the answers?
Augusto> Yes, I pay attention in all answers.

Apparently not, because you're still trying to hide your source code.

STOP THAT.

Can we make it any clearer?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: What about perlcc?

2005-06-19 Thread Randal L. Schwartz
>>>>> "Augusto" == Augusto Flavio <[EMAIL PROTECTED]> writes:

Augusto> What i do?!

Unless you're not the same person who asked this question earlier here,
my question to you is:

did you pay attention to ANY of the answers?
        have you read the FAQ?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: hide source code

2005-06-18 Thread Randal L. Schwartz
>>>>> "Glauco" == Glauco Magnelli <[EMAIL PROTECTED]> writes:

Glauco> I would hide source code in my CGI Perl scripts.

Just make it so crappy that no one will want to steal it.

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Just to know why ?: is not working here

2005-06-15 Thread Randal L. Schwartz
>>>>> "Oliver" == Oliver Schnarchendorf <[EMAIL PROTECTED]> writes:

Oliver> You want the following:

Oliver> $str_codetoreturn 
Oliver> ? print $cgi_this->header().$str_codetoreturn 
Oliver> : print $cgi_this->redirect(-url=>$str_redirectto);

Definitely *not*.  That's using ?: in a void context, to be avoided.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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 save the state of a CGI script

2005-05-29 Thread Randal L. Schwartz
>>>>> "Ankur" == Ankur Gupta <[EMAIL PROTECTED]> writes:

Ankur> a.cgi calls b.cgi through POST method.

Why?  Why?  CGI is a protocol that permits a server to launch a process
to handle a browser hit.

YOU SHOULD NOT HAVE CGI "calling" EACH OTHER.

:-(

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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 save the state of a CGI script

2005-05-29 Thread Randal L. Schwartz
>>>>> "Ankur" == Ankur Gupta <[EMAIL PROTECTED]> writes:

Ankur> a.cgi calls b.cgi through POST method. I am collecting all the parameters
Ankur> using the param function.
Ankur> b.cgi draws a table based on the input from a.cgi's form. 

Ankur> The table's row are initially sorted by first column. It is desired that 
I
Ankur> can sort the same table by different columns by just clicking on the 
heading
Ankur> of the column. 

Ankur> I read perldoc CGI and found that state of a script could be saved by the
Ankur> following function.

Ankur> [...]
Ankur> $myself = $query->self_url;
Ankur> print q(I'm talking to myself.);

Ankur> self_url() will return a URL, that, when selected, will reinvoke this 
script
Ankur> with all its state information intact. This is most useful when you want 
to
Ankur> jump around within the document using internal anchors but you don't 
want to
Ankur> disrupt the current contents of the form(s). Something like this will do 
the
Ankur> trick.

Ankur>  $myself = $query->self_url;
Ankur>  print "See table 1";
Ankur>  print "See table 2";
Ankur>  print "See for yourself";
Ankur> [...]

Ankur> But I do not want to jump around the page but change the order of the 
file.

Ankur> I tried this stupid thing and it did not work.
Ankur> my $myself = $q->self_url;
Ankur> print $q->start_form(-method=>'POST',
Ankur>  -action=>$myself);

Ankur> I also read that the parameters can be saved into a file. I tried saving 
the
Ankur> parameters and it worked.
Ankur> But how do I use that information so that I can pass its contents to the
Ankur> same file.

Ankur> Kindly help

Ankur> PS: Earlier I was using GET method and I had one or two parameters to 
pass.
Ankur> So I was able to sort on different columns passing the list explicitly.

Ankur> --Ankur 

Ankur> Whatever games are played with us, we must play no games with ourselves. 
-
Ankur> Ralph Waldo Emerson



-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: No appending...

2005-05-18 Thread Randal L. Schwartz
>>>>> "Wert," == Wert, Nathaniel J <[EMAIL PROTECTED]> writes:

Wert,> Please excuse my lack of knowledge in this subject.  The original script
Wert,> executes every statement and in the process, it erases the file when it
Wert,> does the open and then proceeds to not write to the file at all.  Is the
Wert,> text that is supposed to be written to the file stored in a buffer while
Wert,> the program is executing?  I am using the standard Perl mods that came
Wert,> with SuSE SLES 8.0 (perl 5.8).  Is there an upgrade that I sould apply?
Wert,> I assure you that this is the problem.  I change the sleep 1; to
Wert,> system("sleep 1"); and the script runs perfectly.

Then the system() is also forcing a flush of all filehandles.  You can
avoid the external process using the method I gave earlier.  It's
not the "sleep".  It's the lack of unbuffering.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: No appending...

2005-05-18 Thread Randal L. Schwartz
>>>>> "Nathaniel" == Nathaniel J Wert <[EMAIL PROTECTED]> writes:

Nathaniel> Actually, with the help of another person here we figured
Nathaniel> out what was wrong.  Apparently there is a problem with the
Nathaniel> sleep() function where it interferes with the open() of the
Nathaniel> file.

That can't be the case.  You have reached a false conclusion.

Nathaniel>   We have found three ways of fixing this.
Nathaniel> system(sleep 1); instead of sleep()

I don't think this would change it at all, unless for some reason Perl
is now flushing all buffers whenever a child process is forked.

Nathaniel>  or using fopen instead
Nathaniel> of open.  I welcome your comments and thanks for the help.

fopen() means you are creating an unbuffered filehandle, just like
my code said to do. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: No appending...

2005-05-18 Thread Randal L. Schwartz
>>>>> "Nathaniel" == Nathaniel J Wert <[EMAIL PROTECTED]> writes:

Nathaniel> The following script is not appending to the file for some reason.
Nathaniel> Please bestow your wisdom on me oh great Perl gods.  :-)
Nathaniel> 

Nathaniel> --
Nathaniel> #!/usr/bin/perl -w
Nathaniel> my $size=0;
Nathaniel> my @stat;

Nathaniel> open(TEMPFILE, ">>/temp/temp.big_ass_file") or die "unable to write
Nathaniel> /temp/temp.big_ass_file:$\n";

select TEMPFILE;
$| = 1;
select STDOUT;

Nathaniel> while ($size < 150) {
Nathaniel>print TEMPFILE "This is a test for caiLogA2. \n";
Nathaniel>@stat = stat TEMPFILE;
Nathaniel>$size = $stat[7];
Nathaniel>sleep 1;
Nathaniel>print STDOUT "test\n";

Nathaniel> }

Nathaniel> close(TEMPFILE);
Nathaniel> --

Nathaniel> Thanks.
Nathaniel> Nate.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Recomdations for Template Plugins for Windows/CGI/ApacheHTTP

2005-05-17 Thread Randal L. Schwartz
>>>>> "Sean" == Sean Davis <[EMAIL PROTECTED]> writes:

Sean> Most template systems use a scripting language (mini-language).  This
Sean> is the Template Toolkit variety.  Again, when in doubt, check the
Sean> documentation. http://search.cpan.org is your friend.

I wouldn't say "many".  More like "some".  Some use a native embedded
full-featured language (like PHP or Mason[Perl]).  Some use "programming
masquerading as data", like XSLT or HTML::Template.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI::Cookie Reading.

2005-03-29 Thread Randal L. Schwartz
>>>>> "Sara" == Sara  <[EMAIL PROTECTED]> writes:

Sara> IF the cookie already exists the script reads the value
Sara> perfectly, but if cookie doesn't exist or I mean for the first
Sara> time visitor, it gives error: "Can't call method "value" on an
Sara> undefined value"

Ahh, the classic cookie misunderstanding.

You can't *read* a cookie that hasn't been sent to you by a browser
yet.  And the browser isn't going to send you a cookie until the
*second* hit, because the cookie is being set in the *first* hit.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Calling subroutines

2005-03-21 Thread Randal L. Schwartz
>>>>> "Denzil" == Denzil Kruse <[EMAIL PROTECTED]> writes:

Denzil> But, I fooled around with my above code found out that
Denzil> if I put some curly brackets in the right place, I
Denzil> think it works:

Denzil> $page = $in->param('page');

Denzil> &{page$page}()

You really really *really* don't want to do that.

Please pay attention to the proper solutions provided elsewhere.

For one, your example will fail on "use strict", which is what every
program larger than 10 lines should use.  And your exact example is
what it tries to rule out.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Send equivalent of this via perl

2005-03-16 Thread Randal L. Schwartz
>>>>> "Lawrence" == Lawrence Statton <[EMAIL PROTECTED]> writes:

Lawrence> Let me see if I understand correctly:  You want to interpose a program
Lawrence> you write, so that in place of goign direct to Paypal, they send the
Lawrence> request to your server, where you massage it in some nefarious way,
Lawrence> and then forward the massaged data to Paypal on their behalf?

"My spider sense is tingling."

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Unsticky fields with CGI? (Sorry)

2005-03-11 Thread Randal L. Schwartz
>>>>> "Jan" == Jan Eden <[EMAIL PROTECTED]> writes:

Jan> Hi,
Jan> should have read perldoc *thoroughly*, sorry:

>> Note, that just like all the other form elements, the value of a
>> hidden field is "sticky".  If you want to replace a hidden field with
>> some other values after the script has been called once you'll have
>> to do it manually:
>> 
>> $query->param('hidden_name','new','values','here');

Or, you can call $query-> (why are you using the object form?) delete('name')
Then the default listed in your field generator will be used.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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 avoid accidental re-sending of POST data

2004-12-03 Thread Randal L. Schwartz
>>>>> "Ingo" == Ingo Weiss <[EMAIL PROTECTED]> writes:


Ingo> this must be a common problem and I was wondering what commonly used
Ingo> strategies to solve it are:

Ingo> How can I avoid that a user re-sends a POST form when hitting the reload
Ingo> button on a result page?

Ingo> The browser typically warns you when you want to do that but I was
Ingo> wondering whether there is an easy way to make it impossible.

<http://www.stonehenge.com/merlyn/WebTechniques/col64.html>

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: What exactly does "$| = 1;" do?

2004-11-30 Thread Randal L. Schwartz
>>>>> "Wiggins" == Wiggins d Anconia <[EMAIL PROTECTED]> writes:

Wiggins> Since this is a general Perl question not related to CGI it is better
Wiggins> asked to [EMAIL PROTECTED]

Actually, I have sympathy for this one.  It's most often used in CGI
scripts so that a naive "system" invocation doesn't come out before
the headers.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI.pm : Handling Carriage Returns from textarea()

2004-09-08 Thread Randal L. Schwartz
>>>>> "Robert" == Robert Page IV <[EMAIL PROTECTED]> writes:

Robert> Woops!  XMP is deprecated with HTMl 4.01.
Robert> Sorry for the extra message.

XMP has been deprecated for over half the age of the web. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: HINT: regex coach

2004-09-08 Thread Randal L. Schwartz
>>>>> "Jose" == Jose Alves de Castro <[EMAIL PROTECTED]> writes:

Jose> Yes, it seems to be a very nice program, and it would probably help lots
Jose> of beginners (and not only).

Yeah, too bad it doesn't run on the only two platforms that matter to
me, and doesn't appear to be provided in source form.

Jose> There, I said it :-)

Me too.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Finding date when a file was created

2004-08-19 Thread Randal L. Schwartz
>>>>> "Bill" == Bill Stephenson <[EMAIL PROTECTED]> writes:

Bill> I'm sure there is some valid reason for not tracking file creation
Bill> dates but I fail to figure it out on my own.

The founding fathers of Unix deliberately left out "creation time"
because the concept is ambiguous at best.  There's some discussion on
it in the classic materials about the early years of Unix.

And I agree with the logic, and the conclusion.

Unix *does* track the most recent time anything happens to a file or
its metadata via ctime.  That's probably close to "creation" as you
would probably mean it or need it.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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-08 Thread Randal L. Schwartz
>>>>> "Camilo" == Camilo Gonzalez <[EMAIL PROTECTED]> writes:

Camilo>  It may behoove you to send a confirmation email with a link
Camilo> that when clicked will opt in a user. This "double opt-in"
Camilo> procedure has become standard operating procedure for
Camilo> considerate marketers and an integral part of customer
Camilo> relations management.

It's only called "double opt-in" by spammers, because they want the
public to think it's two rounds, not one.  It's simply called "opt-in"
by the spamfighters, like me.

In fact, that's my telltale sign that I'm looking at a spammer because
they've called something "double opt-in". :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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-08 Thread Randal L. Schwartz
>>>>> "Werner" == Werner Otto <[EMAIL PROTECTED]> writes:

>> Do *not* send email to addresses taken from forms.  Ever.
>> 
>> 
Werner> why is that?

Because you have no authentication of the requestor.  Any fool can go
to your website, enter [EMAIL PROTECTED], and all of a sudden, I
get a big PDF shoved down my email box.  Repeatedly.  And yet it
wasn't *me* that requested that.  And yet I'll have no clue, except
"it came from you" and you'll have no clue except "it came from this
IP addr".

No.  Do not go from web to mail.  Bad idea, unless you've fully
round-tripped the web requestor from a real mail address.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
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-08 Thread Randal L. Schwartz
>>>>> "Werner" == Werner Otto <[EMAIL PROTECTED]> writes:

Werner> $surname = param("surname");
Werner> $name= param("forename");
Werner> $email   = param("email");

I'm not sure what the rest of the script does, but if you put this on
a form and then send email to that address, you will incur my wrath,
and within a short period of time, you will also be on every "spam
blocklist" that I can possibly suggest.

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

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Unexpected CGI and HTML

2004-06-25 Thread Randal L. Schwartz
>>>>> "Sean" == Sean Davis <[EMAIL PROTECTED]> writes:

Sean> My misconception was that some cgi.pm methods return strings, and some
Sean> return arrays.

Well, none of them return "arrays".  You can't return an array.  You
can return only a list or a scalar, as selected by the context of
invocation.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Hijacking forms [was help with adjusting log file data?]

2004-06-13 Thread Randal L. Schwartz
>>>>> "Will" == Will Bontrager <[EMAIL PROTECTED]> writes:

Will> exit if $FORM{email} =~ /[EMAIL PROTECTED]@/s;

Once again, a bad regex for checking an address.  A "local part"
of an email (the part to the left of the '@') *can* have an "@"
as well.  This is a legal address, if I recall correctly:

[EMAIL PROTECTED]@stonehenge.com

Will> Another method is to target any form field that will be used in any
Will> email header line (name, email, subject, whatever). The form field
Will> contains a junk value plus a line feed plus Cc: or Bcc: plus a whole
Will> list of email addresses, plus two line feeds, plus the hijacker's
Will> email body message. The following line can detect line feeds in a form
Will> field value:

Will> exit if $FORM{subject} =~ /(?:[\n\r]|\%0[ad])+/si;

Uh, by the time you process your form element, there shouldn't
*be* any %0a or %0d there.  Also, % doesn't need to be backwhacked.
This regex looks cargo-culted... {sigh}.


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI and mySQL book, any recommendation.

2004-06-01 Thread Randal L. Schwartz
>>>>> "Bill" == Bill Jones <[EMAIL PROTECTED]> writes:

Bill> Even Blackboard, a major CMS / distance learning software developer,
Bill> abandoned MySQL in favor of baby Oracle.

Bill> ("Baby" Oracle is no better than PostgresSQL IMO.  Plus PostgresSQL is
Bill> free.)

And the .org domain is run on postgresql.

Like I said, experts who have discovered postgresql are migrating.
So I'm trying to get the word out as well.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI and mySQL book, any recommendation.

2004-06-01 Thread Randal L. Schwartz
>>>>> "Wiggins" == Wiggins D'Anconia <[EMAIL PROTECTED]> writes:

Wiggins> Agreed. I have requested this from him before, but didn't get much.

I haven't responded because I've been using the net at 40 cents per
minute from a satellite link on a ship this past week, and right now
I'm using a 10 cents per minute cellphone modem.  When I get back to a
free link, I'll post more.

But in short, MySQL was great when it was the only game in town.
But PostgreSQL has leapfrogged MySQL now in every area including
features, performance, *and* license.  There's no point in starting
a new project with MySQL, *except* for legacy.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI and mySQL book, any recommendation.

2004-05-29 Thread Randal L. Schwartz
>>>>> "Remko" == Remko Lodder <[EMAIL PROTECTED]> writes:

Remko> I have the book "MySQL and Perl" from Paul Dubois,

By the way... it's consensus amongst experts that MySQL has hit
nearly end-of-life.  If you're starting a new project, use PostgreSQL
instead.  A real Database... not a database wannabe.

The only reason to use MySQL these days is ignorance or legacy.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI and mySQL book, any recommendation.

2004-05-29 Thread Randal L. Schwartz
>>>>> "Luinrandir" == Luinrandir Hernsen <[EMAIL PROTECTED]> writes:

Luinrandir> If you are new to perl.. avoid the O'Reilly books... there
Luinrandir> are, IMHO, written by PhD's for PhD's

This is clearly a minority opinion or a misstated fact.  Thank
goodness. :)

I'm not a PhD, and I write for people as stated in the preface of each
book.  I can assure you that "You must have a PhD" has never been a
pre-req of any book I've written.

Luinrandir> something you need to know about perl that confused me for
Luinrandir> a year...  there is the long way of writing code and a
Luinrandir> shorthand form.  for instance... I now squat about
Luinrandir> CGI.pm so answers that reffer to CGI.pm are usless to
Luinrandir> me.

You are ensuring that your opinion means less and less with each
statement.  Thank you for that.

Luinrandir> I am wrting a web site just for beginners like usyou
Luinrandir> could help.

Please, never ever post the URL to your website.  "Blind leading
Blind" comes to mind.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI and mySQL book, any recommendation.

2004-05-29 Thread Randal L. Schwartz
>>>>> "Sara" == Sara  <[EMAIL PROTECTED]> writes:

Sara> Looking to buy a comprehsive book on CGI and SQL, any recommendations.

In the same section where they have books on "apples and oranges".

That is... CGI and SQL (SQL or MySQL?  You said both) are orthogonal
technologies... you can easily use one without the other.  So it'd
be hard to find a single comprehensive book on both.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Only one click please

2004-05-27 Thread Randal L. Schwartz
>>>>> "Khalid" == Khalid Naji <[EMAIL PROTECTED]> writes:

Khalid> there are users who click twice on a control button, how could i prohibit
Khalid> the double clicks on a button?

If the answer is "JavaScript", you've lost.  Here's a Perl-only solution:

<http://www.stonehenge.com/merlyn/WebTechniques/col64.html>.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Redirecting

2004-05-20 Thread Randal L. Schwartz
>>>>> "Jan" == Jan Eden <[EMAIL PROTECTED]> writes:

Jan> But after committing the data to my database, I use CGI's print
Jan> $q->redirect() to call the script again, this time with the user
Jan> name and password as parameters visible in the browser's address
Jan> bar.

Jan> How can I circumvent making the parameters visible? Is there an
Jan> alternative method for redirection (in fact, it's a recursive
Jan> call to the script)?

Redirect using a session ID instead.  Generate a nice unguessable
value, and then tie that with a server-side database to the actual
username.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Display while forked

2004-04-06 Thread Randal L. Schwartz
>>>>> "Jason" == Jason Normandin <[EMAIL PROTECTED]> writes:

Jason> I have a cgi sctipt that forks a process during execution. I
Jason> would like to display a message to the user after the fork
Jason> occurs. Semething like displaying an animated gif or something
Jason> to inform the user the task is in progress as the forked
Jason> process can take 10-20 secs to complete.

Please take time to search and study the 192 magazine articles
I've written (and continue to write):

http://www.stonehenge.com/merlyn/WebTechniques/
http://www.stonehenge.com/merlyn/UnixReview/
http://www.stonehenge.com/merlyn/LinuxMag/
http://www.stonehenge.com/merlyn/PerlJournal/

when looking for places to learn about Perl.  In particular,
I've addressed this issue various ways, probably the closest plan is
the "traceroute" solution:
<http://www.stonehenge.com/merlyn/LinuxMag/col39.html>.

There's hardly ANYTHING that comes up here that I haven't addressed.
Especially about CGI.  I've pretty much beat that into the ground. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: handling multiple select with CGI

2004-03-17 Thread Randal L. Schwartz
>>>>> "Andrew" == Andrew Gaffney <[EMAIL PROTECTED]> writes:

Andrew> I have a Perl script which uses the CGI module which needs to be able
Andrew> to get all the selected items in a SELECT. I see that the request
Andrew> comes in as 'selectname=item1&selectname=item2&selectname=item3'. If I
Andrew> do '$p = $cgi->Vars', wouldn't I only get the last value?

Don't do that.  Use param():

use CGI qw(param);

my $one_value = param('selectname'); # gives one of them
my @all_values = param('selectname'); # gives *all* of them

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Webhosting with good Perl support

2004-02-14 Thread Randal L. Schwartz
>>>>> "Frank" == Frank DeLaTorre <[EMAIL PROTECTED]> writes:

Frank> SHOW US YOUR DATA. Otherwise you're just pointing fingers with
Frank> NO evidence.

The data is public record.  Eight years with only one remote root
exploit for OpenBSD (and that was in OpenSSH, so it affected all
systems, not just OpenBSD).  The CERT records will show far more for
Linux.

I run OpenBSD because I don't want to have to log in every three hours
to find out that there's a new Linux Bug and I need to recondition my
server.

It's just a difference in philosophy, and has its trade offs, but I'm
willing to put up with fewer compatible packages in exchange for more
security.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Webhosting with good Perl support

2004-02-14 Thread Randal L. Schwartz
>>>>> "Frank" == Frank Delatorre <[EMAIL PROTECTED]> writes:

Frank> try:  www.he.net

Frank> They allow everything. They run LINUX servers.

www.sprocketnetworks.com - stonehenge.com and geekcruises.com runs
on an openbsd server there.  And if you want lesser security, you can
run linux instead.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: CGI Script to annoy script kiddies.

2004-02-06 Thread Randal L. Schwartz
>>>>> "Carl" == Carl Fischer <[EMAIL PROTECTED]> writes:

Carl> if (defined $ARGV[0] == FALSE) {

What do you expect this to do?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: LWP get with no cache (code)

2004-01-23 Thread Randal L. Schwartz
>>>>> "J" == J Alejandro Ceballos Z <[EMAIL PROTECTED]> writes:

J> #
J> # Read Input
J> &ReadInput(*cInput);
>> Eeek!  "use CGI".  "use CGI".  "use CGI".  Not this stuff.

>> I didn't read any further.  My mind rejects CGI scripts that are
>> written this poorly.


J>  If you see CGI.pm, ReadInput and ReadParse works exactly the same way.


No.  CGI.pm works better.  Much better.  use CGI.pm, please.


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: LWP get with no cache (code)

2004-01-22 Thread Randal L. Schwartz
>>>>> "J" == J Alejandro Ceballos Z <[EMAIL PROTECTED]> writes:

J> #!/usr/bin/perl

J> #
J> # Load modules
J> use CGI::Carp qw(fatalsToBrowser);
J> use LWP::Simple;
J> use integer;

Huh?  Why?

J> #
J> # Read Input
J> &ReadInput(*cInput);

Eeek!  "use CGI".  "use CGI".  "use CGI".  Not this stuff.

I didn't read any further.  My mind rejects CGI scripts that are
written this poorly.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: large directory handling

2004-01-05 Thread Randal L. Schwartz
>>>>> "Charles" == Charles Harvey <[EMAIL PROTECTED]> writes:

Charles> I am trying empty a directory with over 4000 files with a script, and
Charles> do not understand why I can only delete half at a time.  I am guessing
Charles> that the directory handle has a size limitation??  Is there a way to
Charles> load the contents into a large array or am I going about this all
Charles> wrong?  Please forgive the newbie question.  I'm trying to hack this
Charles> with my copy of the Perl Bookshelf and limited practical experience.

Asked and answered on perl-beginners.

And it's rude to post a question to both lists, either it *is* a CGI
problem, or it isn't.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Getting a users IP addy

2003-12-25 Thread Randal L. Schwartz
>>>>> "Charlie" == Charlie Somerville <[EMAIL PROTECTED]> writes:

Charlie> I'm trying to get a users IP address but when i test it, it always returns
Charlie> "192.0.0.0" which is not my IP. I can't tell you which %ENV key i'm using as
Charlie> i forgot.

Why do you want it?  I hope you're not trying to base an authentication
system around it?

A unique user is not an IP address.
A unique IP address is not a user.

For example, many millions of users use AOL's proxy servers.  On a
given "hit" from a page, the various image fetches will come from many
different machines.  (I can demonstrate it if you want).

And given that this already outnumbers any other significant userbase
for your website... I think I can safely say "logging IP addresses is
OK, but using them to define unique users will totally fail".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: encrypting email address (to prevent spam)

2003-12-17 Thread Randal L. Schwartz
>>>>> "Sara" == Sara  <[EMAIL PROTECTED]> writes:

Sara> I am looking for a way to encrypt & decrypt an email addy to
Sara> prevent spam while posting a message to discussion board.

You also asked this, and I answered it, on the Perl Beginner's Mailing
List at Yahoo.  It's a waste of resource to post a question like this
in multiple places, and unethical to not disclose that it has been
asked in such a manner.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Fork

2003-12-09 Thread Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> Yes I am forking more process from a CGI script because I want to let them
Octavian> run on the server then end loading the current page immediately.

Octavian> Can you give me a short example about how I should create that loop?

Any one of the articles you get from the following google search:

site:stonehenge.com cgi fork

should be able to help you out.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: extracting email addys.

2003-11-23 Thread Randal L. Schwartz
>>>>> "Silent" == Silent Zed <[EMAIL PROTECTED]> writes:

Silent> I'd like to know the thought's of other people are on this
Silent> though, was I wrong to post a quick and dirty solution to a
Silent> problem?

The problem with that kind of a response is that it's likely to get
picked up out of context, and used for *all* email address parsing.

That's the behavior I hoped to stop.

And yes, I overreacted, but how else do you kill the bad meme!

In other words, don't call that a regex that "can match email
addresses".  Label it a regex "that matches some common email
addresses".

It's a bit like including (making it relevant here again) the
cargo-culted %ENV-parser to the params into a flat hash, as long as
you don't have select-multiples or uploaded files.  I will flag that
*every* time as bad practice, simply because it's neither necessary
nor sufficient.

I'm fighting the bad memes, and the people who repeat them.  If
there's a few bodies along the way, that's necessary, IMHO.  If the
only effect is to scare someone into never answering again, then at
least they won't be publishing that *bad* answer again.

On the flip side, there are very few things that I get this riled up
about.  :-) Bad memes, security holes, hiding code, and one other
thing that escapes me now.  The rest, I live and let live.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: extracting email addys.

2003-11-22 Thread Randal L. Schwartz
>>>>> "John" == John Horner <[EMAIL PROTECTED]> writes:

>> > $text =~ m/[EMAIL PROTECTED]/g;
>> 
>> WRONG.  WRONG WRONG WRONG.  Please read the FAQ on this.
>> 
>> And dare I say again, WRONG.

John> Wow, Randal, even for you that's a bit extreme. Couldn't you explain
John> even a little bit why it's so wrong, and give more details about "the
John> FAQ"? It is a beginners' list after all.

It's just that we keep seeing this over and over again.  That's the point
of the FAQ.  What happened to the ethic of even ATTEMPTING to look
for a local FAQ before posting to a list.

{sigh}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: extracting email addys.

2003-11-20 Thread Randal L. Schwartz
>>>>> "Silent" == Silent Zed <[EMAIL PROTECTED]> writes:

Silent> You could very simply match the email address, like so:
Silent> $text =~ m/[EMAIL PROTECTED]/g;

WRONG.  WRONG WRONG WRONG.  Please read the FAQ on this.

And dare I say again, WRONG.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: flock() semantics?

2003-11-01 Thread Randal L. Schwartz
>>>>> "Shaun" == Shaun Fryer <[EMAIL PROTECTED]> writes:

Shaun> open(OUT, ">$file");
Shaun> flock(OUT, LOCK_EX);

No point here.  You've already killed the file, non exclusively,
and then you get a flock.  Pointless.

Shaun> flock(OUT, LOCK_UN);

Rarely needed, almost always dangerous.  Don't LOCK_UN unless you
completely understand why I said that. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Apache Logs

2003-10-03 Thread Randal L. Schwartz
>>>>> "Mike" == Mike Blezien <[EMAIL PROTECTED]> writes:

Mike> I was wondering if someone knows of any Perl Modules that designed to
Mike> read and process the various types of apache access_log files like
Mike> "common", "combined"..etc ??

You mean, besides Apache::ParseLog, which I immediately saw
on the first page of the search result by typing "apache logs"
in search.cpan.org?

Please learn to use the existing search engines.  Please read the FAQ
for this mailing list.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: CGI.pm > 2.98 breaks CGI::Carp?

2003-09-24 Thread Randal L. Schwartz
>>>>> "Nestor" == Nestor Florez <[EMAIL PROTECTED]> writes:

Nestor> Randall,
Nestor> Sorry, but what is TPJ ?

www.tpj.com - the Perl Journal, formerly a print quarterly, then bundled
with SysAdmin, is now back as an online monthly.

I have a column there, taken over from "brian d foy", who is currently
in Iraq under military orders until next April.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: CGI.pm > 2.98 breaks CGI::Carp?

2003-09-24 Thread Randal L. Schwartz
>>>>> "Drieux" == Drieux  <[EMAIL PROTECTED]> writes:

Drieux> just a quick knickle tour - I of course will defer to Randal
Drieux> to go into more detail if required.

That covers most of it, but let me put it a different way.

"use CGI::Carp qw(fatalsToBrowser);" presumes that the person
operating the browser is the person also developing the program.
While this can certainly be true during development, it is rarely
true (if ever!) in production.

Here's the problem:

The end user doesn't want to see a Perl error message.  They will
probably have no clue what to do to work around it, and will rarely
understand how to precisely copy that error (and any associated state
or sequence descriptions) to a proper email buffer to email the
developer.

But worse, the end user *shouldn't* see the details of the error,
which will often include filenames and other key data that might
reveal the security mechanisms being used.  This is prime intrusion
vector information - a goldmine for the person wanting to abuse the
website.

All you should do for a non-recoverable error is tell the user:

SOMETHING WENT WRONG.
WE ALREADY KNOW ABOUT IT.
IF YOU WANT TO TELL US WHAT YOU WERE DOING:
email [EMAIL PROTECTED] referencing trouble ticket #12345.

and then on the server side, log the hell out of the error, and create
a trouble ticket so there can be a repair made and correlation with
any user.  If you don't want to create a "ticket", just use
unpack("H*", pack "NS", time, $$), which should be fairly unique and
yet short enough to cut and paste nicely.

In fact, that'd be nice column idea!  I needed one for TPJ today.
Thanks.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: CGI.pm > 2.98 breaks CGI::Carp?

2003-09-22 Thread Randal L. Schwartz
>>>>> "Db" == Db  <[EMAIL PROTECTED]> writes:

Db> I'm working on a large web application with a friend of mine and we
Db> thought it would be a good idea to update the modules we were using.
Db> Using CPAN.pm we updated CGI, CGI::Session, and several others.  It
Db> upgraded CGI.pm from 2.93 to 3.00.  After the upgrade we noticed that
Db> CGI::Carp was not sending correct headers to the browser on
Db> fatalsToBrowser and explicit 'die's.  It'd just send the error message
Db> without any Content type.  I just downgraded to 2.98 and everything
Db> works again.  2.99 exhibits the same behavior as 3.00.

Just a sidenote, but I sincerely hope that you were removing CGI::Carp
before deploying your code in production, and therefore must already have
some other error trapping mechanism for production *anyway*.  Might as
well develop with your final release until you can figure out what is
wrong with CGI::Carp.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Stripping HTML from a text file.

2003-09-05 Thread Randal L. Schwartz
>>>>> "Sara" == Sara  <[EMAIL PROTECTED]> writes:

Sara> I have a couple of text files with html code in them.. e.g.
Sara> -- Text File --
Sara> 
Sara> 
Sara> This is Test File
Sara> 
Sara> 
Sara> This is the test file contents
Sara> 
Sara> blah blah blah.
Sara> 
Sara> 

Sara> -

Sara> What I want to do is to remove/delete HTML code from the text file from a 
certain tag upto certain tag.

Sara> For example; I want to delete the code completely that comes in between  
and  (including any style tags and embedded javascripts etc)

Sara> Any ideas?

This code will create an XML tree doc from stdin, and write the modified
version to stdout, deleting everything from the "/html/head" node
downward:

use XML::LibXML;
my $p = XML::LibXML->new or die;
$p->recover(1);
my $d = $p->parse_html_fh(\*STDIN) or die;
$_->unbindNode for $d->findnodes("/html/head");
print $d->toStringHTML();

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: disable back button

2003-08-25 Thread Randal L. Schwartz
>>>>> "Ken" == Ken McEntire <[EMAIL PROTECTED]> writes:

Ken> Regardless of whether you like or dislike the idea of disabling
Ken> the back button, that issue is not currently up for dispute.
Ken> This individual is asking for help in accomplishing his
Ken> objective.  Remember there is always a reason.  Perhaps they want
Ken> to disable use of a back button when the user has exited a
Ken> critical area.

But any attempt to "disable" the back button goes against the grain of
the design of the web, and won't work on at least some browsers.

Hence, the responses here are an attempt to take a few steps backward
in the problem solving process, to see how we got painted into a
corner here trying to do something that isn't possible.

On #perl, we call this an "xy problem", where a person asks how to do
"y" hoping it will help them solve a part of "x", when in fact we need
to ask what "x" is because "y" is almost always the wrong partial
solution.  This is a valid exchange of questions.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Why executable?

2003-08-14 Thread Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> Hmm, are you telling that I can create a perl file and name
Octavian> it file.html, file.php, or even file.asp, and use a shebang
Octavian> line in it, then it will be parsed as a perl file?

Octavian> Or I need to use extensions that are not set in the server's
Octavian> conf file to be parsed as other types?

It all depends on the way you configure your server.

For example, with Apache, anything below a ScriptAlias directory is
automatically interpreted with mod_cgi, regardless of the extension.  So,
if I have in my httpd.conf:

ScriptAlias /cgi /some/unix/path

and then put my Perl script "register" into /some/unix/path/register
with the right shebang line and executable bit set, I can invoke

http://my.host.example.com/cgi/register

and it runs my script.  You can't tell what implements it.  In fact,
you could even make it "register.html" for all that it matters (none!).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Why executable?

2003-08-14 Thread Randal L. Schwartz
>>>>> "Kristofer" == Kristofer Hoch <[EMAIL PROTECTED]> writes:

Kristofer> This is what I do for security on my webserver.  I don't have the
Kristofer> shebang line in my scripts.  The webserver has a list of approved perl
Kristofer> script extensions.  When it runs across a file with this extension, the
Kristofer> web server executes it with perl.  Otherwise, it treats the file as if
Kristofer> it is text/html.  

And if you are required to include that "extension" as part of your
URL, you are actually *decreasing* the security of your webserver, not
increasing it.

You should never be able to guess the implementation language by
looking at a URL.  Wrong.  Wrong.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: urgent help needed!

2003-07-22 Thread Randal L. Schwartz
>>>>> "S" == S Naqashzade <[EMAIL PROTECTED]> writes:

S> Dear Friends,
S> I need to trnaslate thid code to PHP.
S> Can any one help me?

This is the *perl* beginners list.  Not the PHP help desk.
You must've pushed some buttons by mistake.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: HTTP_ACCEPT_LANGUAGE

2003-07-20 Thread Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> I've set more languages in the browser in the following
Octavian> order: ro, en, sp, fr and it gave me the following string:

Octavian> HTTP_ACCEPT_LANGUAGE="ro,en-us;q=0.8,es;q=0.5,fr;q=0.3"

See <http://www.w3.org/Protocols/rfc2616/rfc2616.html> under
section 14.4.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: question on global variable / scope

2003-07-05 Thread Randal L. Schwartz
>>>>> "Wiggins" == Wiggins D'Anconia <[EMAIL PROTECTED]> writes:

Wiggins> Excellent reading on the scoping of variables in Perl can be found here:

Wiggins> http://perl.plover.com/FAQs/Namespaces.html

I also have a recent column on scoping at:

<http://www.stonehenge.com/merlyn/UnixReview/col46.html>

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Difference of $hash, and %hash. (was Getting my head round hashes)

2003-06-06 Thread Randal L. Schwartz
>>>>> "Scot" == Scot Robnett <[EMAIL PROTECTED]> writes:

Scot> Word of caution: I tried getting help on IRC (irc.debian.org)
Scot> and found the Perl community there to be much less helpful and
Scot> much more arrogant (if any of you are on this list, I'm
Scot> definitely generalizing, so please take that with a grain of
Scot> salt). "RTFM" is a common response there, even if you -have-
Scot> RTFM. :-)

To understand why IRC tends to be hostile toward CGI questions, you
have to hang out long enough on IRC.  I'm not saying it's justified,
but I'm also not saying it isn't. :)

Non-CGI questions get asked and answered frequently and politely on
the Perl IRC channels I monitor.  CGI questions tend to ruffle
feathers.  Consistently.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Help creating HTML for immediate output, and more than once

2003-05-31 Thread Randal L. Schwartz
>>>>> "Martin" == Martin Lomas <[EMAIL PROTECTED]> writes:

Martin> I hope someone here could help me ... I know Perl, HTML and
Martin> Javascript quite well, but CGI not at all.

This question has also been asked (and answered) on the perl.beginners
list.  Not nice to repost it without saying that it's a multi-post.

{sigh}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Randal L. Schwartz
>>>>> "Scot" == Scot Robnett <[EMAIL PROTECTED]> writes:

Scot> Somebody better tell Nathan Patwardhan, Ellen Siever, & Stephen
Scot> Spainhour then.  I'm looking at the 2nd edition of PERL IN A
Scot> NUTSHELL (and that is exactly how it's printed) right now.

I don't have a copy of the book at hand, but in Safari, the only time
it's spelled all caps is on the front cover, and I can certainly
imagine that it was done that way for aesthetic reasons.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Randal L. Schwartz
>>>>> "Bill" == Bill Burke <[EMAIL PROTECTED]> writes:

Bill> Thanks for the edification. You have been one of the most prolific
Bill> contributors to the group, so I take no umbrage. Truly, you write it as
Bill> perl, but the books label it PERL (Practical Extraction and Reporting
Bill> Language). Please remember this is a beginners group which shares your
Bill> enthusiasm, but not your expertise.

Actually, that's one of our clues that it's a *bad book*.  If you
see it spelled that way, they are less than clueful, and probably
don't hang out with the experts.

Put another way, when *you* spell it "PERL", we know you aren't
part of the "cool crowd". :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Randal L. Schwartz
>>>>> "Bill" == Bill Burke <[EMAIL PROTECTED]> writes:

Bill> I added a chat room at my site http://www.speakerscorner.us . You are
Bill> welcome there and we can discuss PERL in real time. Don't quit the user
Bill> group though, you won't want to miss anything

And there's no such thing as "PERL".
It's "Perl" for the language, "perl" for the engine.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: The very un-useful 'premature end of script headers' error message

2003-03-28 Thread Randal L. Schwartz
>>>>> "Cool" == Cool Hand Luke <[EMAIL PROTECTED]> writes:

Cool> Hello All,
Cool>   I think I figured it out, (so far). I 'm pretty sure that it has to do
Cool> with perl 5.003 disliking the looping with the "my $pair" syntax.
Cool> As a work around, I changed this

Cool>   foreach my $pair (split(/[&;]/, $submission)) {
Cool> # Convert plus to space
Cool> $pair =~ y/+/ /;

Please don't use this code.  "use CGI qw(param)".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: help needed in frames with php

2003-03-16 Thread Randal L. Schwartz
>>>>> "Mel" == Mel Awaisi <[EMAIL PROTECTED]> writes:

Mel> help needed in frames with php

php questions are not really appropriate on a Perl help list,
unless there's some Perl component as well.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Previous and Next

2003-03-13 Thread Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> You need to use Javascript.
Octavian> Back

If the answer is javascript, you asked the wrong question.

And if you think a user can't figure out how to press the back button
when they want to do that, how in the world are they going to click on
a link that could do the same thing?

The biggest problem here is in the original question:

Octavian> How can i write a PERL Script to simulate the Previous (->) and Next (->)
Octavian> Links
Octavian> (like in IE or Netscape).

As in, "what could that possibly mean?"  That's either impossible
or mis-specified.  We need to know more before we could even begin
to write code or answer it.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Random letters

2003-03-08 Thread Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> Hi all,
Octavian> I know how to create a random number, but could you tell me how can I create
Octavian> a random string that have numbers and letters?

Octavian> I would like a result like:

Octavian> 122oijopi3j4po5j5o6j6opjop5


my @charset = ('a'..'z', '0'..'9');

my $length_desired = 15;

my $random_string = join "", $charset[rand @charset], 1..$length_desired;


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Learning Perl

2003-02-28 Thread Randal L. Schwartz
>>>>> "WilliamGunther" == WilliamGunther  <[EMAIL PROTECTED]> writes:

WilliamGunther> I think Programming Perl is good for learning. There
WilliamGunther> is a book also called Learning Perl from O'Reilly, but
WilliamGunther> really I don't feel there is a suitable enough reason
WilliamGunther> to pay a lot of money for it, especially since you
WilliamGunther> have Programing Perl already.

There are some who would disagree here. :)

Buy a copy of Learning Perl.  If it's the money you're concerned
about, borrow a copy, or buy a copy and resell it.  We worked hard to
design Learning Perl to be the best book to spend your first 30-40
hours while learning the language, no matter where you will be using
Perl eventually.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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



Re: Using variable to another script

2003-02-06 Thread Randal L. Schwartz
>>>>> "James" == James Kipp <[EMAIL PROTECTED]> writes:

James> or use a hidden param in a form:

James> print qq(
James>  http://yourhost/another.cgi";>
James>  
James>  
James>  
James> );

No, no, no.  You aren't encoding it properly.  THere's already stuff
in CGI.pm to do this for you properly.

param("username", $username);
print
  start_form("http://yourhost/another.cgi";),
  hidden("username"),
  submit,
  end_form;

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Naming a variable from value of a scalar.

2003-01-18 Thread Randal L. Schwartz
>>>>> "WilliamGunther" == WilliamGunther  <[EMAIL PROTECTED]> writes:

WilliamGunther> In a message dated 1/17/2003 6:04:41 PM Eastern Standard Time, 
WilliamGunther> [EMAIL PROTECTED] writes:


>> Is it possible to name a variable as the numeric value of a scalar?

WilliamGunther> Well, all scalar variables you create must start with a letter. But, 
if 
WilliamGunther> you're talking about something like this:
WilliamGunther> $var = "hello";
WilliamGunther> ${$var} = 1;
WilliamGunther> print $hello;

WilliamGunther> You can do it.

But you shouldn't.  Ever.  And "use strict" rightfully keeps you from
doing so.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: funny characters in form field

2003-01-11 Thread Randal L. Schwartz
>>>>> "Colin" == Colin Johnstone <[EMAIL PROTECTED]> writes:

Colin> Gidday all,
Colin> In my mailing list form I have a hidden field that stores the date the
Colin> subscriber subscribed.

Colin> When processing the form the date in this format 3/1/2003 is converted to
Colin> 3%2F1%2F2003.

Colin> Can someone give me a regex to convert it back again please. Im only new to
Colin> perl and am struggling with regex's

Don't use a regex.  If you use CGI.pm, you never have to think about
encoding or decoding *anything*.

during HTML generation:

param('my_hidden', '3/1/2003');
print hidden('my_hidden');

during CGI response:

my $input = param('my_hidden');

No mess, no stress.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: HTML in perl autoresponders

2003-01-06 Thread Randal L. Schwartz
>>>>> "Damian" == Damian Wader <[EMAIL PROTECTED]> writes:

Damian> I created an autoresponder with perl.

If you autorespond to me, you better darn well not send HTML, but just
plain text.  HTML email is evil.

Damian>  Click Here to view the code.

That doesn't work here.  This mailing list enforces plain text email,
so your HTML branch was stripped.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Running a Perl program countinuously

2002-11-16 Thread Randal L. Schwartz
>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> How can I make it to start automaticly after stopping?

while true
do perl-command-goes-here
done &

But why are you asking this in a CGI list?  This has nothing to do with CGI.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Calculate PI

2002-11-03 Thread Randal L. Schwartz
>>>>> "Sven" == Sven Bentlage <[EMAIL PROTECTED]> writes:

Sven> Hi everyone!
Sven> I am trying to write a program calculating pi.
Sven> The formula I would like to use is
Sven>   pi = 4x( (1/1) - (1/3) + (1/5) - (1/7) + (1/9) - (1/11)  )
Sven> or
Sven>   $pi = 4x ( (1/$y) - )

Beware that's a very very very very slow convergence.
There are many better formulas.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Looping

2002-10-13 Thread Randal L. Schwartz

>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> I've tried with:

Octavian> foreach my $email (keys %list{'list_number1'}) {
Octavian> 
Octavian> }

Nearly.  It's "keys %{$list{'list_number1'}}".

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: How to verify the email address?

2002-09-29 Thread Randal L. Schwartz

>>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:

Randal> The Windows program lies.

As proof, see if your "Windows program" can tell
which of the following addresses are valid or invalid:

[EMAIL PROTECTED]
fred&[EMAIL PROTECTED]

I bet it will give you the wrong answer. :)
(Hint: the first will bounce, the second will autorespond.  So only
the second is valid.)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: How to verify the email address?

2002-09-29 Thread Randal L. Schwartz

>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> I thought Perl could verify if an email address exists on a server, because
Octavian> I've seen a Windows program that does it.

The Windows program lies.  You cannot do it.  It doesn't matter what
programming language you use.  Thank the spammers for removing some of
the utility of the net, but there were also always addresses that
could not be verified.

Octavian> I can use that program for verifying the email addresses,

No.   You can't.  Not conclusively.


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: How to verify the email address?

2002-09-29 Thread Randal L. Schwartz

>>>>> "Wiggins" == Wiggins D'Anconia <[EMAIL PROTECTED]> writes:

Wiggins> You may also want to consider using the Email::Valid module.

Yeah, that's what the recent FAQ says.  My mail is typed on an openbsd
machine running 5.6.1, and it wasn't in there.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: How to verify the email address?

2002-09-28 Thread Randal L. Schwartz

>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> I've tried to verify if an email address exists using the
Octavian> Net::SMTP module but the result is always 1, doesn't matter
Octavian> if the address exists or not.

Right.  Get used to it.  Every gateway machine will have to say "yes".
(Such as "stonehenge.com"'s mail handler.)  And most other machines
are now saying "yes" to every "verify" (or "no", or "get lost")
because of spammers.  Sick, isn't it?

This is a FAQ, by the way.

$ perldoc -tq "valid mail"
Found in /usr/libdata/perl5/pod/perlfaq9.pod
  How do I check a valid mail address?
You can't, at least, not in real time. Bummer, eh?

Without sending mail to the address and seeing whether there's a
human on the other hand to answer you, you cannot determine
whether a mail address is valid. Even if you apply the mail
header standard, you can have problems, because there are
deliverable addresses that aren't RFC-822 (the mail header
standard) compliant, and addresses that aren't deliverable which
are compliant.

Many are tempted to try to eliminate many frequently-invalid
mail addresses with a simple regex, such as
"/^[\w.-]+\@(?:[\w-]+\.)+\w+$/". It's a very bad idea. However,
this also throws out many valid ones, and says nothing about
potential deliverability, so it is not suggested. Instead, see
http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/ckaddr
.gz, which actually checks against the full RFC spec (except for
nested comments), looks for addresses you may not wish to accept
mail to (say, Bill Clinton or your postmaster), and then makes
sure that the hostname given can be looked up in the DNS MX
records. It's not fast, but it works for what it tries to do.

Our best advice for verifying a person's mail address is to have
them enter their address twice, just as you normally do to
change a password. This usually weeds out typos. If both
versions match, send mail to that address with a personal
message that looks somewhat like:

Dear [EMAIL PROTECTED],

Please confirm the mail address you gave us Wed May  6 09:38:41
MDT 1998 by replying to this message.  Include the string
"Rumpelstiltskin" in that reply, but spelled in reverse; that is,
start with "Nik...".  Once this is done, your confirmed address will
be entered into our records.

If you get the message back and they've followed your
directions, you can be reasonably assured that it's real.

A related strategy that's less open to forgery is to give them a
PIN (personal ID number). Record the address and PIN (best that
it be a random one) for later processing. In the mail you send,
ask them to include the PIN in their reply. But if it bounces,
or the message is included via a ``vacation'' script, it'll be
    there anyway. So it's best to ask them to mail back a slight
alteration of the PIN, such as with the characters reversed, one
added or subtracted to each digit, etc.




-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Creating thumbnails (Newbie Question)...

2002-09-21 Thread Randal L. Schwartz

>>>>> "Joel" == Joel Hughes <[EMAIL PROTECTED]> writes:

Joel> After you have install image magick, the basic syntax is...


Joel>   use Image::Magick;
Joel>   $p = new Image::Magick;
Joel>   $p->Read(..your main image...);

Joel>   $p->Scale(width=>$required_width, height=> $required_height);

Joel>   $p->Write(..your scaled image...)

Joel> your only trickyish part is keeping the projection right when
Joel> you scale the image, however, for a start, the above code can
Joel> get you going.

No, it's not tricky.  Unless you work really hard at it, your image
is always scaled in proportion, such that the width and the height
fit a maximum of the sizes listed above.  It's just (dare I say) magic!

Let me illusrate:  if an image is 75x150, and you ask for a 25x25 version,
you get a 12x25 version, which is the same proportions, but both
numbers are smaller than 25.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Post to a second CGI script

2002-07-30 Thread Randal L. Schwartz

>>>>> "Jim" == Jim Lundeen <[EMAIL PROTECTED]> writes:

Jim> Ok, perhaps not the most eloquent of methods, but here's what I
Jim> did (putting my little knowledge of JavaScript to use!)...

If the answer is "javascript", you're not done yet.  Many corporate
firewalls filter javascript.  Many individual users have it turned off
for security and abuse reasons.

Javascript should never be used for essentials... only to enhance the
experience.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: question about cgi-lib.pl

2002-07-24 Thread Randal L. Schwartz

>>>>> "Michal" == Michal Simovic <[EMAIL PROTECTED]> writes:

Michal> I'd like to ask how to tell perl script to use
Michal> cgi-lib.pl and where cgi-lib.pl should be placed.

cgi-lib.pl can be found in /dev/null.

As in, don't use it.

If you have code that uses it, see "perldoc CGI" and look for the part
where it refers to cgi-lib compatibility.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Finding the country

2002-07-24 Thread Randal L. Schwartz

>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> Is it possible to find out the country of my web page
Octavian> visitors using a Perl script?

Octavian> I would like to find the IP address of the visitor ISP, or
Octavian> something else that can help me to find the country.

If you're just curious, yes.  You can get something that's right
about 75% of the time.

If you're using it to force the language of the page, no.  Use the
browser specification instead.

If you're using it to restrict distribution to certain countries, no.
Because it's wrong 25% of the time, and can also be easily spoofed.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Getting the real email address?

2002-05-10 Thread Randal L. Schwartz

>>>>> "Richard" == Richard Mr Usarec Buskirk <[EMAIL PROTECTED]> writes:

Richard> if(($_[0]=~/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/)||($_[0]!~/^.+\@(\[?)[a-zA-Z0-9
Richard> \-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)){

So wrong.  So Very Wrong.

Please ignore this wrong posting and read the rest of the repeated
answers in the thread.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: exec CGI versus include virtual

2002-04-06 Thread Randal L. Schwartz

>>>>> "Octavian" == Octavian Rasnita <[EMAIL PROTECTED]> writes:

Octavian> Do you know what is the difference between the SSI statements
Octavian> include virtual ... and the address to the CGI script and
Octavian> exec CGI ... and the address of the CGI script?

Yes, exec CGI is deprecated.  It permits only mod_cgi as a response.
You really want include virtual all the time.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: IP Address

2002-04-04 Thread Randal L. Schwartz

>>>>> "David" == David Gray <[EMAIL PROTECTED]> writes:

>> So again, I repeat:
>> 
>> A user is not an IP address
>> 
>> Get it through your head that using IP address for vote 
>> blockout is just ... WRONG.

David> Message received, ZERO distortion. Are you saying, then, that it's
David> impossible to build an accessible cgi-based voting system (which allows
David> more than one user to access the system from within a large network)
David> without using cookies or forcing each user to log in?

Yes.  Good that you *finally* got that.  {sigh}

But even using cookies is no guarantee that one vote will be given.
I can erase cookies.

And the "XP" system of Perlmonks.org shows that users can and will
create dopplegangers just to vote multiple times.

Voting on the net is always a joke.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: IP Address

2002-04-04 Thread Randal L. Schwartz

>>>>> "Rafael" == Rafael Cotta <[EMAIL PROTECTED]> writes:

Rafael> Ok, good point, but my IP address approach will be enough,
Rafael> once my system doensn't need to be very accurate.

Except that it will be frustrating to the second employee at
motorola.com who wants to vote after the first one has already done
so.  Do you really want to frustrate millions of people?

IT DOESN'T WORK.
DON'T EVEN TRY IT.

{sigh}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: IP Address

2002-04-04 Thread Randal L. Schwartz

>>>>> "David" == David Gray <[EMAIL PROTECTED]> writes:

>> How do I get the IP address from a POST form.
>> 
>> Let me make myself more clear: I have a form that uses POST, 
>> and I would like to get users' IP address for avoiding the 
>> same user to fake my pool's result.

David> You can check $ENV{REMOTE_ADDR}, which will contain the remote IP of the
David> user hitting your page.

And that's still insufficient and incorrect.

Repeat after me:

A user is not an IP address
A user is not an IP address
A user is not an IP address

Specifically, the largest userbase on the planet, AOL, comes into the
Internet proper via Web Proxies.  On every hit, a different proxy is
used, so these hits show up as coming from completely different
addresses.  Even the main page and the image fetches for that page
will all show up as different addresses.  And then of course,
those same small-number-of-proxies are used for millions of users.

So again, I repeat:

A user is not an IP address

Get it through your head that using IP address for vote blockout
is just ... WRONG.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Re :Camel Book

2002-03-21 Thread Randal L. Schwartz

>>>>> "Sunish" == Sunish Kapoor <[EMAIL PROTECTED]> writes:

Sunish> Want an HTML version of Programming Perl  Second version (Free) .

I would certainly hope that you are not serious.  If you are, you'll
be reported to O'Reilly's enforcement division.

Pirating is no joke.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: existing username

2002-03-21 Thread Randal L. Schwartz

>>>>> "Matthew" == Matthew Harrison <[EMAIL PROTECTED]> writes:

Matthew> how can i make a script check whether a variable equals an existing system 
Matthew> username or not? the script does not run as root, it is a webpage.

if (defined getpwname($possible_new_name)) {
  # it already exists
} else {
  # it's new!
}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




  1   2   >