[11349] in Perl-Users-Digest
Perl-Users Digest, Issue: 4949 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 20 12:02:01 1999
Date: Sat, 20 Feb 99 09:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 20 Feb 1999 Volume: 8 Number: 4949
Today's topics:
Re: (blush) Stupid question about Perl in Win/DOS (shud <cederstrom@removethis.kolumbus.fi>
Re: <<HERE code <gellyfish@btinternet.com>
Re: Anyone know of a stock quote script? (Clay Irving)
Re: beginners question <gellyfish@btinternet.com>
Re: can I run perl on Win 98?????? (I R A Aggie)
Re: Cannot fathom the error message <gellyfish@btinternet.com>
Re: converting a standard number to a currency-like num <Allan@Due.net>
FAQ 8.42: How do I use an SQL database? <perlfaq-suggestions@perl.com>
FAQ 8.43: How do I make a system() exit on control-C? <perlfaq-suggestions@perl.com>
FAQ 8.44: How do I open a file without blocking? <perlfaq-suggestions@perl.com>
Re: grabbing websites with time limit? <gellyfish@btinternet.com>
Re: guestbook perl script <gellyfish@btinternet.com>
guestbook <dstern@aschwebhosting.com*nospam*>
Re: How do ignore delimiters within quoted strings? (Clay Irving)
Re: How do ignore delimiters within quoted strings? <gellyfish@btinternet.com>
Re: HOW pass input to perlscript ? <gellyfish@btinternet.com>
Re: HTML File Upload <gellyfish@btinternet.com>
Re: Looking for CGI database apps <greg2@surfaid.org>
Re: Looking for two CGI Scripts <gellyfish@btinternet.com>
Re: Need Random Link Script! HELP! <gellyfish@btinternet.com>
Re: perl 5.005_02 compile on FreeBSD 3.0 <gellyfish@btinternet.com>
Re: perl compiled code cacheing <dgris@moiraine.dimensional.com>
Re: Perl posts to newsgroups? <gellyfish@btinternet.com>
Re: Printing all environment variables <Allan@Due.net>
Q on diff of array vs hash <tavi367@ibm.net>
Q on localtime <tavi367@ibm.net>
Re: splitting Pairs of characters (Clay Irving)
Re: WWW:Search <gellyfish@btinternet.com>
Re: WWW:Search <gellyfish@btinternet.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 20 Feb 1999 16:49:14 +0200
From: "Juho Cederstrvm" <cederstrom@removethis.kolumbus.fi>
Subject: Re: (blush) Stupid question about Perl in Win/DOS (shudder)
Message-Id: <7ammg4$6k1$4@news.kolumbus.fi>
> echo "line1\nline2\nline3\n" | C program
Maybe you should try something like this:
open HANDLE, "| command";
print HANDLE "line1\nline2\nline3\n";
close HANDLE;
I've never tried it myself, so don't blame me if syntax is wrong.
--
# this is a perl script which will display my email address
$_="acbecddeerfsgthriojmkaltmknoolpuqmrbsutsudvowtxfyi";
s/(.)(.)/$2/eg;s/at/@/;s/dot/./;print $_;
------------------------------
Date: 20 Feb 1999 16:47:12 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: <<HERE code
Message-Id: <7amoug$1hr$1@gellyfish.btinternet.com>
On Thu, 18 Feb 1999 10:14:08 -0600 Joseph Henry Chambers wrote:
>
> After everyone told me it should work, it started to work.
>
Of course this is a fine example of 'Perl mind control' - it failed to
work for you because you had doubts as to whether it should - after
your confidence in the technique was restored then Perl detected this
and allowed you to carry on ...
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 10:34:46 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Anyone know of a stock quote script?
Message-Id: <7amkmm$720$1@panix.com>
In <MPG.1137dfea8d84db8e98968c@news.wwa.com> dkoleary@wwa.com (Doug O'Leary) writes:
>In article <78kjlg$64o$0@205.211.154.11>, cypher5@yahoo.die.spammers.com
>says...
>> I'm looking for a stock quoting script that would send thw output to
>> email. Does anyone know of such a script?
>If I remember right, there's a module that does some of that for you; at
>least I remember seeing that while I was browsing through CPAN modules.
In the `finance' section of Perl Reference:
Finance::MoneyNetSymbolLookup
This module looks up stock symbols from MoneyNet.
Finance::YahooChart
This module gets charts from Yahoo! Finance. The only function
in the module is the getchart function, which takes the stock symbol,
size of the chart (b for big, s for small), the type of chart (i for
intraday, w for week, 3 for 3-month, 1 for 1-year, 2 for 2-year, and
5 for 5-year), and any extra information to include (s for a comparison
to the S&P 500, m for a moving average).
Finance::YahooQuote
Finance::YahooQuote allows you to obtain a (15-20-minute delayed) stock
quote from Yahoo! Finance. Two functions are provided: getquote, which
takes an array of stock symbols, and getonequote, which takes a single
stock symbol.
Yahoo Stock Quotes
David Turley provides an demonstration of the Finance::YahooQuote and
Finance::MoneyNetSymbolLookup modules by Dj Padzensky.
Perl Reference
http://reference.perl.com
--
Clay Irving
clay@panix.com
------------------------------
Date: 20 Feb 1999 15:43:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: beginners question
Message-Id: <7aml7v$1fg$1@gellyfish.btinternet.com>
On Sat, 20 Feb 1999 03:06:54 GMT white.tj wrote:
> I am on a sun box running solaris 2.5.
> I wrote a simple script to create two xterm windows and a filemgr window. I
> now the system commands are correct I tested them. So now my problem. When I
> execute the script only one window at a time will come up. When I kill the
> first window the second one will pop up and so on. Why? and is there a
> better way to do this in perl? <script included>
>
> #!/usr/perl/perl5.004/bin/perl
>
> system '(xterm -title lpscript -g 75X35+1+1 -e /usr/lpscript)' ;
> system '(xterm -title lpmon -g 75X35-0-0 -e /usr/lpmon)' ;
> system '(/usr/openwin/bin/filemgr -d /var/spool/lp/tmp/hostname)' ;
>
system will work synchtonously with your program so that each statement
will only execute after the last has completed when used like this.
If you want to execute these asynchronously then you will have to use
fork() and exec() - check out the perlfunc manpage on these.
/j\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 15:59:00 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: can I run perl on Win 98??????
Message-Id: <slrn7ctn2v.3bn.fl_aggie@enso.coaps.fsu.edu>
On Sat, 20 Feb 1999 01:13:19 -0800, Larry Rosler <lr@hpl.hp.com> wrote:
+ Well, you asked 'Can I do it...', not 'How can I do it...', so some wise
+ guys answered what you asked. I think you are owed an apology and a
+ straight answer.
He got a straight answer to a poorly framed question. If this teaches
him to ask better questions, then he's learned something. The purpose
of communiction is to be clear and unambigous, unless obsfucation is
the goal...
Ultimately, I'd have to say: Let him read the FAQs.
James
------------------------------
Date: 20 Feb 1999 15:28:23 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Cannot fathom the error message
Message-Id: <7amkan$1ak$1@gellyfish.btinternet.com>
On Thu, 18 Feb 1999 17:33:57 +0000 Default User wrote:
> Can some one please explain the following error message. Please email me
> at
>
> Open Client Message:
> Message number: LAYER = (5) ORIGIN = (3) SEVERITY = (5) NUMBER = (131)
> Message String: ct_init(): network packet layer: internal net library
> error: Error string not available
> Sybase::CTlib initialize: ct_init() failed at
> /usr/local/lib/perl5/sun4-sunos/5.00401/DynaLoader.pm line 172
> BEGIN failed--compilation aborted at - line 1.
It would appear that the problem is caused by something in your database
client software and not really in Perl at all - the first three lines of
the messsage are not Perl errors at all and are coming from the Sybase
library - I would imagine that the diagnostic is documented in the relevant
documentation for the dtabase software.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 20 Feb 1999 10:54:14 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: converting a standard number to a currency-like number
Message-Id: <ZUAz2.289$986.6251@nntp1.nac.net>
Tom Christiansen wrote in message <36ce01cd@csnews>...
: [courtesy cc of this posting sent to cited author via email]
:In comp.lang.perl.misc,
: Peter Richmond <peter@richmd.demon.co.uk> writes:
::Sorry if the subject is not clear. Here is the problem...
::I have a numerical value: 2474911568
::And i need to convert it into: 2,474,911,568
:Somehow you appear to have missed the proper answer when you studiously
:searched the standard Perl documentation on your very own system.
:It was there waiting for you.
:
: $ man perlfaq4
: ...
: How can I output my numbers with commas added?
You know it is posts like this that make me think that there is hope for me
yet. <g>. I could have sworn that Tom C. just posted:
FAQ 5.10: How can I output my numbers with commas added?
Is it in perlfaq4 too?
Just curious. :)
AmD
------------------------------
Date: 20 Feb 1999 07:10:52 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.42: How do I use an SQL database?
Message-Id: <36cec26c@csnews>
(This excerpt from perlfaq8 - System Interaction
($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)
How do I use an SQL database?
There are a number of excellent interfaces to SQL databases. See the
DBD::* modules available from
http://www.perl.com/CPAN/modules/dbperl/DBD . A lot of information on
this can be found at
http://www.hermetica.com/technologia/perl/DBI/index.html .
--
"IMHO, CAPS LOCK should be somewhere more
convenient; e.g., in another building." --jgreely
------------------------------
Date: 20 Feb 1999 07:59:57 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.43: How do I make a system() exit on control-C?
Message-Id: <36cecded@csnews>
(This excerpt from perlfaq8 - System Interaction
($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)
How do I make a system() exit on control-C?
You can't. You need to imitate the system() call (see the perlipc
manpage for sample code) and then have a signal handler for the INT
signal that passes the signal on to the subprocess. Or you can check for
it:
$rc = system($cmd);
if ($rc & 127) { die "signal death" }
--
"Sometimes I wonder if men and women really suit each other. Perhaps they
should live next door and just visit now and then."
--Katherine Hepburn
------------------------------
Date: 20 Feb 1999 08:59:59 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 8.44: How do I open a file without blocking?
Message-Id: <36cedbff@csnews>
(This excerpt from perlfaq8 - System Interaction
($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq8.html
if your negligent system adminstrator has been remiss in his duties.)
How do I open a file without blocking?
If you're lucky enough to be using a system that supports non-blocking
reads (most Unixish systems do), you need only to use the O_NDELAY or
O_NONBLOCK flag from the Fcntl module in conjunction with sysopen():
use Fcntl;
sysopen(FH, "/tmp/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644)
or die "can't open /tmp/somefile: $!":
--
Someone who truly understands UNIX not only understands why "rm *"
screws you, but understands why IT HAS TO BE THAT WAY.
------------------------------
Date: 20 Feb 1999 15:14:49 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: grabbing websites with time limit?
Message-Id: <7amjh9$1aa$1@gellyfish.btinternet.com>
On Fri, 19 Feb 1999 15:19:42 -0500 Adam Rudnick wrote:
>
> I am grabbing sites from the web with perl, but when a server is up but too
> slow to respond the script just hangs and waits. Is there a way to provide
> a limit to the amount of time the attempt to grab the site may take?
>
If you were using LWP::UserAgent then you would be able to use the
provided timeout capability.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 15:07:04 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: guestbook perl script
Message-Id: <7amj2o$19n$1@gellyfish.btinternet.com>
On Fri, 19 Feb 1999 20:36:30 -0500 Anonymous wrote:
> Has anyone ever written a *working* guestbook script for an NT server?
I'm sure *someone* has - although I cant say I have ever wanted to.
> If
> so, please assist me...if not, please assist me =)
>
We'll see.
> My guestbook.pl script:
>
>
> #GUESTBOOK.PL
>
> $file = "D:\Customer Sites\DStern\cgi-bin\guestbook.dat";
> $date = localtime(time);
>
> $ENV{"REQUEST_METHOD"} eq "POST" ? &Add_Guest($file) :
> &Display_Book($file);
>
>
>
> %data_received = &User_Data();
>
Ding !
Rewrite it using CGI.pm then come back if you still have problems - your
User_Data function is hoplessly flawed and I am not going to tell you
why because that might encourage you to try and fix it rather than use some
well tested documented reusable module.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 20 Feb 1999 09:16:14 -0500
From: "Anonymous" <dstern@aschwebhosting.com*nospam*>
Subject: guestbook
Message-Id: <7amg0o$1hi$1@winter.news.rcn.net>
Has anyone ever written a *working* guestbook script for an NT server? If
so, please assist me...if not, please assist me =)
My guestbook.pl script:
#GUESTBOOK.PL
$file = "'D:\User Space\Webmaster\cgi-bin\guestboo.dat";
$date = localtime(time);
$ENV{"REQUEST_METHOD"} eq "POST" ? &Add_Guest($file) :
&Display_Book($file);
%data_received = &User_Data();
&No_SSI(*data_received);
if ($data_received{"name"} ne "") {
$new_guest = "<B>Name:</b> $data_received{\"name\"}<br>\n";
$new_guest .= "<B>Data:</B> $date<BR>\n";
$new_guest .= "<B>E-Mail:</b> <a
href="\"mailto:$data_received{\"email\"}\">$data_recieved{\"email\"}</A><BR>
\n" if
$data_received{"email"} ne "";
$new_guest .="<b>Home page URL:</b> <A
href=\"$data_received{\"url"}\">$data_recieved{\"url\"}</a><br>\n" if
$data_received{"url} ne "";
$new_guest .= "$data_received{\"city\"}, " if $data_recieved{"city"} ne
"";
$new_guest .= "$data_recieved{\"state\"} " if $data_recieved{"state"} ne
"";
$new_guest .= "$data_recieved{\"country\"}<br>\n" if
$data_received{"country"}
ne "";
$new_guest .= "<b>Comments:</b> $data_received{\"comments\"}\n" if
$data_received{"comments"} ne "";
$new_guest .= "<p><hr><p>\n";
open(GUESTBOOK,"$guestbookfile") || die "Content-type: text/text\n\nCannot
open
$guestbookfile";
@guestbook = <GUESTBOOK>;
close (GUESTBOOK)
unshift(@guestbook, $new_guest);
open (GUESTBOOK,">$guestbookfile") || die "Content-type:
text/text\n\nCannot
open $guestbookfile";
print GUESTBOOK @guestbook;
close (GUESTOOK);
&Display_Book($guestbookfile);
} else {
print "Content-type: text/html\n\n";
print "<H1>Sign-In Unsuccessful</H1>\n";
print "You must enter your name to be added to the guest book.";
}
}
sub Display_Book {
local ($guestbookfile_ = @_;
local (@guestbook);
open (GUESTBOOK,"$guestbookfile") || die "Content-type: text/text\n\nCannot
open
$guestbookfile";
@guestbook = <GUESTBOOK>;
close(GUESTBOOK);
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>My Guestbook</TITLE></HEAD><BODY>";
print "<H1>My Guest book</H1>";
print @guestbook;
print </BODY></HTML>";
}
sub No_SSI {
local (*data) = @_;
foreach $key (sort keys(%data)) {
$data{$key} =~ s/<!--(.|\n)*-->//g;
}
}
sub User_Data {
local (%user_data, $user_string, $name_value_pair,
@name_value_pairs, $name, $value);
if ($ENV("REQUEST_METHOD") eq "POST") {
read(STDIN,$user_string,$ENV{"CONTENT_LENGTH"});
} else {
$user_string = $ENV("QUERY_STRING");
}
$user_string =~ s/\+/ /g;
@name_value_pairs = split(/&/. $user_string);
foreach $name_value_pair (@name_value_pairs) {
($name, $value) = split(/=/, $name_value_pair);
$name =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge;
$value =~
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge;
if (defined($user_data{$name})) {
$user_data($name} .= " : " . $value;
} else {
$user_data{$name} = $value;
}
}
return %user_data;
}
It returns the error:
'D:\User Space\Webmaster\cgi-bin\guestbook.pl' script produced no output
Please give me some help on this. Thank you.
------------------------------
Date: 20 Feb 1999 10:41:51 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: How do ignore delimiters within quoted strings?
Message-Id: <7aml3v$7pb$1@panix.com>
In <36CEA44A.97676783@cwcom.net> Jeremy Page <jpage@cwcom.net> writes:
>I am looking to split a long csv text file into records and fields using
>Perl, that I can then put into a PostgreSQL database. The only trouble
>is that there are some commas within quoted strings which I don't want
>the split function to recognise and split at.
>Is there any way (or module someone has written) that can help me split
>the strings into lists while ignoring the quoted commas? I have tried
>all manner of substituion combinations, but nothing seems fool-proof.
Text::CSV
http://www.perl.com/CPAN/modules/by-module/Text/
Text::CSV provides facilities for the composition and decomposition
of comma-separated values. An instance of the Text::CSV class can
combine fields into a CSV string and parse a CSV string into fields.
--
Clay Irving
clay@panix.com
------------------------------
Date: 20 Feb 1999 15:38:54 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How do ignore delimiters within quoted strings?
Message-Id: <7amkue$1es$1@gellyfish.btinternet.com>
On Sat, 20 Feb 1999 12:02:18 +0000 Jeremy Page wrote:
> I am looking to split a long csv text file into records and fields using
> Perl, that I can then put into a PostgreSQL database. The only trouble
> is that there are some commas within quoted strings which I don't want
> the split function to recognise and split at.
>
I think that you might have overlooked the section in perlfaq4 that deals
with this subject:
How can I split a [character] delimited string except when
inside [character]? (Comma-separated files)
There is also the module Text::CSV that does something similar.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 16:07:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: HOW pass input to perlscript ?
Message-Id: <7ammkb$1fp$1@gellyfish.btinternet.com>
On Mon, 15 Feb 1999 01:13:34 +0100 Philip Class wrote:
>
> PS: Looking for Perl Code Help and tutorial / manuals I get very much the
> impression that Perl is the less user friendly programming language. To fix
> Perlscript-Bugs I loose/spend more time that with any other programming
> language.
> Does someone share my view ?
>
>
If you want to find someone that might share this view than you might
have a little chat with the strangely styled topmind@technologist.com
or view his 'One Man Show' the thread entitled 'Perl Criticism'.
However I would suggest that most if not all of the respondents in this
group would hasten to diagree with you. Perl is not designed to be
user-friendly but it is designed to be programmer friendly and I think
that this is shown by the productivity that most people achieve using
Perl over other say C or Java.
By the way I think you should be careful in distinguishing between a
Perl script and Perlscript which is a way of using Perl as a scripting
engine within microsoft products.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 15:56:34 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: HTML File Upload
Message-Id: <7amlvi$1fj$1@gellyfish.btinternet.com>
On Mon, 15 Feb 1999 15:26:26 GMT tyuhas@neurobio.arizona.edu wrote:
>
> I've gone through the threads on this, checked out the various sites,
> etc. but still am stumped by one particular problem. For text files,
> and images (.BMP), the script we're using with CGI.pm seems to be
> flawless. When we use it to upload files like ZIP, EXE or Powerpoint,
> the end result is a corrupted file. Byte by byte (countwise), the
> original and uploaded file are the same.
>
> We're running this on a Win95 machine with the latest Perl and CGI.pm.
> Our webserver is Xitami.
>
You will almost certainly need to use binmode() on both the read and write
filehandles on a Windows system - I guess that this is your problem
however it seems strange that the windows bitmap files are not corrupted -
it might be that they dont have any of the offending characters in them.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 20 Feb 1999 14:27:26 +0000
From: Greg Griffiths <greg2@surfaid.org>
To: a97485@cs.ait.ac.th
Subject: Re: Looking for CGI database apps
Message-Id: <36CEC64E.4EB8D912@surfaid.org>
the who main approaches using CGI are DBI and ODBC.pm I've just finished
developing several application in this format, so contact me for more
info.
a97485@cs.ait.ac.th wrote:
>
> Hi,
>
> I am looking for CGI applications which access SQL database using Perl at the
> server side. I am building such a system I want to have a look how others
> have done.
>
> Thanks
> Ehsan Masud
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 20 Feb 1999 15:10:00 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Looking for two CGI Scripts
Message-Id: <7amj88$19r$1@gellyfish.btinternet.com>
On Fri, 19 Feb 1999 19:02:24 -0600 T.J. Weber wrote:
>
> Hi, I've been looking for two CGI scripts to do different tasks. I have
> looked for them on cgi-resources.com and some various other search
> engines, and I haven't had any luck.
Then it looks like youre going to have to write them yourself or get^H^H^Hpay
someone else to write them for you.
This group is concerned with Perl program issues and is not a trading post
for CGI scripts or whatever.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 14:58:03 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Need Random Link Script! HELP!
Message-Id: <7amihr$19i$1@gellyfish.btinternet.com>
In comp.lang.perl.misc Nick Gray <nicktg@-REMOVE-bellsouth.net> wrote:
> I have looked long and hard for a Random Link Script that is NOT based on a
> user-set TXT or database file. One that will create an inventory of *.html
> files and just choose a random link from there. Help somebody, please!
If you are not going to use a text file or database then quite how are you
going to create 'inventory of *.html files' ? You are going to need to
store that information *somehow* and if this is a CGI program then your
other options are rather limited (you cant keep the list im memory).
However until you have worked out how your magic storage method is going
to work and of course just for fun here is something to be going on with:
#!/usr/bin/perl -w
use CGI qw(:standard);
if(open(URLS,'urls.txt') )
{
while(<URLS>)
{
chomp;
push @urls,$_;
}
close(URLS);
my $index = int (rand $#urls);
print redirect($urls[$index]);
}
else
{
print header,start_html("Error");
print <<EOERR;
The world is about to end ....
EOERR
}
The file 'urls.txt' simply holds one full URL on each line.
I am not making any great claims about the true randomness of this as it
is largely down to the implementation of rand() on your system.
If you are running something like this using mod_perl on Apache then some
gains can be made by having the list held in a persistent array but I think
that my tests with 200+ URLS (albeit on my local server) would indicate
that it is fairly fast ...
I had also been mentally toying with doing something that chooses a random
word from /usr/dict/words and the searches that on (say) AltaVista and then
picks the first item that it comes up with ;-}
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 14:18:07 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: perl 5.005_02 compile on FreeBSD 3.0
Message-Id: <7amg6v$14q$1@gellyfish.btinternet.com>
On 20 Feb 1999 09:00:58 +0100 Ask Bjoern Hansen wrote:
>
> My compilation of perl5.005_02 (./Configure -des) ends like this:
>
I would suggest running a plain old Configure and check what is has
to say about certain things - the platform, the availability of certain
functions and so forth and if all else fails you might need to hack up
your include files so that the missing things get defined.
/j\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 08:27:32 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: perl compiled code cacheing
Message-Id: <m31zjlyu1n.fsf@moiraine.dimensional.com>
abigail@fnx.com (Abigail) writes:
> Tom Christiansen (tchrist@mox.perl.com) wrote on MCMXCVIII September
> MCMXCIII in <URL:news:36cdadec@csnews>:
> || Micro-optimizations are useless but dangerous hobgoblins that
> || haunt the deluded minds of uncounted programmers of small capability.
> I wouldn't go that far. But if micro-optimizations are important to you,
> you shouldn't be programming in Perl. C, a very good compiler, and the
> knowledge when to use machine code instead of C is what you need.
It seems to me that someone who is skilled enough and knowledgeable
enough to tell when C is appropriate or when assembler is better is
probably not going to fall into the trap of unnecessary optimization.
For most programmers, though, Tom's point is valid.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 20 Feb 1999 15:11:53 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl posts to newsgroups?
Message-Id: <7amjbp$19u$1@gellyfish.btinternet.com>
On 19 Feb 1999 19:42:32 -0700 Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, shawn raymond <shawn@sorcerysoftware.com> writes:
> :I know how to send mail thru Perl but can I send mail to newsgroups
> :What would the code be?
>
> Well, I happen to do this very thing every hour, but I'm wearing a
> white hat. Are you?
>
He may or may not be but it appears that he is wearing a red uniform.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 20 Feb 1999 10:09:59 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: Printing all environment variables
Message-Id: <RfAz2.287$986.6229@nntp1.nac.net>
Andre L. wrote in message ...
:In article <36CD98FE.3CE3C41B@giss.nasa.gov>, jglascoe@giss.nasa.gov wrote:
:> my @env_keys = keys %ENV;
:> @env_keys = sort { $a cmp $b } @env_keys;
:> for my $key (@env_keys)
:> {
:> my $val = $ENV{$key};
:> print "$key\t$val\n"
:> }
:Or, if you don't have the budget for superfluous variables :-),
: foreach (sort keys %ENV) {
: print "$_\t$ENV{$_}\n";
: }
Or, just for fun:
print map{"$_\t$ENV{$_}\n"} (sort keys %ENV);
AmD
------------------------------
Date: Sat, 20 Feb 1999 09:55:29 -0600
From: <tavi367@ibm.net>
Subject: Q on diff of array vs hash
Message-Id: <36cedafc@news1.us.ibm.net>
I have two methods to do the same thing... (listed at end of note)
Can some one please tell me the pros and cons of each, and which would you
use and why?
I created the first, another guru suggested the second, and I am trying to
understand the real difference.
And I am really not asking what the fundamentals of what an array is and
what a hash is, I know that. I looking to know why one is better then the
other in this instance.
Thanks
Walter
================================
Sample A
sub getShortMonthName
{
my %shortMonthName = ( 0 => Jan,
1 => Feb,
2 => Mar,
3 => Apr,
4 => May,
5 => Jun,
6 => Jul,
7 => Aug,
8 => Sep,
9 => Oct,
10 => Nov,
11 => Dec
);
return $shortMonthName{$_[0]}
}
================================
Sample B
sub getShortMonthName
{
my @shortMonthName = qw( Jan Feb Mar Apr May Jun
Jul Aug Sep Oct Nov Dec );
$shortMonthName[$_[0]]
}
================================
------------------------------
Date: Sat, 20 Feb 1999 10:01:31 -0600
From: <tavi367@ibm.net>
Subject: Q on localtime
Message-Id: <36cedc68@news1.us.ibm.net>
If I take this function...
=========================
sub dateStamp
{
my ($sec, $min, $hour, $day, $mon, $year) = localtime;
sprintf '%.2d/%.2d/%d', $mon + 1, $day, $year + 1900
}
=========================
And place it in a script, it works...
==============
dateStamp: >02/20/1999<
==============
If I place it in an external
require "dateTime.pl";
I get...
==============
Use of uninitialized value at C:\Perl\5.005\lib/dateTime.pl line 210.
Use of uninitialized value at C:\Perl\5.005\lib/dateTime.pl line 210.
Use of uninitialized value at C:\Perl\5.005\lib/dateTime.pl line 210.
dateStamp: >00/00/1900<
=======================
Any ideas on this?
Walter
------------------------------
Date: 20 Feb 1999 10:38:08 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: splitting Pairs of characters
Message-Id: <7amkt0$7lh$1@panix.com>
In <7alkc1$ers$1@scream.auckland.ac.nz> suad@nix.tmk.auckland.ac.nz (Suad Musovich) writes:
>Is it possible to split pairs of characters in a word?
Yes, it's easy to do this in Perl.
>I have messily split single characters and printed the
>array in pairs but it would send a Perl coder screaming
>"philistine" if they saw my code :)
>This is for splitting a HW address like 000502F3DD12
>into 00:05:02:F3:DD:12
In other words, you want to split every two characters...
--
Clay Irving
clay@panix.com
------------------------------
Date: 20 Feb 1999 15:19:05 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: WWW:Search
Message-Id: <7amjpa$1ad$1@gellyfish.btinternet.com>
On Fri, 19 Feb 1999 19:28:40 GMT nguyen.van@imvi.bls.com wrote:
> Hi,
>
> I guess that the sccript looks for a module name "path_query.al" in your Perl
> Library but couldn't find it. If you want to use this module, you have to put
> it in Perl Lib. However this module is not a Perl Module.
Except of course it is *part* of one. It is an autoload module that will be
loaded by its main module at compile time.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 20 Feb 1999 15:20:18 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: WWW:Search
Message-Id: <7amjri$1ah$1@gellyfish.btinternet.com>
On Fri, 19 Feb 1999 14:55:39 +0000 (GMT) D.K. FLETCHER wrote:
> I,m trying to get WWW:Search up and runing but come accross the
> Following error.
>
> Error: 500 (Internal Server Error) Can't locate
> auto/URI/URL/http/path_query.al in @INC (@INC contains:
It appears that the module URI::URL is improperly installed I would
suggest trying to reinstall it.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4949
**************************************