[8665] in Perl-Users-Digest
Perl-Users Digest, Issue: 2282 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 9 12:07:19 1998
Date: Thu, 9 Apr 98 09:01:35 -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 Thu, 9 Apr 1998 Volume: 8 Number: 2282
Today's topics:
Re: Perl Compiler for NT (Stuart McDow)
Re: Perl.exe <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Q About Perl module and Data Structures (Fliess Alon )
Re: Q About Perl module and Data Structures (Jean-Damien Durand)
question about &parse_form_data... <dswain@thetsn.com>
Re: Read file and interpolate contents as string? <jefpin@bergen.org>
Re: RMS should be invited to O'Reilly's "Free Software (Stefaan A Eeckels)
Rookie, How do I: Prompt browser to download html file <defaultuser@lhsc.on.ca>
s///e eval difficulty <kevan@nol.net>
Re: scanf substitute in perl (Andrew M. Langmead)
Re: Strange "Modification of a read-only value attempte <james.a.squire@boeing.com>
Re: Why can't I WRITE/CREATE files from perl5 CGI scrip <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Apr 1998 15:54:01 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Perl Compiler for NT
Message-Id: <6giqup$jga$1@ns1.arlut.utexas.edu>
"Grinch" <grinch@whoville.com> writes:
> Mark Kucera wrote in message ...
> >IS THERE a PERL Compiler for NT or win95. if so what is it called, and
> >where can i get it...
>
> No (but there is an interpreter), Perl, http://www.perl.com
Perl is a compiler, but not usual kind. It's a "compile and run"
compiler.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"It is obvious that about 750,000 people ago, Austin was a wonderful City."
------------------------------
Date: Thu, 9 Apr 1998 06:25:13 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Perl.exe
Message-Id: <6gii7u$6oh@bgtnsc02.worldnet.att.net>
Try this from the command line (if your installation of Perl is on C:; if
not, adjust the script accordingly):
cd \
dir /s odbc.pm
If that shows anything but "file not found," make a note of which directory
ODBC.PM is in and strip off the leading Win32 (e.g., if it's in the
C:\perl\lib\wrongdir\win32 directory, the path you want is
C:\perl\lib\wrongdir)
Now run this Perl one-liner:
perl -e "print join(\"\n\",@INC);"
If the directory that win32\odbc.pm is in is not in the list that the
one-liner generated, you need to move the win32 directory into a directory
that is. (Just drag and drop it in Explorer).
Hope this helps,
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Tara Bennett wrote in message <352C9DCB.3DBABC4A@rnib.org.uk>...
>I am having problems with running the following script, I wan it to
>query a database but it is coming up with the following error.
>Can't locate Win32/ODBC.pm in @INC at psodbc.pl line 8. BEGIN
>failed--compilation aborted at psodbc.pl line 8.
>What's the problem ?
>
>
>#!/progra~1/perl/bin/perl
>
>#Fetch data
># April 1998
>
>#set variables
>
>use Win32::ODBC;
>$DSN = "richard1"; #Opens a connection to my database
>if (!($Data = new Win32::ODBC($DSN))) {
> print "Error conencting to $DSN\n";
> print "Error: " . Win32::ODBC::Error() . "\n";
> exit;
>}
>
>
>
>print "HTTP/1.0 200 OK\n";
>print "Content-type:text/html\n\n";
>
>$SqlStatement = "SELECT * FROM customers";
> if ($Data ->sql ($sqlstatement)) {
> print "SQL failed.\n";
> print "Error: " . $Data->() . "\n";
> $Data ->Close();
> exit;
>}
>while ($Data->FetchRow()) {
> ($customerid, $Companyname, $contactfirstname, $contactlastname,
> $billingaddress, $city, $stateorprovince, $postalcode, $country,
> $contacttitle, $phonenumber, $faxnumber, $emailaddress ) = $Data ->Data
>
> ("customerid", "companyname", "contactfirstname", "billingaddress"
> "city", "stateorprovince", "postalcode", "country", "contacttitle",
> "phonenumber", "phonenumber", "faxnumber", "emailaddress");
>}
>
>print "<HTML>\n";
>print "<HEAD><TITLE>Result of search</TITLE></HEAD>\n";
>print "<BODY>\n";
>print "<H2>Result $customerid</H2>\n";
>print "<H2>Result $comapnyname</H2>\n";
>print "<H2>Result $contactlastname</H2>\n";
>print "</BODY>\n";
>print "</HTML>\n";
>$Data->Close ();
>
------------------------------
Date: 9 Apr 1998 13:18:24 GMT
From: s2410377@techst02.technion.ac.il (Fliess Alon )
Subject: Q About Perl module and Data Structures
Message-Id: <6gihr0$u70$1@techftp.technion.ac.il>
My first question is:
I am trying to create modules in PERL5.
I looked for it in some books and I can't figure out how it should work.
Can anyone help me and show me the way to create modules.
My second question is:
I know (from programming in C) how to create data structures and how to create array. In c it is very easy to combine them. (array of structures or pointers to structures). How can it be done in Perl?
Please reply your answer to:
irit@sela.co.il
( am using a news reader of a college.)
------------------------------
Date: 9 Apr 1998 13:36:57 GMT
From: ddurand@hpplus11.cern.ch (Jean-Damien Durand)
To: irit@sela.co.il (Fliess Alon )
Subject: Re: Q About Perl module and Data Structures
Message-Id: <6giitp$b38$1@sunnews.cern.ch>
> Can anyone help me and show me the way to create modules.
man perlmod
> structures). How can it be done in Perl?
man perldata
Well, I think that 'man perl' will redirect you too all info you need.
Cheers, Jean-Damien.
--
*******************************************************
* Jean-Damien Durand (Jean-Damien.Durand@cern.ch) *
* www : http://wwwinfo.cern.ch/~ddurand/ *
*******************************************************
------------------------------
Date: Thu, 09 Apr 1998 11:06:09 -0400
From: David Swain <dswain@thetsn.com>
Subject: question about &parse_form_data...
Message-Id: <352CE3E1.C9A4802F@thetsn.com>
Hello, I need a little help here. I am trying out a perl program from
page 180-CGI programming o'reilly book. The code is as follows:
#!/usr/bin/perl5
&parse_form_data(*simple);
$user = $simple{'user'};
if ($user =~ /[;><&\*`\|]/) {
&return_error (500, "CGI Program Alert", "What are you tyring to do?");
} else {
print "Content-type: text/plain", "\n\n";
print "Here are the results of your query: ", "\n";
print '/usr/local/bin/finger $user';
print "\n";
}
exit (0);
...The error I get when running it off the server is:
Undefined subroutine &main::parse_form_data called at secure.cgi line 3
so my question is...what is parse_form_data, isn't is included with
Perl? I have version 5.003, on red hat linux box. This has been a big
problem to me, and I can't figure out why it(perl) can't find the
parse_form_data subroutine. I'm sure it's probably something really
simple, but I am blind to it. Please help.
Thanks,
David Swain
------------------------------
Date: Thu, 9 Apr 1998 10:23:44 -0400
From: Jeff Pinyan <jefpin@bergen.org>
To: Bill_York <Bill_York@MathWorks.com>
Subject: Re: Read file and interpolate contents as string?
Message-Id: <Pine.SGI.3.95.980409102025.8753B-100000@vangogh.bergen.org>
open (F, "foo") or die();
$/ = undef;
$foo = <F>;
close(F);
$time = convertTimeToWallClock(time); # assume this works
print($foo); # returns foo as it appears on disk
$bar = INTERPOLATE($foo);
print($bar); # returns foo with the current time replaced for $time.
Your INTERPOLATE thing should be this, I believe, as per Programming Perl
edition 2.
($bar = $foo) =~ s/(\$\w+)/$1/eeg;
basically, that means that it finds a variable name in the string, then it
evaluates the variable in the string.
--
When the only tool you own is a hammer, every problem begins to
resemble a nail.
- Abraham Maslow
Jeff Pinyan | users.bergen.org/%7Ejefpin | techmaster@bergen.org
ICQ# 10222129 | 10222129@pager.mirabilis.com | qw[jeff] on EFnet
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$_=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print;}}
------------------------------
Date: 9 Apr 1998 13:28:07 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <6giid7$2j0$1@justus.ecc.lu>
In article <6ggin4$oud$1@mathserv.mps.ohio-state.edu>,
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> [A complimentary Cc of this posting was sent to Joe Buck
> <jbuck@synopsys.com>],
> who wrote in article <6gg9st$9o3@hermes.synopsys.com>:
>> >> Hmm. If RMS does not qualify, then maybe Bill Gates is invited
>> >> (because IE is a freeware).
>>
>> ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
>> >No it is not. You are mixing "free" and "free".
>>
>> You clearly don't get it. The notion of having a free software summit
>> and not inviting RMS is nonsense. Hence the previous poster's comment
>> that O'Reilly might be confused as to what free software means.
>
> You clearly never had any relation to GPLed software. GPL is as far
> from "free" as you can get - preserving an impression of being free.
You mean you're not 'free' to do with it as you please ;-)
That's true - you can't (in all honesty ;-) grab bits and pieces of
GPL'd code and pass them off as your own. You have to apply the GPL
to whatever modifications or enhancements you make to the program.
The source will be available to anyone who cares to ask.
That limits people who make 'derivative works'. It does *not* mean
the software is not 'free' ('libre').
>
> While I applaud most other efforts by RMS, GPL is a clear indication
> of what people should not use.
People writing software they want to share with other people,
and assure that their work will remain accessible, should
use the GPL. Better still, they should assign the copyright to
the FSF. I'm quite sure (I'd bet my last dollar on that) RMS
and the FSF will never pull a TOG on us.
Think about this - would you rather have GPL'd software maintained
and serviced by programmers, or Microsoft bloatware with regular,
expensive, incompatible updates, maintained and serviced by the
cheapest people MS can employ in their 'Customer Service'
department?
Take care,
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
"Don't worry about people stealing your ideas. If your ideas
are any good, you'll have to ram them down people's throats."
-- Howard Aiken
------------------------------
Date: Thu, 09 Apr 1998 11:40:02 -0400
From: defaultuser <defaultuser@lhsc.on.ca>
Subject: Rookie, How do I: Prompt browser to download html file as plain text/auto del files on NT
Message-Id: <352CEBD2.82859BB3@lhsc.on.ca>
I'm pretty new to Perl/CGI and I can't seem to find how to prompt the
browsers download to save
HTML STDOUT to text.
Basically I have a script which outputs a html doc to the browser, from
a database, and I want the user to have the option of clicking a button
or somehthing and it would download the doc as plain text to their HD.
This script also creates unique temp html files, I want these files to
either delete themselves after say
an hr or delete them all at say midnight unless their under an hr old.
I'm on a NT server.
Please help!
Lawrence,
netadmin@critcare.lhsc.on.ca
------------------------------
Date: Thu, 09 Apr 1998 14:59:14 GMT
From: "Kevan Granat" <kevan@nol.net>
Subject: s///e eval difficulty
Message-Id: <01bd63c7$caf4e250$326d5cc0@kevan>
I've run into a snag using the s///e functionality. I'm trying to
implement a simple way of formatting interpolated variables in printed
strings - I've seen several ways of doing something similar, but not really
the way I'd like to do it. I'd like to have the string:
X = ${Xdisp, %6.2f}, Y = ${Ydisp, %6.2f}
evaluate to:
X = 104.22, Y = 511.33
assuming that $Xdisp and $Ydisp were set to their values earlier.
I've got a kludged method working, but it's SLOW. The original method of
doing this that I wanted to use, looked something like below.
Unfortunately, I can't seem to get the eval to work quite right. There's
some sort of interpolation/escaping/quoting voodoo going on.
$String =~ s/(\$\{[^,\s]*)\s*,\s*(\%[^\}]*\}/sprintf("$2", $1}/eg ;
When I test this, _without_ the eval (s///e), the result looks correct,
like this: 'sprintf("%6.2f", ${Xdisp})'. I can 'print eval($String)' and
I get the correct result. But when I add the s///e back on, I get
nothing... any ideas?
Kevan Granat
kevan@nol.net
------------------------------
Date: Thu, 9 Apr 1998 13:44:30 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: scanf substitute in perl
Message-Id: <Er5FI6.89w@world.std.com>
Ronald J Kimball <rjk@coos.dartmouth.edu> writes:
>> Andrew M. Langmead wrote in message ...
>>
>> >($string1, $string2, $num) = ( $line =~ /(\S+)\s+(\S+)\s+([-+]?\d+)/ );
>These two incorrectly assume there must be whitespace after each string,
>so change '\s+' to '\s*'.
But scanf() terminates scanning the "%s" format (with no maximum field
width) at the first whitespace character, so \s+ is necessary.
--
Andrew Langmead
------------------------------
Date: Thu, 9 Apr 1998 14:54:30 GMT
From: James A Squire 312 M 193884 <james.a.squire@boeing.com>
Subject: Re: Strange "Modification of a read-only value attempted" error
Message-Id: <352CE125.695@boeing.com>
Ronald J Kimball wrote:
>
> James A Squire 312 M 193884 wrote:
> >
> > In the meantime, what kinds of obscure things could cause a value to
> > be considered by Perl to be read-only?
>
> Two that I know of:
>
> Aliasing a variable to a read-only special variable, such as:
>
> *x = \$4;
>
> Aliasing a variable to a constant, such as:
>
> *x = \'1234';
Well, the only occurrences I found of the '\' character are the \n's in
print statements and a few occcurrences inside "/.../". So, I'm
guessing that what you came up with is not obscure enough.
Any other possibilities?
In the meantime, if I "use diagnostics" as was suggested in the WELCOME
message I got after my first post to this group, will perl actually tell
me which entity on line 302 (or whatever) it thinks is the read-only
value instead of just giving me the line number? That additional
information might help me. I'm just guessing it was talking about the
array, but I could be wrong.
Thanks.
--
James Squire Send my Spam to mailto:webmaster@cyberpromo.com
MDA^H^H^HBoeing St. Louis http://www.boeing.com
------------------------------------------------------------------------
Hey Novell, is it too much to ask that when I log out of NetWare, it
should ACTUALLY record that I've logged out, so that it doesn't have to
scramble around the house laboriously when I try to log back in, forcing
me to ring the door bell 20 times??????
Opinions expressed here are my own and NOT my company's
------------------------------------------------------------------------
"We were talking the other day about how nobody's seen a Vorlon before
and he said that according to legend, one human did see a Vorlon...he
turned to stone."
-- Laurel Takeshima, "The Gathering"
------------------------------
Date: Thu, 9 Apr 1998 07:55:35 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: cicatrix@hotmail.com
Subject: Re: Why can't I WRITE/CREATE files from perl5 CGI script
Message-Id: <Pine.GSO.3.96.980409075508.9100C-100000@user2.teleport.com>
On 8 Apr 1998, Brian Zisk wrote:
> I am trying to create a file (open a file to write to) from within my CGI
> script, but all I get is a 'permission denied' error (in $!).
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 2282
**************************************