[18134] in Perl-Users-Digest
Perl-Users Digest, Issue: 302 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 16 14:06:06 2001
Date: Fri, 16 Feb 2001 11:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982350311-v10-i302@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 16 Feb 2001 Volume: 10 Number: 302
Today's topics:
Re: \G not following pos <stephen@twocats.dont-spam.demon.co.uk>
DBI mysql setup question <todda@xmission.com>
free cgi's ? <nowayandnohow@hotmail.com>
ioctl problem <tom.kralidis@ccrs.nrcan.gcDOTca>
Re: Make a bitmap capture of a web page (Craig Berry)
Multi-dimensioned arrays <stephen@cad.strath.ac.uk>
Re: Multi-dimensioned arrays <bmb@ginger.libs.uga.edu>
Re: Multi-dimensioned arrays <dontspamthewebmaster@webdragon.net>
Re: Multi-dimensioned arrays nobull@mail.com
Re: Multi-dimensioned arrays <bmb@ginger.libs.uga.edu>
Re: Multi-dimensioned arrays <uri@sysarch.com>
Re: Multi-dimensioned arrays (Craig Berry)
Re: Newbie needs help with form <perldomo@hotmail.com>
Re: Newbie needs help with form <uri@sysarch.com>
Re: Newbie needs help with form <perldomo@hotmail.com>
Re: Newbie needs help with form <revjack@revjack.net>
Re: perl 4 question <dougd@shieldsbag.com>
Perl 5 and graphics <perldomo@hotmail.com>
Perl and #include <no@email.com>
Re: Perl and #include (Anno Siegel)
Re: Perl and #include <dontspamthewebmaster@webdragon.net>
Re: replying to the Perl FAQ (was Stripping blank space <joe+usenet@sunstarsys.com>
Re: Stop writing CGIs (SPAM) 23 Questions <nowayandnohow@hotmail.com>
striping HTML <no@email.com>
Re: striping HTML <dontspamthewebmaster@webdragon.net>
Re: striping HTML nobull@mail.com
Re: striping HTML <sorryno@email.at.all>
Re: three-part form submission using CGI.pm (by way of "Scott R. Godin" <dontspamthewebmaster@webdragon.net>)
Re: three-part form submission using CGI.pm <godzilla@stomp.stomp.tokyo>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Feb 2001 16:07:53 -0000
From: "Stephen Collyer" <stephen@twocats.dont-spam.demon.co.uk>
Subject: Re: \G not following pos
Message-Id: <982339792.27374.0.nnrp-08.9e98901a@news.demon.co.uk>
> According to perlre \G ... works only with /g. There are some
> examples in perlop (search for \G).
You're right. In which case, both the Camel book 2e and 3e
are wrong, as neither point this out. (Neither does "Mastering
Regular Expressions") There's an example of \G on page 182
of the Camel book 3e without \G and that doesn't work with Perl
5.005_03 without the /g. (and it seems to loop forever with the /g
too. Hmm.) Did this change in Perl 5.6 ?
> Is there some reason for not just doing something like:
>
> while ($text =~ /animal:\s*(\w+)/g)
> {
> print "animal: at ", pos($text)-length('animal: '), ": $1\n";
> }
>
> Or are you just playing around to see how things work?
It's not real code - just an example for a course. Just as well
I test all my examples :-)
I've got a feeling I ran into and solved this problem ages ago
but as I use \G so infrequently I seem to have forgotten the
details.
Thanks
Steve Collyer
Netspinner Ltd
------------------------------
Date: Fri, 16 Feb 2001 18:47:18 GMT
From: Todd Ahlstrom <todda@xmission.com>
Subject: DBI mysql setup question
Message-Id: <3A8D75CE.42FC772C@xmission.com>
I recently installed DBI module and the Mysql drivers. My Apache
webserver gives me the error "can't connect through /tmp/mysql.sock" I
can see why not, mysql.sock doesn't exist in this directory. It's
located in /var/mysql . How do I change the mysql driver to point to
this location? I looked through the docs, but I couldn't seem to see
it. Thank you for all your help.
Todd
------------------------------
Date: Fri, 16 Feb 2001 17:55:25 GMT
From: "nowayandnohow" <nowayandnohow@hotmail.com>
Subject: free cgi's ?
Message-Id: <hQdj6.477$lx.478449@typhoon2.ba-dsg.net>
Hi ya'll, i was wondering if one of you could give me a link or two to a
free cgi script page where i can download them, to brake them down to learn
more about them (i.e. to learn more about CGI writing).
I have been around the web and found some, but i figured some of you are
better to show me the good stuff, since i can't make the difference between
shiet and good.
Thnx
// Jo
------------------------------
Date: Fri, 16 Feb 2001 12:55:22 -0500
From: "Tom Kralidis" <tom.kralidis@ccrs.nrcan.gcDOTca>
Subject: ioctl problem
Message-Id: <96jpia$k0q8@nrn2.NRCan.gc.ca>
Hi,
I'm writing a script with a user-defined module, and am running into problems.
When trying to open a file, the following error occurs:
Unable to open file: Inappropriate ioctl for device
The module is simply trying to open a file through an OO interface.
Can anyone offer some pointers on what this problem is?
Any advice or suggestions are appreciated.
..Tom
------------------------------
Date: Fri, 16 Feb 2001 18:52:55 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Make a bitmap capture of a web page
Message-Id: <t8qto761thtk92@corp.supernews.com>
Erwan Gallen (egallen@NOSPAMnetcourrier.com) wrote:
: I'm searching a module which can capture a web page in a bitmap image (png
: ou jpeg).
Unless you want to write a screen/window capture utility which will grab
the display from your favorite browser (which would be silly, as a lot of
good tools to do this already exist), you're approaching this wrong.
There is no one 'image' associated with a given hunk of html. Every
client is free to render it in different ways. Producing an image from
some html input would basically involve either writing your own rendering
engine (which has taken the Mozilla project hundreds of programmer-years,
just to set the scale appropriately) or lifting the results of another
rendering engine using window capture or the like.
: Do you know a module which can :
:
: - take an URL in his input.
: - make an HTTP request
: - get the HTML
This part can be handle by the LWP::Simple module.
: - parse the HTML.
HTML::Parse
: - download others files : images, frames
LWP::Simple again
: - make a capture and return in jpeg or png
This is the rendering step, and you're basically on your own.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Fri, 16 Feb 2001 15:50:35 +0000
From: Stephen Taylor <stephen@cad.strath.ac.uk>
Subject: Multi-dimensioned arrays
Message-Id: <3A8D4C4B.9BF39864@cad.strath.ac.uk>
Hi,
I'm pretty new to perl, and hence have gotten extremely confused, in a
very short time.
I don't have much time to commit to learning perl, so I was hoping that
someone could help me with a quick answer to a problem.
Basically, I want to read in numerical data from a file and display this
data in a graphical format. The graphical representation of the data is
to be created using ptk.
The data in the file will be in the format:
0.5, 23, 100, 237, 165.56
1.3, 46, 101, 345, 413.13
The number of rows in the file will vary (10 - 100s), but there are
always five columns.
I've been reading up on arrays and hashes, but I am still unsure how to
create a multi-dimensioned array from the data held in the file. Can
anyone give me some pointers on how I might code this?
Many thanks,
Steve
------------------------------
Date: Fri, 16 Feb 2001 12:09:45 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Multi-dimensioned arrays
Message-Id: <Pine.A41.4.21.0102161159500.13024-100000@ginger.libs.uga.edu>
On Fri, 16 Feb 2001, Stephen Taylor wrote:
> Basically, I want to read in numerical data from a file and display this
> data in a graphical format. The graphical representation of the data is
> to be created using ptk.
>
> The data in the file will be in the format:
>
> 0.5, 23, 100, 237, 165.56
> 1.3, 46, 101, 345, 413.13
>
> The number of rows in the file will vary (10 - 100s), but there are
> always five columns.
>
> I've been reading up on arrays and hashes, but I am still unsure how to
> create a multi-dimensioned array from the data held in the file. Can
> anyone give me some pointers on how I might code this?
1 #!/usr/local/bin/perl -w
2 use strict;
3
4 my @a = ();
5
6 while( <DATA> ) {
7 chomp;
8 push @a, [ split /,\s*/ ];
9 } # while
10
11 foreach ( @a ) {
12 print "@$_\n";
13 }
14
15 ### OR
16
17 for( my $i = 0; $i < @a; ++$i ) {
18 for( my $j = 0; $j < @{$a[ $i ]}; ++$j ) {
19 print "$a[ $i ][ $j ]\n";
20 }
21 print "\n";
22 }
23
24 __DATA__
25 0.5, 23, 100, 237, 165.56
26 1.3, 46, 101, 345, 413.13
Line 8 pushes an anonymous array (dimension 2) onto the named array
(dimension 1). Lines 11-13 are a Perl-ish way to print the array. Lines
17-22 are intentionally verbose to illustrate another traversal method.
Brad
------------------------------
Date: 16 Feb 2001 17:40:33 GMT
From: "Scott R. Godin" <dontspamthewebmaster@webdragon.net>
Subject: Re: Multi-dimensioned arrays
Message-Id: <96jomh$qcc$0@216.155.32.211>
In article <3A8D4C4B.9BF39864@cad.strath.ac.uk>, Stephen Taylor
<stephen@cad.strath.ac.uk> wrote:
| I'm pretty new to perl, and hence have gotten extremely confused, in a
| very short time.
Don't be. References are easy once you grok the underlying principles.
| I don't have much time to commit to learning perl, so I was hoping that
| someone could help me with a quick answer to a problem.
This is a 'quick answer': You're MUCH MUCH MUCH better off taking the
time to read the three suggested perl docs I point out below and
*understanding* how this works so that you can A> make changes in my
code examples to suit your needs, and B> you'll forever after know how
to do this yourself without having to come back and ask us to throw you
another fish.
| Basically, I want to read in numerical data from a file and display this
| data in a graphical format. The graphical representation of the data is
| to be created using ptk.
|
| The data in the file will be in the format:
|
| 0.5, 23, 100, 237, 165.56
| 1.3, 46, 101, 345, 413.13
|
| The number of rows in the file will vary (10 - 100s), but there are
| always five columns.
That makes things somewhat easier.
| I've been reading up on arrays and hashes, but I am still unsure how to
| create a multi-dimensioned array from the data held in the file. Can
| anyone give me some pointers on how I might code this?
You'll definitely need to check out the following perl docs so that you
can fully understand the example I'll provide at the end of this:
perldoc perllol
perlref
perldsc
Keep working at them 'til you grok them completely; It'll definitely pay
off in the long run, because you'll *understand* them, and will know how
to mutate them however you want.
here's an example, using your data (tested code):
#!perl -w
use strict;
use vars qw(@data @temp $numrecords $count $ref);
while (<DATA>) {
chomp;
my @temp = (split /,/); #note use of my and ()'s
push @data, [@temp]; # this creates a reference via the []'s
}
$numrecords = scalar(@data);
print "There are $numrecords items in \@data\n\n";
$count = 0;
foreach my $ref (@data) {
# de-referencing it here to get the items per record
# or you could write it as $ref->[0]
print "items for record [$count]: ";
print "[0] = @{$ref}[0], ",
"[1] = @{$ref}[1], ",
"[2 .. 4] = @{$ref}[2], @{$ref}[3], @{$ref}[4]\n";
++$count;
}
# you could as easily write
# for my $record (0 .. $#data) {
# print $data[$record]->[0], ", ";
# }
# or a double loop :)
for my $record (0 .. $#data) {
# notice how we again de-reference it here
for my $item (0 .. $#{ $data[$record] } ) {
# and here
print "\@data[$record]->[$item] = ", $data[$record]->[$item],
(($item < 4) ? ', ' : ';'); #fancy end of record ;)
}
print "\n";
}
# hope this helps! but read the docs suggested above and try to
# *understand* it before you go "I don't get it". :-)
# heh, or worse, break the examples (:
__DATA__
0.5, 23, 100, 237, 165.56
1.3, 46, 101, 345, 413.13
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 16 Feb 2001 17:36:15 +0000
From: nobull@mail.com
Subject: Re: Multi-dimensioned arrays
Message-Id: <u9snleedio.fsf@wcl-l.bham.ac.uk>
Stephen Taylor <stephen@cad.strath.ac.uk> writes:
> The data in the file will be in the format:
>
> 0.5, 23, 100, 237, 165.56
> 1.3, 46, 101, 345, 413.13
>
> The number of rows in the file will vary (10 - 100s), but there are
> always five columns.
>
> I've been reading up on arrays and hashes, but I am still unsure how to
> create a multi-dimensioned array from the data held in the file. Can
> anyone give me some pointers on how I might code this?
Multi-Dimensioned arrays aka "lists of lists" are documented in the
perllol manpage.
To populate a 2D array from a file as above take a look at the example
of doing this in the "perllol" manual section "Growing Your Own".
In that example the split pattern is / / you'll probably want /,\s+/.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 16 Feb 2001 13:23:38 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Multi-dimensioned arrays
Message-Id: <Pine.A41.4.21.0102161314120.13802-100000@ginger.libs.uga.edu>
On 16 Feb 2001, Scott R. Godin wrote:
> my @temp = (split /,/); #note use of my and ()'s
Scott,
Forgive me for picking nits.
You would need the ()'s if you were subscripting the function call, e.g.
print+(split " ", "1 2 3")[1];
but you don't need them in your code above.
> $numrecords = scalar(@data);
Randall will get you for that. :-)
$numrecords = @data;
No 'scalar' needed.
Brad
------------------------------
Date: Fri, 16 Feb 2001 18:51:21 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Multi-dimensioned arrays
Message-Id: <x7g0helavp.fsf@home.sysarch.com>
>>>>> "BB" == Brad Baxter <bmb@ginger.libs.uga.edu> writes:
>> $numrecords = scalar(@data);
BB> Randall will get you for that. :-)
BB> No 'scalar' needed.
and randal will get you for that. no second 'l'.
:)
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 16 Feb 2001 19:04:28 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Multi-dimensioned arrays
Message-Id: <t8qudsi2gb5m8f@corp.supernews.com>
Stephen Taylor (stephen@cad.strath.ac.uk) wrote:
: I don't have much time to commit to learning perl, so I was hoping that
: someone could help me with a quick answer to a problem.
Unfortunately, there's no quick-fix way to become a good perl programmer.
Time spent with an introductory book and a shell will pay off far better
than asking out-of-your-depth questions on Usenet.
: I've been reading up on arrays and hashes, but I am still unsure how to
: create a multi-dimensioned array from the data held in the file. Can
: anyone give me some pointers on how I might code this?
perldoc perllol
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Fri, 16 Feb 2001 10:42:48 -0800
From: "Montego" <perldomo@hotmail.com>
Subject: Re: Newbie needs help with form
Message-Id: <t8qtg91k2rbicd@corp.supernews.com>
I would recommend going to Matt Wright's script archive at
http://worlwidemart.com/scripts/ and get a hold of his form mail script.
It's very flexible, easy to use, and comes with very clear setup
instructions.
---Montego---
"The Black Prince" <cfscds@hotmail.com> wrote in message
news:8IXi6.264$HW2.2387@newsfeed.slurp.net...
> I'm a Nurse, not a programmer and I know only enough HTML to build a basic
> site for our non-profit club. I'm am busy with drug studies at the moment
> and have no time for learning new code.
>
> My Server just informed me that they don't have FrontPage Server
Extensions
> installed and nor are they likely to. I was wondering if anyone had some
> drop in module that I could copy to my dir on my server, add the flags to
> the code below that would allow the kids to request music at their next
Jr.
> Optimist Dance???
>
> They would use the form below to build a very basic database of music
> requests. The code is supposed to append an HTML list (that it creates the
> 1st time) they can view in order for them to see what has already been
> requested. It also creates a formatted txt file of the list that I can FTP
> DL and use when I'm shopping for CD's. It is also supposed to email me so
> any last minute additions to the list would reach me in time...
>
> There is no user password to worry about.
>
> If you would like to get the gist of the site and the club, go to
> http://parrysound.optimist.net and navigate to the Georgian Bay Jr.
Optimist
> section. Near the bottom of the page you will find the flag that will
start
> the form.
>
> The section of FrontPage code that was supposed to do all this is flagged
by
> "++++++++++" at the start and end of it. Right now the code below can be
> seen and tried online at the site, but it generates a 404 error due to the
> extensions not being there.
>
> If anyone knows where this code could be or would be willing to create it
> for me I'd be very grateful
>
> Please reply to: webmaster@parrysound.optimist.net
>
> Thanks in advance
>
>
>
>
>
>
> <html>
>
> <head>
> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
> <meta HTTP-EQUIV="Content-Language" CONTENT="en-us">
> <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
> <meta name="ProgId" content="FrontPage.Editor.Document">
> <title>New Page 3</title>
> </head>
>
> <body background="images/bricks1.jpg" bgcolor="#000000" text="#FFFFCC">
>
> <h1 style="margin-top: 0; margin-bottom: 0" align="center">Music Request
> Form</h1>
> <p style="margin-top: 0; margin-bottom: 0" align="center">for Jr Optimist
> Dances</p>
> <hr>
> <p style="line-height: 100%; margin-top: 0; margin-bottom: 6"
> align="center"><font color="#FFFFCC"><span style="background-color:
> #000000">This
> information will go to the Jr. Optimist Club and they will try their best
to
> get
> this music into the next Dance.</span></font></p>
> <p style="line-height: 100%; margin-top: 0; margin-bottom: 6"
> align="center"><font color="#FFFFCC"><span style="background-color:
> #000000">Just
> remember it's a DANCE and we want to hear from you about your favorite
SLOW
> songs
> as well as your favorite fast ones!</span></font></p>
>
> ++++++++++
>
> <form METHOD="POST" ACTION="--WEBBOT-SELF--">
>
> <!--webbot bot="SaveResults"
> U-File="C:\_Optimist Website\musicrequestform_results.txt"
> S-Format="TEXT/PRE"
> S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
> U-File="C:\_Optimist Website\musicrequestform_results.html"
> S-Format="HTML/PRE" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
> S-Email-Format="TEXT/PRE" S-Email-Address="cds@vianet.on.ca"
> B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="FALSE"
> S-Email-Subject="More music requests"
> S-Builtin-Fields="REMOTE_NAME REMOTE_USER"
> U-Confirmation-Url="musicrequestconfirm.htm" -->
>
> ++++++++++
>
> <ul>
> <li>
> <p>Enter the Song's Title below:</p>
> <p><input TYPE="TEXT" NAME="Song Title:" SIZE="50"><br>
> </p>
> <li>
> <p>Enter the Artist or Group who sings the song:.</p>
> <p><input TYPE="TEXT" NAME="Artist/Group" SIZE="50"><br>
> </p>
> <li>
> <p>Enter the Album Title that the song was found on:.</p>
> <p><input TYPE="TEXT" NAME="Album Title" SIZE="50"><br>
> </p>
> <li>
> <p>Is it Fast or Slow?</p>
> <p><input TYPE="RADIO" NAME="Fast_Slow" VALUE="Fast" CHECKED>
> Fast <input TYPE="RADIO" NAME="Fast_Slow" VALUE="Slow">
> Slow<br>
> </p>
> <li>
> <p>What type of music is it?</p>
> <p><select NAME="Type of Music">
> <option SELECTED>Hip-Hop
> <option>Pop
> <option>Regge
> <option>Latin
> <option>Rap
> <option>Country
> <option>Rock
> </select><br>
> </p>
> </ul>
> <input TYPE="SUBMIT" VALUE="Submit Form"> <input TYPE="RESET"
VALUE="Reset
> Form">
> </form>
> <hr>
> <table border=0>
> <tr>
> <td><img alt="We are Proud Canadians" src="images/cf.gif"></td>
> <td><FONT FACE="helvetica,arial" size=-1><i>The Optimist Club of
> Parry Sound: © 2000</i>
> - 2001<br>Optimist Colin D. Starkey, <A
> HREF="mailto:webmaster@parrysound.optimist.net?subject=' + document.title
+
> '">WebMaster</A><B></td>
> </tr>
> </table>
> <hr>
>
> <SCRIPT LANGUAGE="JavaScript">
> <!-- hide scripts from old browsers
>
> // append a modification date only if server provides a valid date
> if (Date.parse(document.lastModified) > 0) {
> document.write('<B>last modified: </B>' +
> document.lastModified + '<BR>');
> }
>
>
> // done hiding from old browsers -->
> </SCRIPT>
> <!-- end of The Parry Sound Optimist standard footer -->
>
> </body>
>
> </html>
>
>
> --
> The Black Prince
>
>
------------------------------
Date: Fri, 16 Feb 2001 18:52:59 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newbie needs help with form
Message-Id: <x7d7cilat0.fsf@home.sysarch.com>
>>>>> "M" == Montego <perldomo@hotmail.com> writes:
M> I would recommend going to Matt Wright's script archive at
M> http://worlwidemart.com/scripts/ and get a hold of his form mail script.
M> It's very flexible, easy to use, and comes with very clear setup
M> instructions.
and it is crap code like all matt wright code. don't ever recommend that
archive again.
<snip of total jeopardy quote>
and don't quote that way. learn about proper quoting and stay away from
matt wright.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 16 Feb 2001 10:54:59 -0800
From: "Montego" <perldomo@hotmail.com>
Subject: Re: Newbie needs help with form
Message-Id: <t8qu73b8rqhffd@corp.supernews.com>
Didn't mean to upset you there, but my understanding is that this person
needs a basic, simple script that's easy to configure. If you don't like
Form mail, you don't have to use it.
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7d7cilat0.fsf@home.sysarch.com...
> >>>>> "M" == Montego <perldomo@hotmail.com> writes:
>
> M> I would recommend going to Matt Wright's script archive at
> M> http://worlwidemart.com/scripts/ and get a hold of his form mail
script.
> M> It's very flexible, easy to use, and comes with very clear setup
> M> instructions.
>
> and it is crap code like all matt wright code. don't ever recommend that
> archive again.
>
> <snip of total jeopardy quote>
>
> and don't quote that way. learn about proper quoting and stay away from
> matt wright.
>
> uri
>
> --
> Uri Guttman --------- uri@sysarch.com ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page -----------
http://www.sysarch.com/cgi-bin/perl_books
> The Best Search Engine on the Net ----------
http://www.northernlight.com
------------------------------
Date: 16 Feb 2001 19:01:05 GMT
From: revjack <revjack@revjack.net>
Subject: Re: Newbie needs help with form
Message-Id: <96jtdh$4j9$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Montego <perldomo@hotmail.com> wrote:
: I would recommend going to Matt Wright's script archive at
: http://worlwidemart.com/scripts/ and get a hold of his form mail script.
You haven't been reading comp.lang.perl.misc for long, have you? :)
--
___________________
revjack@revjack.net
------------------------------
Date: Fri, 16 Feb 2001 09:47:55 -0800
From: Dug <dougd@shieldsbag.com>
Subject: Re: perl 4 question
Message-Id: <3A8D67CB.B7377942@shieldsbag.com>
After thinking more about it, using the hash would not be all that bad. Basically
I was wanting to create a storage for database fields which were identified by
$name in a function supplied by the designer. A hash based on the tablename by the
field name would probably work just fine. Thanks
Damian James wrote:
> Thus spake Dug on Thu, 15 Feb 2001 16:53:45 -0800:
> >I know I know, but so far I have to use that version of perl for our
> >database access (uniperl). Haven't had the time to make it a package
> >yet. Anyway, I want to use the contents of a variable as the name for
> >another variable and use it without making a hash out of it. ( I guess I
> >could live with a has if I had to). Here's what I want.
> >
> >$name = &some_function_that_returns_a_string(); # say "Hello"
> >$x{$name} = 55;
>
> This creates a hash %x and sets $x{Hello} to 55. Did you mean ${"x$name"}
> or something?
>
> >
> >print "$xHello\n";
> >
>
> print "$x{Hello}\n"; # would print "55".
>
> Why exactly do you not want to use a hash? Have you read here or elsewhere
> about the problems associated with symbolic references? Using a hash,
> where possible, is almost always the better option. Have a look at:
>
> http://www.plover.com/~mjd/perl/varvarname.html
>
> AFAIK, using eval only helps you with dereferencing a symref, it won't
> help in the assignment you are trying to make above. If you really already
> have a lot a variables to assign to this way, it's probably still better to
> work through and make it a hash. This will improve the code (by removing
> clutter from your namespace).
>
> Talking about namspace, why not say the above as:
>
> $x{ &some_function_that_returns_a_string() } = 55;
> print "$x{Hello}\n";
>
> Or does perl 4 not let you do that?
>
> HTH
>
> Cheers,
> Damian
> --
> $;=ord$%,$:=$;-ord q,.,,$_=q 13346:3366:3276:3326:3386:546:566:966:3396:3376:1.
> q 73386:546:;96:3326:3336:3386:3266:3236:3366:546::26:3236:3366:32:6:546:32667.
> q,:;96:;;6:3296:3236:3366:326:56,,s,.,;ord($&)-$:-$;;;;;,eg,s,$;,;chr$&-$:;,eg,
> eval eval; #requires 5.6.0 ## my first attempt at one of these...
------------------------------
Date: Fri, 16 Feb 2001 10:49:49 -0800
From: "Montego" <perldomo@hotmail.com>
Subject: Perl 5 and graphics
Message-Id: <t8qttigjusdk19@corp.supernews.com>
I have no idea how to do this, but I want to make a subroutine that will
check the dimensions of a GIF or JPG image on a remote server. This way,
someone can use a form to enter the URL of an image on their site, and my
script will check it and assign the width and height to variables. Then I
can check those values and return an error if it's too large.
The only part I'm stumped on is how to actually get the dimensions into the
variables.
Thanks!
------------------------------
Date: Fri, 16 Feb 2001 16:14:49 GMT
From: "Frank Miller" <no@email.com>
Subject: Perl and #include
Message-Id: <Zlcj6.432457$U46.12652541@news1.sttls1.wa.home.com>
Does Perl have a #include type statement?
I want to do something like:
print <<"END"
#include template.html
END
I realize this would only print "#include...", but you get the idea. I
could just read the file and print each line via an open, while(<FILE>) and
print, but I need to to replace $vars in the template.html file. Am I
missing an obvious (and simple, this is Perl after all) way to do this?
FrankM
------------------------------
Date: 16 Feb 2001 16:25:27 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl and #include
Message-Id: <96jk9n$437$2@mamenchi.zrz.TU-Berlin.DE>
Frank Miller <no@email.com> wrote in comp.lang.perl.misc:
>Does Perl have a #include type statement?
>
>I want to do something like:
>
>print <<"END"
>#include template.html
>END
>
>I realize this would only print "#include...", but you get the idea. I
>could just read the file and print each line via an open, while(<FILE>) and
>print, but I need to to replace $vars in the template.html file. Am I
>missing an obvious (and simple, this is Perl after all) way to do this?
Well, there is the -P flag that runs the code through the C preprocessor
before execution. You may even be able to specify it on the #!-line.
That would understand #include, but it doesn't look like a robust
design. The contents of template.html must be strictly controlled,
every change there is in effect a change in your source code.
I'd recommend a cpan search with keywords like "html" and "template".
I'm sure you'll find something more robust.
Anno
------------------------------
Date: 16 Feb 2001 16:50:43 GMT
From: "Scott R. Godin" <dontspamthewebmaster@webdragon.net>
Subject: Re: Perl and #include
Message-Id: <96jlp3$fd3$1@216.155.32.211>
In article <Zlcj6.432457$U46.12652541@news1.sttls1.wa.home.com>, "Frank
Miller" <no@email.com> wrote:
| Does Perl have a #include type statement?
|
| I want to do something like:
|
| print <<"END"
| #include template.html
| END
|
| I realize this would only print "#include...", but you get the idea.
|
| I could just read the file and print each line via an open,
| while(<FILE>) and print, but I need to to replace $vars in the
| template.html file. Am I missing an obvious (and simple, this is
| Perl after all) way to do this?
Text::Template :)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 16 Feb 2001 11:50:31 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: replying to the Perl FAQ (was Stripping blank space)
Message-Id: <m3n1bmh8rs.fsf@mumonkan.sunstarsys.com>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "TM" == Tad McClellan <tadmc@augustmail.com> writes:
>
> TM> The FAQ maintainer(s) can be contacted via the Perl 5 Porters (p5p).
> TM> I don't think many of them hang out in this newsgroup swamp.
>
> but you can just cc to the auto FAQ address and they get it. i have told
> them to add the header that requests an email cc. does anyone remember
> the name of it?
I think you want something like
Mail-Copies-To: denver@pm.org
That should request followups to be emailed *and* posted to the group. If
you use
Followup-To: poster
then it requests followups to only be sent to the mailbox. The group
won't see them without a manual override.
--
Joe Schaefer Did I ever tell you that Mrs. McCave had twenty-three sons and
she named them all Dave? Well she did, and that wasn't a smart
thing to do.
-- Dr. Seuss
------------------------------
Date: Fri, 16 Feb 2001 17:52:04 GMT
From: "nowayandnohow" <nowayandnohow@hotmail.com>
Subject: Re: Stop writing CGIs (SPAM) 23 Questions
Message-Id: <8Ndj6.476$lx.477066@typhoon2.ba-dsg.net>
Rich: I am laughing my ass of :-) I haven't seen such an exelent burn in a
long while :-)
"Rich" <bigrich318@yahoo.com> wrote in message
news:t8prk1hicpmu3c@corp.supernews.com...
> "Janardhan Sridhar" <sridhar@cji.com> wrote in message
> news:lFWi6.3062$Bh7.267859@newsread2.prod.itd.earthlink.net...
> > Why twist yourself up in knots writing CGIs (in Perl or whatever)?
> >
> > If you are frustrated with programs that puke web pages, Bedrock may
> be the
> > solution. If you must write perl code, then you can extend Bedrock
> with
> > Bedrock Loadable Modules (BLMs).
> >
> > Bedrock is a server side scripting tool for Apache servers. Check
> us out at
> <snip spam>
>
> Q1: Hmm, interesting. Why did you feel the need to develop "Bedrock"?
>
> A1: (From the site) "Bedrock was developed because CGIs are junk"
>
>
> Q2: How do I install "Bedrock"?
>
> A2: (From the site) "Bedrock can be installed as a CGI" (huh? see A1)
>
>
> Q3: So "Bedrock" can save me from those dreaded Perl CGIs (et al)?
>
> A3: (From the site) "Before we get started we should note that Bedrock
> was written in the Perl programming language."
>
>
> Q4: Is it more portable than those awful Perl CGIs?
>
> A4: (From the site) "Bedrock is a server side extension to Apache and
> must be installed by your site administrator before you can begin
> rocking..Because Bedrock is an extension to Apache, your webmaster
> must configure the web server to recognize certain files as "Bedrock"
> files."
>
>
> Q5: Does it need anything other than a server admin who'll install
> your new software and let a non-programmer use it?
>
> A5: (From the site) "Apache 1.3+ "
>
>
> Q6: Anything else?
>
> A6: (From the site) "Perl 5.005"
>
>
> Q7: Anything else?
>
> A7: (From the site) "Several Perl packages (other than the standard
> packages)";
>
>
> Q8: Anything else?
>
> A8: (From the site) "DBI and DBD packages for each database you want
> to connect to"
>
>
> Q9: Anything else?
>
> A9: (From the site) "mod_perl (recommended, but not required)".
>
>
> Q10: How do I learn the "Bedrock" language?
>
> A10: (From the site) "Bedrock is NOT ..A programming language"
>
>
> Q11: What programming language do I need to learn?
>
> A11: (From the site) "The web developer need not learn a programming
> language to use Bedrock."
>
>
> Q12: So, what do I need to know?
>
> A12: (From the site) "HTML/DHTML".
>
>
> Q13: Anything else?
>
> A13: (From the site) "Javascript".
>
>
> Q14: Anything else?
>
> A14: (From the site) "SQL".
>
>
> Q15: Anything else?
>
> A15: (From the site) "Database Design".
>
>
> Q16: After I learn all of that will I be ready to program in
> "Bedrock"?
>
> A16: (From the site) "Bedrock is *not* programming and it's *not*
> scripting, so we'll coin the term "rocker" for an HTML dude who
> masters Bedrock and unlocks its power. If we slip up and use
> programmer speak, we apologize. Bedrock is not programming!
>
>
> Q17: Ok, Ok it's not programming! Can you give an example?
>
> A17: (From the site) :
> <html>
> <body>
> <sqlconnect "dbi:Oracle:MYDB"
> --username = "user"
> --password = "password">
>
> <sqlselect "select col1, col2 from mytable"
> --define-var = "joe">
> </select>
> <table>
> <foreach $joe>
> <tr>
> <td><var $COL1></td>
> <td><var $COL2></td>
> </tr>
> </foreach>
> </table>
> </body>
> </html>
> n@end example
>
>
> Q18: What are all of those Perl-ish looking tags, I thought I wouldn't
> have to learn any programming? Are there any others?
>
> A18: (From the site) "Bedrock Objects, method(),$input ,$config
> ,<$config.merge()> ,$env ,$header ,$Bedrock , $cookie ,Scalars ,chr()
> ,crypt() ,lc() ,lcfirst() ,uc() ,ucfirst() ,length() ,reverse()
> ,format($fmt) ,subst,($offset, [, $len]) ,replace($pat [, $repl [,
> $flags]]) ,trim() ,ltrim() ,rtrim() ,urlencode() ,htmlencode()
> ,align_center() ,align_left() ,align_right() ,isEmpty() ,split([$regex
> [, $max_items]]) ,Arrays ,length() ,get() ,set() ,push() ,pop()
> ,shift() ,unshift() ,join() ,Error Handling ,Include/Exec ,<include>
> ,Recursion in Bedrock ,<exec> ,Argument Expansion ,Pebbles ,HTML
> Components ,Flow Control , <if/else/elseif> , <foreach> ,Looping Over
> Rows of a SELECT ,<while> .......................".
>
>
> Q19: Objects? Recursion? $regex? I have to learn all of that just to
> use "Bedrock"? Why not learn Perl, or PHP, or ASP? Could you show me
> the difference?
>
> A19: (From the site) :
>
> Bedrock Solution:
> <html>
> <body>
> You entered <var $input.mytext>
> </body>
> </html>
>
> Perl Solution:
> #!/usr/bin/perl
>
> use CGI;
>
> my $cgi = new CGI;
>
> my $mytext = $cgi->param('mytext');
>
> print "Content-Type: text/html\n\n";
>
> print "<html>\n";
> print "<body>\n";
> print "You entered $mytext\n";
> print "</body>\n";
> print "</html>\n";
>
>
> Q20: I hope the Perl used in your software is written more efficiently
> than that! How much code did it take to parse your "Bedrock solution"?
>
> A20: bedrock-1.6.4.tar.gz (614 KB 118 files, 24 folders) not to
> mention the additional modules required.
>
>
> Q21: So how is "Client->Bedrock Solution->Server Parse->Client" more
> efficient than "Client->Perl Solution->Client" shown in your example?
>
> A21: (From the site) "..if a page processes in .1 seconds versus .5
> seconds is that actually relevant?
>
>
> Q22: But it's not portable, is it?
>
> A22: (From the site) "Yes, Bedrock can run in a shell environment.
> This can be a handy tool for knocking out those quick little database
> scripting projects." (Huh? hand, little? see A20:)
>
>
> Q23: So, rather than take the time to learn the (relatively) simple
> fundamentals that would allow me to write my own compact, portable
> scripts using Perl, PHP, ASP , Etc., I should learn your non-portable,
> embedded, tagsets (which are really nothing more than perl-parsed
> templates) and install over half a megabyte of code on my server (and
> let non-programmers use it) just so an HTML file can "connect" to a
> database?
>
> A23:(From the site) "Yaba daba doo!"
>
>
> Err, no thanks!
>
> Perl Solution:
> use CGI;
> my $Bedrock = CGI->new;
> print $Bedrock->header(Usenet/Spam), $Bedrock->param('*plonk*');
>
>
>
>
------------------------------
Date: Fri, 16 Feb 2001 16:10:48 GMT
From: "Frank Miller" <no@email.com>
Subject: striping HTML
Message-Id: <cicj6.432448$U46.12652316@news1.sttls1.wa.home.com>
I have a website where users can post text replies to questions. I don't
want them to be able to enter HTML in the messages, because that messes up
my pages when I print the replies.
Is there a good perl sub that will strip any HTML tags they put in the
message? It would be nice if they could do simple ones like <br>, <b> and
other text formatting. I don't want pictures, tables and font changes.
Frank
------------------------------
Date: 16 Feb 2001 16:43:07 GMT
From: "Scott R. Godin" <dontspamthewebmaster@webdragon.net>
Subject: Re: striping HTML
Message-Id: <96jlar$fd3$0@216.155.32.211>
In article <cicj6.432448$U46.12652316@news1.sttls1.wa.home.com>, "Frank
Miller" <no@email.com> wrote:
| I have a website where users can post text replies to questions. I
| don't want them to be able to enter HTML in the messages, because
| that messes up my pages when I print the replies.
|
| Is there a good perl sub that will strip any HTML tags they put in
| the message? It would be nice if they could do simple ones like
| <br>, <b> and other text formatting. I don't want pictures, tables
| and font changes.
You could always try the HTML::Parser module from CPAN to extract just
the text.
--
send mail to webmaster (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 16 Feb 2001 17:35:24 +0000
From: nobull@mail.com
Subject: Re: striping HTML
Message-Id: <u9u25uedk3.fsf@wcl-l.bham.ac.uk>
"Frank Miller" <no@email.com> writes:
> Subject: Re: striping HTML
FAQ: "How do I remove HTML from a string?"
You are expected to read the FAQ _before_ posting.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 16 Feb 2001 17:47:47 -0000
From: "Brian J" <sorryno@email.at.all>
Subject: Re: striping HTML
Message-Id: <3a8d6987_1@news2.uncensored-news.com>
"Frank Miller" <no@email.com> wrote in message
news:cicj6.432448$U46.12652316@news1.sttls1.wa.home.com...
> I have a website where users can post text replies to questions. I
don't
> want them to be able to enter HTML in the messages, because that
messes up
> my pages when I print the replies.
>
> Is there a good perl sub that will strip any HTML tags they put in the
> message? It would be nice if they could do simple ones like <br>, <b>
and
> other text formatting. I don't want pictures, tables and font
changes.
>
> Frank
>
>
Not ideal, but perhaps something like this -
sub strip_html {
$text =~ s/<//g;
$text =~ s/>//g;
}
--
Brian
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: 16 Feb 2001 17:56:40 GMT
From: "Scott R. Godin" <dontspamthewebmaster@webdragon.net> (by way of "Scott R. Godin" <dontspamthewebmaster@webdragon.net>)
Subject: Re: three-part form submission using CGI.pm
Message-Id: <96jpko$qcc$1@216.155.32.211>
In article <3A8C2E82.6608B3EB@SPAMMENOT.hotmail.com>, "B. Carlson"
<beaker457@SPAMMENOT.hotmail.com> wrote:
[re-directed from c.l.p.modules as I think it might generate some more
discussion here [yes I should have cross-posted but I didn't think of it
at the time :( ] to help me solve this]
[jeopardectomy performed]
| Make a bunch of hidden fields for the information in the 2nd form doing
| this.
|
| foreach $param (param){$hiddeninfo .= hidden($param)."\n";}
|
| Then on your 3rd submission you will have the same field names and
| stuff you need.
|
| B. Carlson
it seems to me that if I have to do it this way, that a map would be
more efficient.
I don't quite grok the map function yet (although I can definitely feel
the need to) .. I'm going to take a whack at this right here off the
top of my head, and invite some critique from you more experienced
map-ers.
print header, start_html, start_form,
( map {
hidden({-name=>$_, -Values=>unescapeHTML(param($_))})
} (param)
),
submit(), end_form, end_html;
I tried this in my code itself, and played with it a bit, and it
otherwise seems to work fine, but it introduces another problem..
I have some textarea fields that I want the users to be able to input
in paragraph format and preserve the line breaks (for which I was using
a fix_paragraphs() sub that replaces all the \n's with <br>'s instead)
However, when I view the 'intermediate preview' now, all the \n's are
HTML-escaped by CGI.pm to be pairs (and I'm not even sure
whether this is localized to being on a Mac, or if that's normal.)
which is why I added the unescapeHTML business to the map function to
see if that would take care of it (nope).
I've tried adding those to the fix_paragraphs sub in a separate regex
but it's not catching them like I thought it would. any suggestions on
this?
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Fri, 16 Feb 2001 10:08:01 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: three-part form submission using CGI.pm
Message-Id: <3A8D6C81.19F9116A@stomp.stomp.tokyo>
Scott R. Godin wrote:
> B. Carlson wrote:
> beaker457 wrote:
(snipped)
> I tried this in my code itself, and played with it a bit, and it
> otherwise seems to work fine, but it introduces another problem..
> I have some textarea fields that I want the users to be able to input
> in paragraph format and preserve the line breaks (for which I was using
> a fix_paragraphs() sub that replaces all the \n's with <br>'s instead)
> However, when I view the 'intermediate preview' now, all the \n's are
> HTML-escaped by CGI.pm to be pairs (and I'm not even sure
> whether this is localized to being on a Mac, or if that's normal.)
> which is why I added the unescapeHTML business to the map function to
> see if that would take care of it (nope).
> I've tried adding those to the fix_paragraphs sub in a separate regex
> but it's not catching them like I thought it would. any suggestions on
> this?
Yes, a suggestion. Stop using CGI.pm and write your own
custom read and parse routine. All of your problems
associated with CGI.pm will instantly vanish.
Godzilla!
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 302
**************************************