[17083] in Perl-Users-Digest
Perl-Users Digest, Issue: 4495 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 2 18:12:27 2000
Date: Mon, 2 Oct 2000 15:11:34 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970524693-v9-i4495@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 2 Oct 2000 Volume: 9 Number: 4495
Today's topics:
Re: Freeware Perl compiler for Windows? (Steve A.)
Re: Hash array with multiple indexes <tim@ipac.caltech.edu>
HELP method POST cmf2000@my-deja.com
Re: HELP method POST <jeff@vpservices.com>
Re: HELP method POST tmac@transport.com
Help with MANIFESTs, Makefile.PLs etc. <ljnelson@unix.amherst.edu>
Help with Net::LDAP authentication. <Bob.Jones@wku.edu>
Re: Help with Net::LDAP authentication. (Kenneth Graves)
Help With Script!! malatov@my-deja.com
Re: How can I install DBI? <vf1@smarts.com>
How do I link a C Library into Perl zephar@my-deja.com
Re: How do I link a C Library into Perl <elijah@workspot.net>
How to access form data in CGI.pm? coughlan@gothaminteractive.com
Re: How to access form data in CGI.pm? <ljnelson@unix.amherst.edu>
Re: How to access form data in CGI.pm? <bmb@ginger.libs.uga.edu>
Re: How to access form data in CGI.pm? <bmb@ginger.libs.uga.edu>
Re: How to access form data in CGI.pm? <lr@hpl.hp.com>
Re: How to get length of scalar? <lr@hpl.hp.com>
Re: How to get length of scalar? <juex@deja.com>
Re: How to realize new or malloc in perl (Randal L. Schwartz)
Re: Huh? <gene@allsysinc.com>
Re: Inserting HTML into CGI script as if it was beingin (Steve A.)
Re: Inserting HTML into CGI script as if it was beingin <lr@hpl.hp.com>
Re: Inserting HTML into CGI script as if it was beingin <flavell@mail.cern.ch>
Re: Is this is Regexp bug? <peter.sundstrom@eds.com>
Re: Is this is Regexp bug? johnclyman@my-deja.com
Re: Is this is Regexp bug? (Ilya Zakharevich)
Re: Just Another Perl Hacker (B. Elijah Griffin)
Re: microsoft build for perl (Steve A.)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Sep 2000 18:38:37 GMT
From: sarbayo@telis.org (Steve A.)
Subject: Re: Freeware Perl compiler for Windows?
Message-Id: <39d0eae0.3022522@news.inreach.com>
Hello,
Yes,
www.indigostar.com/
or
ftp://ftp.indigostar.com/pub/indigoperl-5.6.zip
It's a full implementation and comes with the Apache server, so that,
(in theory) you can test you web-perl skills offline.
I can't get the server/browser thing working yet, but it looks like
it's a problem on my end.
I just use the perl.exe from the comand line, works great !
When I tested my program online, on a Linux server, it ran without a
hitch.
Good luck,
Steve
On Tue, 26 Sep 2000 15:39:13 +0100, "Glyndwr"
<glynFOOdwr@FSCKdeleteEmeD.co.uk> wrote:
>The thread about a Perl compiler for Unix has reminded me to get around to
>looking for a Win32 Perl compiler, for all my Windoze friends who want to
>delight at my scripts but not install the interpreter (they're odd like
>that).
>
>I've come across ActiveState's PDK and Perl2EXE, but they have the distinct
>disadvantage (for a poor student) of costing money. Any one know of any
>freeware ones? I didn't turn anything up on a web search, so I suspect it's
>a long shot, but I thought I'd ask.
>
>TIA.
>
>--
> -=G=-
>print join " ",reverse split /\s+/,'hacker. Perl another Just',"\n";
>Web: http://www.fscked.co.uk ICQ: 66545073
>
>
------------------------------
Date: Mon, 02 Oct 2000 13:03:08 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Hash array with multiple indexes
Message-Id: <39D8E9FC.EDB6DF11@ipac.caltech.edu>
"P.Eftevik" wrote:
>
> I have an associative array with strings as indexes.
> What I'd like to do is to use substrings as indexes as well.
> E.g. if 'mystring' is a valid index, I will need to index the array
> by means of 'mystr' also.
> I wonder if there are techniques to accomplish this.
Just the boring, obvious solutions:
my %hash = ( mystring => "stuff",
mystr => "stuff"
);
Or, if you don't want to replicate data, use references. E.g.
# First define full-length keys
my %hash = ( mystring => \"stuff",
herstring=> \"more stuff",
hisstring=> \"this stuff"
);
# Add aliases
my %hash = ( mystr => $hash{mystring},
herstr=> $hash{herstring},
hisstr=> $hash{hisstring}
);
Only one copy of the data is kept, but extracting the data now requires
the more complex ${$hash{herstring}} syntax. It is more extensible, however,
since you'll be able to store references to *anything*, not just scalars.
Automating this to work from meta-data which gives the full-length keys and
their aliases is left as an exercise for the reader.
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Mon, 02 Oct 2000 19:56:27 GMT
From: cmf2000@my-deja.com
Subject: HELP method POST
Message-Id: <8rap95$61j$1@nnrp1.deja.com>
How i can call any URL from a script and pass variables.
For example in method GET
print "location:www.domain.com/script.pl?var=content&var2=content2
but in method POST?
Thank
Pardon my poor english
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 02 Oct 2000 13:23:25 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: HELP method POST
Message-Id: <39D8EEBD.259FE75@vpservices.com>
cmf2000@my-deja.com wrote:
>
> How i can call any URL from a script and pass variables.
>
> For example in method GET
>
> print "location:www.domain.com/script.pl?var=content&var2=content2
>
> but in method POST?
The question you are asking is about how to do something with HTML so
you should ask in an HTML related newsgroup. The short answer is, you
use a form and and pass the variables as fields in the form, for
example:
<form action="myscript.cgi" method="POST">
<input type="hidden" name="testvar" value="foo">
<input type="submit">
</form>
Perl deals with what happens with the input after it is sent from the
form, for example, this reads that form and prints out the variable that
was passed:
#!/usr/local/bin/perl -Tw
$|++;
use strict;
use CGI qw(:standard);
print
header,
start_html,
param('testvar'),
end_html;
;
--
Jeff
------------------------------
Date: Mon, 02 Oct 2000 14:58:10 -0700
From: tmac@transport.com
Subject: Re: HELP method POST
Message-Id: <39D904F2.D26B5D1B@transport.com>
Sounds like a perl question to me:-). Maybe http, but not html.
Here is an example of what I would do. If you don't have LWP installed
get it!
use LWP::UserAgent;
$body = 'var1=$val1&var2=$val2"';
$ua = new LWP::UserAgent;
$header = new HTTP::Headers(Content-type =>
'application/x-www-form-urlencoded');
$url = new URI::URL('www.url.com/cgi-bin/myprog.cgi');
$request = new HTTP::Request('POST', $url, $header, $body);
$response = $ua->request($request);
if ($response->is_success) {
$response_content = $response->content;
}
else {
$error_message = $response->message;
}
exit;
Peace,
Tim McIntyre
cmf2000@my-deja.com wrote:
> How i can call any URL from a script and pass variables.
>
> For example in method GET
>
> print "location:www.domain.com/script.pl?var=content&var2=content2
>
> but in method POST?
>
> Thank
>
> Pardon my poor english
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Mon, 02 Oct 2000 18:07:14 GMT
From: Laird Nelson <ljnelson@unix.amherst.edu>
Subject: Help with MANIFESTs, Makefile.PLs etc.
Message-Id: <39D8CEC4.C5DD302C@unix.amherst.edu>
I'm a good person. I started building a set of modules with h2xs. I've
read the ExtUtils::MakeMaker manpage. I am, sorry to say, still
overwhelmed.
Can someone tell me some best practices for setting up a build
environment for developing a perl module?
I see that the MANIFEST file can be made automatically by doing a:
make manifest
...which causes ExtUtils::Manifest::mkmanifest to fire. Does this mean
that I shouldn't edit this MANIFEST file by hand as it can be
autogenerated? Should I ideally check this file into my version control
system?
How should I handle files (like properties files, dat files, resource
files) that are not *.pm files, executables or other
known-intrinsically-by-MakeMaker files? The ExtUtils::MakeMaker manpage
seemed to suggest that the minute a file appears that needs special
handling by the build process (i.e. a dat file that needs to exist in
the top level of the distribution) that I should redefine the "PM"
variable in my Makefile.PL.
I've also consulted modules on CPAN to see how they're set up, and it
seems to be the case that there are few, if any, best practices out
there. Are there any codified anywhere?
Thanks,
Laird
------------------------------
Date: Mon, 02 Oct 2000 13:46:11 -0500
From: Bob Jones <Bob.Jones@wku.edu>
Subject: Help with Net::LDAP authentication.
Message-Id: <39D8D7F3.F15C726D@wku.edu>
Hello all. I'm trying to authenticate users against an LDAP database.
I am running Perl 5.005_03 on a Solaris 2.5.1 machine. I have installed
the Net::LDAP module.
What I want to do is have a user submit their username and password,
authenticate against the LDAP database and then return the appropriate
output depending on whether or not they are authenticated.
I can handle getting the username and password and outputting the data,
but how do I do the authenticatio part? Anyone have a script which does
this they could share with me as an example?
I appreciate the help,
Bob Jones
Bob.Jones@WKU.EDU
------------------------------
Date: Mon, 02 Oct 2000 21:41:38 GMT
From: kag@kag.citysource.com (Kenneth Graves)
Subject: Re: Help with Net::LDAP authentication.
Message-Id: <slrn8ti08j.mv.kag@kag.citysource.com>
In article <39D8D7F3.F15C726D@wku.edu>, Bob Jones wrote:
>What I want to do is have a user submit their username and password,
>authenticate against the LDAP database and then return the appropriate
>output depending on whether or not they are authenticated.
my($username, $password) = &from_somewhere;
# change if you aren't running slapd on the same host as the perl script
my $l = new Net::LDAP 'localhost';
# change to match whatever DN style you've chosen
my $result = $l->bind(dn=>"uid=$username,ou=unit,o=you.org",
password=>$password);
if ($result) {
return "You're good"
} else {
return "Never heard of you"
}
(On the off chance this is a web thing, and Apache is in the picture,
consider mod_auth_ldap.)
--kag
------------------------------
Date: Mon, 02 Oct 2000 18:07:53 GMT
From: malatov@my-deja.com
Subject: Help With Script!!
Message-Id: <8raitj$vtv$1@nnrp1.deja.com>
When I try to run this script I get an error message:
"Can't Locate object method "url" via package HTTP::Headers at
C:\perl\site\lib\HTTP\Message.pm line 189."
Do I have something installed wrong?? Or is there something wrong with
my scirpt?
use LWP;
use HTTP::Cookies;
## Create a UserAgent
$ua = new LWP::UserAgent;
$cookie_jar = new HTTP::Cookies;
$ua->cookie_jar($cookie_jar);
$url = "http://www.museumcompany.com/misc/paris/signup.asp";
## Create the request; $url is the URL to post to
$request = new HTTP::Request('post', $url);
## Add headers this way
$request->header(Pragma => 'no-cache');
## Set the POST content this way; change the content to fit your needs
$request->content('first_name=bob');
## Use the UserAgent to submit the request and get the response
$response = $ua->request($request);
$cookie_jar->add_cookie_header($response);
if ($response->is_success)
{
print "Success!!\n";
}
else
{
print "Failed: ", $response->status_line, "\n";
}
## Get the body of the response
$body = $response->content;
print "$body";
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 2 Oct 2000 14:42:57 -0400
From: "Victor Felix" <vf1@smarts.com>
Subject: Re: How can I install DBI?
Message-Id: <8rakvh$4vg$1@versa.smarts.com>
Well,
Try just "install DBI" at the ppm prompt.... It worked for me...
-Victor
"Ben Ben" <idleisidle@usa.net> wrote in message
news:01VB5.4310$rr.70575@vixen.cso.uiuc.edu...
> I run MySQL server and Perl 6.18 server on Win98, and now I want to
install
> the DBI package.
> I perform:
> ppm install DBI.ppd
>
> and the result is:
>
> Retrieving package 'DBI.ppd'...
> Error installing package 'DBI.ppd': Could not locate a PPM binary of
> 'DBI.ppd' for this platform
>
> Somebody help me please.
>
>
------------------------------
Date: Mon, 02 Oct 2000 20:59:23 GMT
From: zephar@my-deja.com
Subject: How do I link a C Library into Perl
Message-Id: <8rasv9$9di$1@nnrp1.deja.com>
Can anyone tell me how to link a C Library
on Solaris into Perl. I have been able to
link in C code but not much luck with libraries.
I have a vendor who has a product that wants
the library to be linked into a C program. But
the application really is a string based application,
ideal for perl. If I could link the library into perl
then run natively from there it would be perfect.
Throughput is very low, maybe 1 record every 10
seconds.
Can anyone point me to the right reference?
many thanks
Jim ddss@usa.net
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 2 Oct 2000 21:44:29 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: How do I link a C Library into Perl
Message-Id: <eli$0010021730@qz.little-neck.ny.us>
In comp.lang.perl.misc, <zephar@my-deja.com> wrote:
> Can anyone tell me how to link a C Library
> on Solaris into Perl. I have been able to
> link in C code but not much luck with libraries.
Methinks you've not read the FAQs/documentation very well.
perldoc -q 'linking C' will tell you to read perlxs, xsubpp,
and perlguts. But I think you don't understand that you can't
just call arbitrary C functions from perl: they need a special
format, which will likely mean writting 'glue' code around
the API to the library.
> I have a vendor who has a product that wants
> the library to be linked into a C program. But
> the application really is a string based application,
> ideal for perl. If I could link the library into perl
> then run natively from there it would be perfect.
Inline.pm is too new for the FAQs, but worth considering
as well.
perl -MCPAN -e 'install("Inline");' && perldoc Inline
Elijah
------
use Inline C=>qq<#include <string.h>\nSV*japh(){char*JAPH="Just Another>
.qq< Perl Hacker\\n";return newSVpv(JAPH,strlen(JAPH)+1);}>;print japh()
------------------------------
Date: Mon, 02 Oct 2000 18:30:20 GMT
From: coughlan@gothaminteractive.com
Subject: How to access form data in CGI.pm?
Message-Id: <8rak7s$14t$1@nnrp1.deja.com>
I am using CGI.pm. How can I do a global search of A for B in all my
form data? I tried:
tr/B/A/ foreach $query->all_parameters;
and
tr/B/A/ foreach $query->param();
I can't seem to find the structure that holds the data to run the tr
function.
Any suggeastions?
TIA,
Mike Coughlan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 02 Oct 2000 19:12:43 GMT
From: Laird Nelson <ljnelson@unix.amherst.edu>
Subject: Re: How to access form data in CGI.pm?
Message-Id: <39D8DE10.46D9F515@unix.amherst.edu>
coughlan@gothaminteractive.com wrote:
>
> I am using CGI.pm. How can I do a global search of A for B in all my
> form data?
By reading documentation and rephrasing your question.
> I tried:
>
> tr/B/A/ foreach $query->all_parameters;
>
> and
>
> tr/B/A/ foreach $query->param();
You didn't even check the perlop manpage, did you?
If I wanted to post this question, the first thing I'd do would be a man
perlop, where it says this, in part:
Examples:
$ARGV[1] =~ tr/A-Z/a-z/; # canonicalize to lower case
$cnt = tr/*/*/; # count the stars in $_
$cnt = $sky =~ tr/*/*/; # count the stars in $sky
$cnt = tr/0-9//; # count the digits in $_
(Note that nowhere in these examples can you cause tr/// to work on
something without binding it via "=~" first.)
Then I did man perlsyn and grepped for "foreach" so that I would be sure
to be well informed about the foreach function before I made a fool of
myself on a public newsgroup. It said, in part:
Examples:
foreach my $elem (@elements) {
$elem *= 2;
}
So then I'd finally do a man CGI or a perldoc CGI so that I could read
this part from the examples:
foreach $key ($query->param) {
print "<STRONG>$key</STRONG> -> ";
@values = $query->param($key);
print join(", ",@values),"<BR>\n";
}
...and then, having found enough information to use my brain, I'd do
this:
my $key;
foreach $key ($query->param) {
$key =~ tr/A/B/;
}
...which would answer the question, "How can I turn all As found in the
*names* of my form parameters into Bs?". That may or may not be the
question you were asking; I'm not sure.
Hope this helps,
Cheers,
Laird
------------------------------
Date: Mon, 2 Oct 2000 16:07:22 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: How to access form data in CGI.pm?
Message-Id: <Pine.A41.4.21.0010021605220.14510-100000@ginger.libs.uga.edu>
On Mon, 2 Oct 2000, Laird Nelson wrote:
> If I wanted to post this question, the first thing I'd do would be a man
> perlop, where it says this, in part:
>
> Examples:
> $ARGV[1] =~ tr/A-Z/a-z/; # canonicalize to lower case
> $cnt = tr/*/*/; # count the stars in $_
> $cnt = $sky =~ tr/*/*/; # count the stars in $sky
> $cnt = tr/0-9//; # count the digits in $_
>
> (Note that nowhere in these examples can you cause tr/// to work on
> something without binding it via "=~" first.)
You mean except for the second and fourth examples that are implicitly
bound to $_?
Brad
------------------------------
Date: Mon, 2 Oct 2000 16:10:49 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: How to access form data in CGI.pm?
Message-Id: <Pine.A41.4.21.0010021607430.14510-100000@ginger.libs.uga.edu>
On Mon, 2 Oct 2000 coughlan@gothaminteractive.com wrote:
> I am using CGI.pm. How can I do a global search of A for B in all my
> form data? I tried:
>
> tr/B/A/ foreach $query->all_parameters;
>
> and
>
> tr/B/A/ foreach $query->param();
>
> I can't seem to find the structure that holds the data to run the tr
> function.
>
> Any suggeastions?
>
> TIA,
> Mike Coughlan
I'm confused about what exactly you mean by "global search of A for B".
You seem to be trying to translate all of your B's to A's. Could you
perhaps explain what you want a different way--maybe with an example?
Brad
------------------------------
Date: Mon, 2 Oct 2000 13:24:15 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to access form data in CGI.pm?
Message-Id: <MPG.14428ec9e58c36e698adf1@nntp.hpl.hp.com>
In article <8rak7s$14t$1@nnrp1.deja.com> on Mon, 02 Oct 2000 18:30:20
GMT, coughlan@gothaminteractive.com <coughlan@gothaminteractive.com>
says...
> I am using CGI.pm. How can I do a global search of A for B in all my
> form data? I tried:
>
> tr/B/A/ foreach $query->all_parameters;
>
> and
>
> tr/B/A/ foreach $query->param();
>
> I can't seem to find the structure that holds the data to run the tr
> function.
UNTESTED:
$query->param($_) =~ tr/B/A/ for $query->param;
But that fails if a named paramater has multiple values.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 2 Oct 2000 11:38:58 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to get length of scalar?
Message-Id: <MPG.1442761f6d8d9f8c98ade9@nntp.hpl.hp.com>
In article <m34s2vyw6j.fsf@solo.david-steuber.com> on Mon, 02 Oct 2000
17:44:53 GMT, David Steuber <nospam@david-steuber.com> says...
...
> In the "how long is a piece of string?" catagory, what does the length
> function do with scalers that are references? Will it return the
> numerical length of the address of the referenced item if it were
> expressed the way Perl returns these things?
What happened when you tried it?
(Translation: Surely you have an installation of perl that you can test
this trivia on without bothering the newsgroup.)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 2 Oct 2000 12:31:55 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: How to get length of scalar?
Message-Id: <39d8e2b5@news.microsoft.com>
"Mark Carruth" <mcarruth@talk21.com> wrote in message
news:8r4dh2$q55$1@uranium.btinternet.com...
> Yes, do you?
Yes? Yes to what? What are you talking about?
Beginning a conversation with just "Yes" is not exactly informative.
> --
[Why do you put all those qoutes into your signature? Signatures should not
exceed 4 lines. Your's is WAY to long]
> -----------------------------------------------
> Mark Carruth
> mcarruth@talk21.com
> "Zaphod" <zaphod@psnw.com> wrote in message
> news:39D509BD.8CF36601@psnw.com...
> Mark Carruth wrote:
> >
> > I would just like to add, that to round off this argument, if you people
> can
> > leave it at this, is that I didn't even post this reply to any of you
> > people, so I don't really think you have the right to start criticising,
> > then the information isn't directed at you.
'cuse me? You did direct all your postings to several million people all
around the world. If it wasn't meant for reading by those millions of
people, then why did you post it in the first place?
> > A voice version of this would be "eavestropping" or listening to other
> > peoples conversations
Which other people? Are you telling me that when you are broadcasting
postings to the world, then you do not expect people to read your articles?
What a concept.....
>>which I consider to be down right rude, and
>> therefore you people must all be down right rude.
If it would be a private conversation then you would be damn right. And it
is heavily frowned upon to post e.g. private email with prior permission of
the author. But what does that have to do with your postings to Usenet?
You have no clue whatsoever about what the Usenet is, do you?
jue
------------------------------
Date: 02 Oct 2000 06:37:28 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to realize new or malloc in perl
Message-Id: <m1em1zmkiv.fsf@halfdome.holdit.com>
>>>>> "i0519" == i0519 <i0519@my-deja.com> writes:
i0519> I want to new some object in perl.
i0519> Could andbody please give me some advice?
See <http://www.perldoc.com/perl5.6/pod/perlboot.html>, et. seq.
rint "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL: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!
------------------------------
Date: Mon, 02 Oct 2000 21:41:53 GMT
From: "Gene" <gene@allsysinc.com>
Subject: Re: Huh?
Message-Id: <Bi7C5.925$Kc.94283@news.flash.net>
"Jeff Zucker" <jeff@vpservices.com> wrote in message
news:39D5309D.5E7CC03A@vpservices.com...
> Drew Simonis wrote:
> >
> > Jeff Zucker wrote:
> > >
> > > Gene wrote:
> > > >
> > > > What's all that about?
> > >
> > > It is about the fact that this is an international newsgroup and
> > > therefore English is not the only language permitted.
> >
> > Show off!! =P
>
> Well, maybe just a little. But don't you worry my boy, work hard and
> someday you too will be able to spot a missing slash in a shebang. ;-)
>
> P.S. Gene: the French dude was just having trouble executing his
> scripts. If it had been anything more general, I would have translated.
>
> --
> Jeff
I don't have a problem with other languages, I was just curious what it was
about.
Thanks
-gene
------------------------------
Date: Mon, 02 Oct 2000 17:40:23 GMT
From: sarbayo@telis.org (Steve A.)
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <39d8bdc4.1426347@news.inreach.com>
>How can I open this file from within a CGI script and read the
>contents and write them to the browser screen as if the file had been
>#INCLUDEd using SSI.
If this is a clean HTML text file , it should be as easy as this:
"
open(FHANDLE, $your_filename);
while(<FHANDLE>) {
$Html_data .= $_;
}
close(FHANDLE);
print $Html_data;
"
I use this simple code to do just that, read in an entire file at
once, into a "string", and print the entire file/string.
------------------------------
Date: Mon, 2 Oct 2000 12:05:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <MPG.14427c5975fc21ed98adea@nntp.hpl.hp.com>
In article <39d8bdc4.1426347@news.inreach.com> on Mon, 02 Oct 2000
17:40:23 GMT, Steve A. <sarbayo@telis.org> says...
> >How can I open this file from within a CGI script and read the
> >contents and write them to the browser screen as if the file had been
> >#INCLUDEd using SSI.
>
> If this is a clean HTML text file , it should be as easy as this:
> "
> open(FHANDLE, $your_filename);
> while(<FHANDLE>) {
> $Html_data .= $_;
> }
> close(FHANDLE);
> print $Html_data;
> "
> I use this simple code to do just that, read in an entire file at
> once, into a "string", and print the entire file/string.
There are more efficient ways to read an entire file into one string.
But why do that at all?
Simply this:
print while <FHANDLE>;
makes a lot more sense, and is far easier on the memory of the computer
if the file is large.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 2 Oct 2000 20:58:41 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <Pine.GHP.4.21.0010022057070.27436-100000@hpplus03.cern.ch>
On Mon, 2 Oct 2000, Steve A. wrote:
> open(FHANDLE, $your_filename);
> while(<FHANDLE>) {
> $Html_data .= $_;
> }
> close(FHANDLE);
> print $Html_data;
Bizarre. And no tests for success, either. Score adjusted.
------------------------------
Date: Tue, 3 Oct 2000 09:52:21 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Is this is Regexp bug?
Message-Id: <8raspp$e07$1@hermes.nz.eds.com>
Andrew N. McGuire wrote in message ...
>
>I will let another validate whether what you have is a bug or not, as
>it is getting late, and I have to get some rest. However, if you are
>trying to validate an email address, do a perldoc -q email and read:
>
>How do I check a valid mail address?
>
>Also, not mentioned there is Abigail's RFC822::Address module, for which
>you will also need Parse::ReDescent.
Also Email::Valid
------------------------------
Date: Mon, 02 Oct 2000 20:57:14 GMT
From: johnclyman@my-deja.com
Subject: Re: Is this is Regexp bug?
Message-Id: <8rasr7$9bg$1@nnrp1.deja.com>
In article <w2IB5.4670$L12.116161@news2-
win.server.ntlworld.com>,
"Glyndwr" <glynFOOdwr@FSCKdeleteEmeD.co.uk>
wrote:
> I was recently approached by a friend in my
(poorly filled) role as a Perl
> guru and asked to help with a script: he wanted
to check if a string
> supplied from a CGI input was a valid email
address (it's a formmail
> script). The line I came up with was:
> if ($contactemail =~ /^[a-zA-Z0-9.\-]+@[a-z-A-
Z0-9.\-]+/) {
> which is a little crude, but it was late and I
couldn't concentrate very
> well ;o)
>
> However, he finds this chokes on email
addresses where the domain name
> contains a hyphen. I frowned, and bashed out a
quick test script:
> ##########
> foreach (<DATA>) {
> chomp $_;
> if ($_ =~ /^[a-zA-Z0-9.\-]+@[a-z-A-Z0-9.\-]
+/)
>
> print "$_ is valid\n";
> } else {
> print "$_ is invalid\n";
> }
> }
> __DATA__
> x@y.com
> foo.bar@doo-bar.uk
> foo@bar.com
> ###########
>
> Which runs fine - they are all validated as
valid email addresses (on
> ActiveState Perl 613). But his script still
chokes, reportiong this error in
> the HTML output:
>
> ###########
> Error code 500
> Program error:
> /^[A-Za-z0-9][A-Za-z0-9.@%:foo.bar@foo-
bar.uk_+=~-]+$/:
> invalid [] range in regexp
at /usr/local/bin/cgiperl line 164.
> ###########
>
> Somehow, the $contactemail variable has ended
up inside the regexp, and I
> really can't see how. He's running some odd
version of Perl called SafePerl,
> which is documented here
<http://www.oucs.ox.ac.uk/web/cgi_programs.html>;
> don't know if that's relevant.
>
> I'm wondering if it's a bug in Perl, but I
suspect it's more likely I'm
> being thick. Can anyone help?
It seems as if the '\-' in the character class is
causing your particular interpreter to choke.
When I need to include a hyphen in a character
class I always make it the first entry; you might
try something like this and see if it works:
[-a-zA-Z0-9.]
Also, you should be aware that this regex will
reject some perfectly legal e-mail addresses such
as those including underscores (in my experience
firstname_lastname@company.com is a fairly common
address format). There are probably other
legitimate characters as well -- you might want
to check the appropriate RFC to be sure.
Cheers
>
> --
> -=G=-
> print join " ",reverse split /\s+/,'hacker.
Perl another Just',"\n";
> Web:
http://www.fscked.co.uk
ICQ: 66545073
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 2 Oct 2000 22:04:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Is this is Regexp bug?
Message-Id: <8rb0p8$lif$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Bart Lateur
<bart.lateur@skynet.be>],
who wrote in article <3d3htsklu2ndu94i9ub6ghdo6ru4pdtdc3@4ax.com>:
> What's the contents of @[ anyway? Nothing, AFAIK.
Does not matter. It is a larryism: special arrays are not
interpolated. ("Special" refers to the name only, not to the semantic.)
Another DWIMer with the only benefit of confusing non-newbies...
Ilya
------------------------------
Date: 2 Oct 2000 21:27:11 GMT
From: eli@panix5.panix.com (B. Elijah Griffin)
Subject: Re: Just Another Perl Hacker
Message-Id: <8rauje$r6p$1@news.panix.com>
In comp.lang.perl.misc, Yanick Champoux <yanick1@sympatico.ca> wrote:
> ($_,$y)=('Yhre lo .kePnarhtretcae', '(.) (.)');
> $y=~s/\(/(./gwhile s/$y/$2$1/xg;print # @
> # `---'
Hmmm. You could easily get a \n in there:
($_,$y)=("Yhre lo .kePnarhtretcae\n", '(.) (.)');
$y=~s/\(/(./gwhile s/$y/$2$1/xg;print# @
# `---'
Elijah
------
perl -ce 'CHECK{print"just another $^X hacker\n"if${"\cC"}}' 2>/dev/null
------------------------------
Date: Sat, 30 Sep 2000 22:26:32 GMT
From: sarbayo@telis.org (Steve A.)
Subject: Re: microsoft build for perl
Message-Id: <39d666c1.2783489@news.inreach.com>
On Sun, 1 Oct 2000 03:36:38 +0800, "Cameron Elliott"
<celliot@tartarus.uwa.edu.au> wrote:
>does anyone know anywhere else I can get the latest stable version of perl?
>A reliable source?
Yes,
http://www.indigostar.com/
ftp://ftp.indigostar.com/pub/indigoperl-5.6.zip
>I cant seem to get it from www.perl.com and I have had problems with some
>dl's from other places.
I too tried the www.perl.com and Activestate / Activeperl
and had problems until I found a post for Indigostar.
I did find my system was lacking some DLL's tho, which Indy helped me
locate and a Microsoft Windows upgrade file:
http://www.microsoft.com/windows95/downloads/contents/WUAdminTools/S_WUNetworkingTools/W95Sockets2/Default.asp
It's been running flawlesly since.
That's:
http://www.indigostar.com/
or just ftp it:
ftp://ftp.indigostar.com/pub/indigoperl-5.6.zip
steve
------------------------------
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 V9 Issue 4495
**************************************