[11699] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5299 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 5 09:06:26 1999

Date: Mon, 5 Apr 99 06:00:15 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 5 Apr 1999     Volume: 8 Number: 5299

Today's topics:
    Re: (newbie) matching value from array??? (Jerry)
        Can some one debug this perl - I need help <michael.tickle@stud.umist.ac.uk>
        Cgi Communication with Layers? <tazmen@primary.net>
    Re: Dump All Variables? <revjack@radix.net>
        How to print n times a character? <fabascal@gredos.cnb.uam.es>
    Re: How to print n times a character? (Sam Holden)
        Installed Perl 5.005_02, what are the paths? <webmaster@webknights.com>
        minimal pattern matching sstarre@my-dejanews.com
    Re: minimal pattern matching (Sam Holden)
        Pop server (CGI-Perl) (miedo)
    Re: Premature end of script headers <webmaster@webknights.com>
        Redirection help. (V)
        WWW::Search problem pmwhelan@my-dejanews.com
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 05 Apr 1999 09:11:15 GMT
From: preeper@cts.com (Jerry)
Subject: Re: (newbie) matching value from array???
Message-Id: <370867f6.590799@news2.cts.com>

I think I'm getting a little closer, but not quite there yet.
Assuming my variables that I want to match are $home and $away in the
loop that prints the results (this part works fine).  Now I add the
new query to get the urls from the teams table - this is added before
the loop printing these results, since I'm pretty sure I will only
need to do this query once and then keep reusing the data throughout
the loop.  The query to get the team names and url's is:

  $sql_query = "select city,short_name,full_name,url_link ";
  $sql_query .= "from $linktable";
  $sql_result = $dbh->Query($sql_query);
  while (@keys = $sql_result->FetchRow()) {
    $link_city = $keys[0];
    $link_short_name = $keys[1];
    $link_full_name = $keys[2];
    $url_link = $keys[3];
    }

I followed this with a sql query to get a count of the number of teams
in this league, like this:

  $sql_query = "select count(*) from $linktable";
  $sql_result = $dbh->Query($sql_query);
  while (@row = $sql_result->FetchRow()) {
  $team_count = $row[0];
  }

Now right after I start the loop to fetch each row of game scores and
assign all the data items in the row to a variable name, I have added:

      for $i (0 .. $team_count) {
      if ($link_city{$i} == $away) {
        $away_link = $url_link{$i};
     } else {$i++}
     }
     }

But it doesn't ever seem to match and nothing ever gets printed for
the link.

Jerry




>Larry Rosler <lr@hpl.hp.com> wrote:
>
>> In article <qc18e7.g1p.ln@magna.metronet.com> on Sun, 4 Apr 1999 
>> 11:44:26 -0400, Tad McClellan <tadmc@metronet.com> says...
>> > Jerry (preeper@cts.com) wrote:
>> ...
>> > :   $sql_query = "select city,short_name,full_name,url_link ";
>> > :   $sql_query .= "from $linktable";
>> > :   $sql_result = $dbh->Query($sql_query);
>> > :   while (@row = $sql_result->FetchRow()) {
>> > :     $link_city = $row[0];
>> > :     $link_short_name = $row[1];
>> > :     $link_full_name = $row[2];
>> > :     $url_link = $row[3];
>> > :     }
>> > 
>> > 
>> >    That is a cumbersome way to load up your variables.
>> > 
>> >    You can shorten the body of the while loop to a single line:
>> > 
>> >       ($link_city, $link_short_name, $link_full_name, $url_link) = @row;
>> 
>> Which overwrites those variables each time through the loop, so their
>> values on loop exit are those of the last iteration.  That *may* be what
>> is wanted, but I doubt it.
>
>Well, it's no different from what the original code did, anyway...
>I'd guess that the original poster is asking for code that will complete
>the body of that while loop.  I didn't have any better luck than Tad at
>understanding the question, though.
>
>
>-- 
> _ / '  _      /       - aka -
>( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
>    /                                http://www.tiac.net/users/chipmunk/
>        "It's funny 'cause it's true ... and vice versa."



------------------------------

Date: Mon, 05 Apr 1999 12:27:07 +0100
From: Mike Tickle <michael.tickle@stud.umist.ac.uk>
Subject: Can some one debug this perl - I need help
Message-Id: <37089E0B.8194A6D@stud.umist.ac.uk>

 I have downloaded form-mail.pl from demon, which emails the contents of
a
 form to a set email address.
 I have got the form to work in as much as it sends the email, but it
does
 not send the info from the form.  There is a radio button in the form -

the
 result from that is sent, but nothing else - just blank space.
 Snippets from the page code and the perl code are below.
 The page was originally written in FrontPage but I have had to edit it
due
 to problems (easyspace <the web host> claims to have frontpage support,

but
 does not - FrontPage extensions on there server do not work).
 Please help me!

 the perl is

 # Get the input
 read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

 # Split the name-value pairs
 @pairs = split(/&/, $buffer);

 foreach $pair (@pairs)
  .
     ($name, $value) = split(/=/, $pair);

     # Un-Webify plus signs and %-encoding
     $value =~ tr/+/ /;
     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

     # Stop people from using subshells to execute commands
     # Not a big deal when using sendmail, but very important
     # when using UCB mail (aka mailx).
     # $value =~ s/~!/ ~!/g;

     # Uncomment for debugging purposes
     # print "Setting $name to $value<P>";

     $FORM{$name} = $value;
  .

 # If the comments are blank, then give a "blank form" response
 # &blank_response unless $FORM{'comments'};

 # Now send mail to $recipient

 open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
 print MAIL "Reply-to: $FORM{'username'} ($FORM{'realname'})\n";
 print MAIL "Subject: WWW comments (Forms submission)\n\n";
 print MAIL "$FORM{'username'} ($FORM{'realname'}) sent the
following\n";
 print MAIL "enquiry for your urgent attention\n\n";
 print MAIL
 "------------------------------------------------------------\n";
 print MAIL "Sign Type: $FORM{'R1'}\n";
 print MAIL "Sign Size: $FORM{'sign_size'}\n";
 print MAIL "Quantity :  $FORM{'quantity'}\n";
 print MAIL "Required text as follows\n";
 print MAIL "$FORM{'comments'}";
 print MAIL
 "\n------------------------------------------------------------\n";
 print MAIL "Contact Details\n";
 print MAIL "$FORM{'realname'}\n";
 print MAIL "$FORM{'company'}\n";
 print MAIL "$FORM{'address'}\n";
 print MAIL "$FORM{'address_line2'}\n";
 print MAIL "$FORM{'address_line3'}\n";
 print MAIL "$FORM{'telephone'}\n";
 print MAIL "$FORM{'fax'}\n";
 print MAIL
 "\n------------------------------------------------------------\n";
 print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n";
 print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
 print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
 close (MAIL);

 from the page

 <form method="POST" name="Enquiry Form"
 action="cgi-bin/www.rockoil.co.uk/form-mail.pl"><p>
 <table border="0" width="100%" height="225">
     <tr>
       <td width="33%" height="24"></td>
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" value="shop_fascia" name="R1"></td>
       <td width="62%" height="24"><h3><font color="#0000A0">Shop
 Fascia</font></h3>
      </td>
     </tr>
     <tr>
       <td width="33%" rowspan="6" height="165"><div
 align="center"><center><p><font face="AvantGarde Md BT"
 color="#0000A0">Please </font><font face="AvantGarde Md BT"
 color="#FF0000">&nbsp; </font><img src="images/checker_ani.gif"
 alt="checker_ani.gif (920 bytes)" WIDTH="32" HEIGHT="32"></td>
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" name="R1" value="pavement_sign"></td>
       <td width="62%" align="center" height="24"><div
ign="left"><h3><font
 color="#0000A0">Pavement
       Sign</font></h3>
       </div></td>
     </tr>
     <tr align="center">
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" name="R1" value="factory_unit"></td>
       <td width="62%" height="24"><div align="left"><h3><font
 color="#0000A0">Factory Unit</font></h3>
       </div></td>
     </tr>
     <tr align="center">
       <td width="5%" align="center" valign="top" height="25"><input
 type="radio" name="R1" value="vehicle_graphics"></td>
       <td width="62%" height="25"><div align="left"><h3><font
 color="#0000A0">Vehicle Graphics</font></h3>
       </div></td>
     </tr>
     <tr align="center">
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" name="R1" value="banner"></td>
       <td width="62%" height="24"><div align="left"><h3><font
 color="#0000A0">Banner</font></h3>
       </div></td>
     </tr>
     <tr align="center">
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" name="R1" value="magnetic"></td>
       <td width="62%" height="24"><div align="left"><h3><font
 color="#0000A0">Magnetic</font></h3>
       </div></td>
     </tr>
     <tr align="center">
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" name="R1" value="builders_site_board"></td>
       <td width="62%" height="24"><div align="left"><h3><font
 color="#0000A0">Builders Site
       Board</font></h3>
       </div></td>
     </tr>
     <tr align="center">
       <td width="33%" height="24"></td>
       <td width="5%" align="center" valign="top" height="24"><input
 type="radio" name="R1" value="exhibition"></td>
       <td width="62%" height="24"><div align="left"><h3><font
 color="#0000A0">Exhibition</font></h3>
       </div></td>
     </tr>
   </table>
   <div align="center"><center><h3><font color="#0000A0">Sign Size or
Vehicle
 Type <input type="text" name="sign_size" size="42"></font></h3>
   </center></div><div align="center"><center><h3><font
 color="#0000A0">Quantity


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbs
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   &nbsp; </font><input type="text" name="quantity" size="42"></h3>
   </center></div><div align="center"><center><h3><font
color="#0000A0">Text
 Required </font></h3>
   </center></div><div align="center"><center><p><font
 color="#0000A0">(Please also fax
   letter head or logo if relevant)</font></p>
   </center></div><blockquote>
     <p><textarea name="comments" rows="10" cols="59"></textarea> </p>
   </blockquote>
   <div align="center"><center><h3><font color="#0000A0">Contact
 Information</font></h3>
   </center></div><div align="center"><center><table
bordercolor="#FF0000"
 bordercolorlight="#FF0000" bordercolordark="#FF0000">
     <tr>
       <td align="center"><div align="center"><center><p><font
 color="#0000A0"><em>Name</em></font></td>
       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000" align="center"><input
 name="realname" value size="35"></td>
     </tr>
     <tr align="center">
       <td align="center"><font
color="#0000A0"><em>Company</em></font></td>
       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="company" value

 size="35"></td>
     </tr>
     <tr align="center">
       <td align="center"><font
color="#0000A0"><em>Address</em></font></td>
       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="address" value

 size="35"></td>
     </tr>
     <tr align="center">
       <td align="center"><font
color="#0000A0"><em>City</em></font></td>
       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="address_line2"

 value size="35"></td>
     </tr>
     <tr align="center">
       <td align="center"><font color="#0000A0"><em>Post
 Code</em></font></td>
       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="address_line3"

 value size="35"></td>
     </tr>
     <tr align="center">
       <td align="center"><font
 color="#0000A0"><em>Telephone</em></font></td>
       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="telephone"
value
 size="35"></td>
    </tr>
     <tr align="center">
       <td align="center"><font color="#0000A0"><em>FAX</em></font></td>

       <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="fax" value
 size="35"></td>
     </tr>
     <tr align="center">
       <td align="center"><font
color="#0000A0"><em>E-mail</em></font></td>
      <td bordercolor="#FF0000" bordercolorlight="#FF0000"
 bordercolordark="#FF0000" bgcolor="#FF0000"><input name="username"
value
 size="35"></td>
     </tr>
   </table>
   </center></div><div align="center"><center><p><input type="submit"
 value="Send"> <input type="reset" value="Clear Form"> </p>
   </center></div>
 </form>

 and the email ganerated when all fields on the page have something
typed
in
 to them is

 () sent the following
 enquiry for your urgent attention

 ------------------------------------------------------------
> Sign Type: Banner
> Sign Size:
> Quantity :
> Required text as follows
>
> ------------------------------------------------------------
> Contact Details
>
>
>
>
>
>
>
>
> ------------------------------------------------------------
> Server protocol: HTTP/1.0
> Remote host: coriander.wwwcache.ja.net
> Remote IP address: 194.83.240.21
>
>
>
> I know it is a long post, but I am desperate for help.
>
> Thanks for any help (preferable also sent to me as an email as I might
not be able to get to the news for a week or two)
>
>
> Mike Tickle



------------------------------

Date: Mon, 05 Apr 1999 03:02:57 -0500
From: William Tammen <tazmen@primary.net>
Subject: Cgi Communication with Layers?
Message-Id: <37086E31.97236555@primary.net>


First of all,
I do not want free programming, I would love to hear from anyone who
gets this working and would like to at least steer me on the correct
path to solving the problem.  I do believe getting a good reliable way
of communicating with cgi programs in a dynamic html environment is very
important in achieving powerful dynamic sites and therefore makes this a
worth while endeavor. 

If you can get this to work and do not wish to share free of charge then
by all means email me with details on selling me the code.  I would be
interested in paying for the code if that is what it takes. 

Converting and revising post in text base for those stuck in the past,
html posts are much better, but I need help and tire of the useless
responses I have been getting, no html, your post title is vague, you
want help for free or free coding.  It is amazing the time people will
spend preaching on this news group as opposed to asking and or answering
questions.

Now my post: 

  My question is with respect to html forms and duplication of the
process which takes place as the browser submits the form.  The html
form action attribute provides path to the cgi program which can contain
queries. The post method has the ability to send large amounts of text
area data without limitations and is considered more secure than the get
method.  So I want to you post in a link, and that is not possible as
far as I know. When a form is submitted it url encodes the form data and
calls the cgi via the action attribute information and in a separate
exchange with the cgi it sends the url encoded data to the cgi's stdin. 
This allows ones cgi to test for a query and branch to the subroutine
required and that subroutine will then get its data from the stdin which
was fed during the call to the cgi.  This allows for easy
multifunctional perl scripts. Now that is all just how I see it, perhaps
not how it really is, I am very new to all this. The post method is not
available outside the form with respect to using it in a link.  There is
the javascript function of submit which can be used in a link but it is
merely a remote control to the forms submit which does not work due to
its use of the action attribute.  My hypothetical link at this point
needs to take place of the action attribute and needs to invoke the
submitting of the data using the post method or by mimicking the post
method, so that the cgi does not know the difference.

This being said as best I can describe it, this is my url now with out
sending the form data with it:
<A HREF="javascript://"
onClick="results.load('../cgi-bin/forum/forum.pl?preview');return
false">Submit</A>

Now see how the url is passed to the object results load function, this
contains communication with the cgi allowing results.load to capture it
into a buffer where it can be cross browser transferred to a div tag
layer.

Now right now this works in that the response comes back in control and
is loaded into the div, but since stdin is empty it has no data in the
response, and well of course, I'm just trying to spell it out a bit, it
is hard to explain.

So this takes me to the url, it would be great if it would work to do
something like ?preview&submit(this.form) but that is obviously not
possible but it puts what I want and need into perspective.

Even if you could write the url in that way it would invoke the action
attribute's path to the cgi and that would steal control from the
results object. The cgi would send its response back like a link being
clicked with _top as its target.

Ok back to get and queries, well ok if I send the name value pairs as
queries and for text areas I pass the string in an array named like
$messagetext than that could theoretically work using cgi.pm  I can't
totally grasp it but it looks like rewriting the entire perl script, and
that is fine if I can some day pull it off but would mean reinventing
the wheel. No buying a complex shopping cart script and converting a few
things to get it to work but writing my own.  Now imagine rewriting
every script you use, the ones you did yourself as well as all the
public domain scripts you have accumulated to do all those seemingly
endless list of tricks and chores cgi provides to make web design
easier.  If that's what it takes fine, I and others will do it, if and
when we figure out how to do it.


The fact is this is not so strange of project, perl has the ability to
target frame windows for the vary purpose I am working on getting this
to work.  The loading of the response replacing the frame page defeats
the purpose of having a framed page.  So will they fix this in future
versions of perl with html4 functions, well I  think so but look how
long it took to get html3 functionality.

Besides I think a solution for this problem is possible with the current
tools available.  Dan Stienman already has it working very well with a
simple form showing it's default view in the layer and then it's
response in the layer. The example is a form using a radio selection
form.  This makes using check boxes, drop down options menus, and text
boxes all easily implemented as well.  That only leaves solving the text
area data. Please take the time to at least go check out the second link
to the cgi communication section, it is cross browser for 4.0 browsers
and IE5.  Think what this could mean for perl and web design.  


  The url to his main page is as follows:
  http://www.dansteinman.com/dynduo/ 

  and the url to the cgi communication  is as follows
  http://www.dansteinman.com/dynduo/cgicomm/cgicomm.html 

   Thanks in advance  Bill 

end of post:
 .
 .
 .



 .
 .



 .











 .

All replies so far to previous posts have been just useless opinions,
here are my opinions in response:


1) If you have no idea how to answer someone's question than do not
   respond!
2) If you do not feel the subject of their questions is good enough to
   deserve a response, so what, skip it, don't read it, go on
   with your life. The person posting the question needs help and does
   not want to hear from you or your opinions, they just want and need
   an answer.
3) If someone posts using technology you are unable to view or accept,
   than skip it, do not read it, do not communicate with
   them on how you feel they should post, people do not want your
   opinions, they need answers, not your rude comments.
4) If someone's question is to vague, than you have two choices, one
   being to skip it, and go on with your life, or two being to
   politely inquire for more information in case you truly want to
   help.
5) If you do not want to help people for free or feel that a post is
   asking you to do all the work for them or code for free and
   you do not wish to work for free, than skip it.  They do not want to
   hear from you. You need to ask yourself, why you are
   reading questions you have no desire to answer for free.
6) If you often post questions you should give back and actually help
   others with questions you can help with.
7) If the question is off topic for the news group just ignore it, if
you
   don't want to answer off topic posts than don't, just don't respond
at
   all.

Ok Yeah flame bait fine, I can flame with the best of them, the fact is 
if you read my suggestions and you got mad it is because you know I am 
right.  The fact is I did not post a response to any question on this 
news group offering any of my visions of proper news group behavior, it
you are mad, it is because you probably do reply to posts with your
unwanted opinions.

It all comes down to politeness... ask, answer, read to learn, or leave.


Hopefully I have not offended anyone, that is not my intention.

Thanks again.


------------------------------

Date: 5 Apr 1999 10:39:24 GMT
From: Shari Callaghan <revjack@radix.net>
Subject: Re: Dump All Variables?
Message-Id: <7ea3ss$60a$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Zenin explains it all:
:Turin Waterbury <revjack@radix.net> wrote:
:: Is there an elegant way to get perl to somehow report the values of
:: *all* variables in memory, including vars like $$, $_, $|, and variables
:: created by the script, like $foo etc?

:	See the "V" and "X" commands of the debugger (perldoc perldebug). 
:	Infact, see the debugger in general.

I was hoping to avoid the debugger. Any other way?


-- 
  /~\  alley cater inhibit pyre analeptic typesetter cathode himself h
 C oo  primary beef inhalation testes Albrecht friar quartile intellig
 _( ^) 1 , 0 0 0 , 0 0 0   m o n k e y s   c a n ' t   b e   w r o n g
/___~\ http://3509641275/~revjack  04/05/99 06:39:33 revjack@radix.net


------------------------------

Date: Mon, 05 Apr 1999 12:59:23 +0200
From: Federico Abascal <fabascal@gredos.cnb.uam.es>
Subject: How to print n times a character?
Message-Id: <3708978B.51DB4126@gredos.cnb.uam.es>

Please I don't remember how to do it and where I saw how it has to be
done?
Can you help me?
Thanks, Fede



------------------------------

Date: 5 Apr 1999 11:22:21 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: How to print n times a character?
Message-Id: <slrn7gh77d.6lv.sholden@pgrad.cs.usyd.edu.au>

Federico Abascal <fabascal@gredos.cnb.uam.es> wrote:
>Please I don't remember how to do it and where I saw how it has to be
>done?

print "n times a character";
print $character for (1..$n);
for($i=$n;$i<2*$n;$i++) {print $character}
for($_='q'x$n;/q/g;) {print $character} 

You might also want to read the perlop documentation (particularly the
information about the 'x' operator)...

-- 
Sam

You can blame it all on the internet. I do...
	--Larry Wall


------------------------------

Date: Sun, 04 Apr 1999 18:32:44 +0000
From: "WebMaster of WebKnights.com" <webmaster@webknights.com>
Subject: Installed Perl 5.005_02, what are the paths?
Message-Id: <3707B04C.9887C6C5@webknights.com>

Hello! I installed Perl 5.005 and I don't have any clue what the paths
are. I installed Perl into C:\Perl if that helps. I need to know all of
the most commonly used paths, pleeeease. Also, when I run a Perl script
using my webserver (MS WebServer, which is running on my local hard
drive, not on the web), but the browser doesnt seem to want to run it.
It wants to download it! Please help!

Please send replies to: webmaster@webknights.com

--
-Defiant
webmaster@webknights.com
http://www.webknights.com/


------------------------------

Date: Mon, 05 Apr 1999 12:13:00 GMT
From: sstarre@my-dejanews.com
Subject: minimal pattern matching
Message-Id: <7ea9c9$ht5$1@nnrp1.dejanews.com>



Methinks that s/// needs another switch. I'm trying to locate all instances of
strings surrounded by a delimiter in a string, such as

  $petnames{cat}='morris';
  $petnames{dog}='fido';
  $_=':cat: is a good pet, but :dog: is better.';
  s/\:(.*)\:/$petnames{$1}/g;

(results in "is better.")

This work great on one instance on the line, but in this case it seems to find
  ":cat: is a good pet, but :dog:"
as $1 since matching is greedy.

I studied switches in pp 7x in Camel, and none seem to direct Perl to match
minimally. Are there a set of switches that I can use to direct the match to
operate minimally, as many times as possible in the line?

Thank-You.
-S

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 5 Apr 1999 12:35:25 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: minimal pattern matching
Message-Id: <slrn7ghbgd.7mp.sholden@pgrad.cs.usyd.edu.au>

On Mon, 05 Apr 1999 12:13:00 GMT, sstarre@my-dejanews.com wrote:
>
>
>Methinks that s/// needs another switch. I'm trying to locate all instances of
>strings surrounded by a delimiter in a string, such as
>
>  $petnames{cat}='morris';
>  $petnames{dog}='fido';
>  $_=':cat: is a good pet, but :dog: is better.';
>  s/\:(.*)\:/$petnames{$1}/g;
>
>(results in "is better.")
>
>This work great on one instance on the line, but in this case it seems to find
>  ":cat: is a good pet, but :dog:"
>as $1 since matching is greedy.
>
>I studied switches in pp 7x in Camel, and none seem to direct Perl to match
>minimally. Are there a set of switches that I can use to direct the match to
>operate minimally, as many times as possible in the line?

You could try reading the documentation on regexes that comes with perl
'perldoc perlre'.

You could also try reading the FAQ...

perlfaq6 : What does it mean that regexps are greedy?  How can I get around it?

You could also tryturning back a few pages in that Camel book, page 63 has
a table that might be useful...

You could also try looking up 'minimal' in the index of that Camel book.

You will probably find, however, that in your case a negated character class
will be the simplest solution...

Is there any reason you couldn't have tried any of those options before
posting here. It only took me two minutes, hope posting was worth the wait...

-- 
Sam

compiling kernels is what I do most, so they do tend to stick to the
cache ;)	--Linus Torvalds


------------------------------

Date: Sun, 04 Apr 1999 19:02:02 GMT
From: latorre69@arrakis.es (miedo)
Subject: Pop server (CGI-Perl)
Message-Id: <37089d83@news.arrakis.es>

How I can manipulate a pop server using Perl?
I know how to get pages in the web by Perl, and I think it is similar,
I try to change the port to 110 but it don't works.
I want to know the commands to connect to the pop server and give and
get text from it. I know the basic commands to get, delete messages
throught FTP...

Thanks, please reply me to latorre69@arrakis.es




------------------------------

Date: Sun, 04 Apr 1999 17:44:18 +0000
From: "WebMaster of WebKnights.com" <webmaster@webknights.com>
Subject: Re: Premature end of script headers
Message-Id: <3707A4F1.FC0EB236@webknights.com>


--------------D141E22B978FFB3E0437718D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


    I seem to get that error ALOT also. I haven't been able to figure out what is
wrong, and I got sooooo mad, I just gave up for awhile. Now, I'm back, and still
getting the problem. Anyway, if you find out what went wrong, tell me!!! Also, I
noticed that you are possibly trying to use a custom error message script. I got
the same ending to the error- "Additionally, a 404 Not Found error was encountered
while trying to use an ErrorDocument to handle the request." when I tried to put
up one of those. I just keeped trying...and trying...and trying (remind you of the
pink bunny?) untill I got it to work. Funny thing is, I didn't change a thing each
time I tried. If you aren't trying to setup a custom error script, than forget all
of what I just typed.

-Defiant
webmaster@webknights.com
http://www.webknights.com/
"Don't dream, it's over."

solidice@my-dejanews.com wrote:

> I'm trying to get this guestbook CGI script to work. I've put the script in
> it's own directory called guestbook along with the .htm files and images.
> I've chmod 755 guest.cgi the script. Then went to the add.htm so I could see
> if it would work. I get a 500 Internal Server Error saying this
>
> Internal Server Error
>
> The server encountered an internal error or misconfiguration and was unable to
> complete your request.
>
> Please contact the server administrator, electron@electronicparty.com and
> inform them of the time the error occurred, and anything you might have done
> that may have caused the error.
>
> Premature end of script headers:
> /home/electron/public_html/guestbook/guest.cgi
>
> Additionally, a 404 Not Found error was encountered while trying to use an
> ErrorDocument to handle the request.
>
> Apache/1.3.3 Server at www.electronicparty.com Port 80
>
> I telnet to my server and do perl -c guest.cgi and get guest.cgi syntax ok
> Also print "Content-type: text/html\n\n"; is already in the guest.cgi script
>
> So if anyone can give me some ideas. I'd appreciate it. I have no clue what
> I'm really doing.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

--
-Defiant
webmaster@webknights.com
http://www.webknights.com/


--------------D141E22B978FFB3E0437718D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body text="#000000" bgcolor="#FFFFCC" link="#5B060C" vlink="#5B060C" alink="#5B060C">
&nbsp;
<br>&nbsp;&nbsp;&nbsp; I seem to get that error ALOT also. I haven't been
able to figure out what is wrong, and I got sooooo mad, I just gave up
for awhile. Now, I'm back, and still getting the problem. Anyway, if you
find out what went wrong, tell me!!! Also, I noticed that you are possibly
trying to use a custom error message script. I got the same ending to the
error- "Additionally, a 404 Not Found error was encountered while trying
to use an ErrorDocument to handle the request." when I tried to put up
one of those. I just keeped trying...and trying...and trying (remind you
of the pink bunny?) untill I got it to work. Funny thing is, I didn't change
a thing each time I tried. If you aren't trying to setup a custom error
script, than forget all of what I just typed.
<p>-Defiant
<br><a href="mailto:webmaster@webknights.com">webmaster@webknights.com</a>
<br><a href="http://www.webknights.com/">http://www.webknights.com/</a>
<br>"Don't dream, it's over."
<p>solidice@my-dejanews.com wrote:
<blockquote TYPE=CITE>I'm trying to get this guestbook CGI script to work.
I've put the script in
<br>it's own directory called guestbook along with the .htm files and images.
<br>I've chmod 755 guest.cgi the script. Then went to the add.htm so I
could see
<br>if it would work. I get a 500 Internal Server Error saying this
<p>Internal Server Error
<p>The server encountered an internal error or misconfiguration and was
unable to
<br>complete your request.
<p>Please contact the server administrator, electron@electronicparty.com
and
<br>inform them of the time the error occurred, and anything you might
have done
<br>that may have caused the error.
<p>Premature end of script headers:
<br>/home/electron/public_html/guestbook/guest.cgi
<p>Additionally, a 404 Not Found error was encountered while trying to
use an
<br>ErrorDocument to handle the request.
<p>Apache/1.3.3 Server at www.electronicparty.com Port 80
<p>I telnet to my server and do perl -c guest.cgi and get guest.cgi syntax
ok
<br>Also print "Content-type: text/html\n\n"; is already in the guest.cgi
script
<p>So if anyone can give me some ideas. I'd appreciate it. I have no clue
what
<br>I'm really doing.
<p>-----------== Posted via Deja News, The Discussion Network ==----------
<br><a href="http://www.dejanews.com/">http://www.dejanews.com/</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Search, Read, Discuss, or Start Your Own</blockquote>

<p>--
<br>-Defiant
<br>webmaster@webknights.com
<br><A HREF="http://www.webknights.com/">http://www.webknights.com/</A>
<br>&nbsp;
</body>
</html>

--------------D141E22B978FFB3E0437718D--



------------------------------

Date: Sun, 04 Apr 1999 21:51:29 GMT
From:  (V)
Subject: Redirection help.
Message-Id: <3707dd6f.3133385@news.atl.mediaone.net>

#!c:\Progra~1\sambar42\perl\perl.exe



require "cgi-lib.pl";
&ReadParse(*form_data);
$url = "https://Randomsite/cgi-bin/RandomProgram.dll?RequestType";



   $Test= "Location: $url\n\n";

	
	print $Test;


# Need to call a RequestType with "?" but how to pass 
# "$form_data" along with it in the POST format.
# I am redirecting, but sending along the info passed
# from the original HTML form, recieved in the POST format.
# Thanks for any help. (Yes, I am new to PERL.)


------------------------------

Date: Mon, 05 Apr 1999 09:15:27 GMT
From: pmwhelan@my-dejanews.com
Subject: WWW::Search problem
Message-Id: <7e9uvb$a5i$1@nnrp1.dejanews.com>

i found this code in a previous post for how to use
WWW::Search

my $query = param('query');

 print header,start_html("Search results for $query");

 my($search) = new WWW::Search('AltaVista');
 $search->native_query(WWW::Search::escape_query($query));
 my($result);
 print "<UL>\n";
 while ($result = $search->next_result()) {
    print "<LI>\n",$result->url, "</LI>\n";
 };


but when i call it in unix i get nothing!!!

csh> perl -w wic5.cgi query=foo
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><TITLE>Search results for foo</TITLE>
</HEAD><BODY><UL>
</UL>
</BODY></HTML>csh>

does anyone know why this is so?
thanks
paul whelan
pmwhelan@alf2.tcd.ie
 print "</UL>\n",end_html;

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5299
**************************************

home help back first fref pref prev next nref lref last post