[11447] in Perl-Users-Digest
Perl-Users Digest, Issue: 5047 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 3 17:17:27 1999
Date: Wed, 3 Mar 99 14:00:18 -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 Wed, 3 Mar 1999 Volume: 8 Number: 5047
Today's topics:
Re: can I make this code better? (Larry Rosler)
cursor visibility with Curses module? vinger@ford.com
Re: date (week number) <aghaeim@genesis.co.nz>
Re: date (week number) <arnej@fc.hp.com>
Re: date (week number) (Larry Rosler)
Re: fork() for Win32 (Scott McMahan)
Re: fork() for Win32 (Bart Lateur)
Re: fork() for Win32 <emschwar@mail.uccs.edu>
Re: fork() for Win32 <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Re: How do I start? <horizon@internetexpress.com.au>
Re: HTML to MSWORD, PDF, POSTSCRIPT <gellyfish@btinternet.com>
Re: I'm looking for a good code editor for PERL for Win (Scott McMahan)
PERL ODBC on LINUX <sparker@wash.inmet.com>
Re: Please, An example of win32::NetResourse. <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Re: Question on NET::POP3 (Robert Saunders)
Running Perl scripts in real-time (Kelley Peagler)
sendmail / perl problem ddreams@my-dejanews.com
Re: Standard for inline Perl in HTML? <gellyfish@btinternet.com>
Re: sysopen and NT (Bart Lateur)
Re: The Win32::AdminMisc::GetDriveSpace function <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Re: URGENT! Where Do You Hide The CGI Cards From The Sp <gellyfish@btinternet.com>
Re: URGENT! Where Do You Hide The CGI Cards From The Sp <gellyfish@btinternet.com>
Re: warning: undefined filehandle diag check? (Larry Rosler)
web browser in Perl? (Peter Bismuti)
Re: Where is Randal's "HTML to CGI.pm" converter?? (brian d foy)
Re: Where is Randal's "HTML to CGI.pm" converter?? <elaine@cts.wustl.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 3 Mar 1999 13:40:05 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: can I make this code better?
Message-Id: <MPG.11474c106b7495739896ce@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <36de8e1d.58840722@news.supernews.com> on Wed, 03 Mar 1999
19:38:23 GMT, Alan Young <alany@2021.com> says...
> I'm sure there is a way to make this code shorter and more efficient,
> but I can't figure out how.
>
> Basically, I have a list of chosen items (shopping cart) and a list of
> avialable items (inventory). All I have in the list of chosen items
> is the item code and the quantity of items to purchase in item|qty
> format and I want to display a short description for each item
> (viewing the cart). This does what I want, I'm just curious and
> wanting to improve my perl skills. Thanks for any help.
>
> ----Begin Code----
> #!/u/alany/bin/perl
Step 1 in improving Perl (the language, not the compiler) skills:
#!/u/alany/bin/perl -w
use strict;
> @line = ("123|1", "456|2", "012|3", "666|7");
Step 2: Use single-quotes when interpolation is not desired, or qw()
for simple lists of words without embedded spaces.
my @line = qw( 123|1 456|2 012|3 666|7 );
> # inventory contains 123|hello, 456|cruel, 789|world, 012|goodbye
> # the comma actually being a newline
> open 'fh', "<inventory";
Step 3: Use all upper-case for filehandles (a Perl convention). And
skip the quotes. And test the result. Always, always, always...
open FH, 'inventory' or die "Couldn't read 'inventory'. $!\n";
Wouldn't an absolute path or a visible chdir be more appropriate?
> #################################################################
> # This is the part that I think I should be able to compress.
You are quite right. Rather than reading the inventory file over and
over, read it once and create a hash. Think of it as a quick look-up
table.
> $i = 0;
> foreach $l (@line) {
> $l =~ /^([\w\d]+)\|/;
> $item = $1;
>
> seek fh, 0, 0;
> while (<fh>) {
> last if /^$item\|/;
> }
>
> if (!$_) {
> @items[$i++] = "$item does not exist in inventory";
> } else {
> @items[$i++] = $_;
> }
> }
my %inventory = map { (split /\|/)[0], $_ } <FH>;
my @items = map $inventory{(split /\|/)[0]} ||
"$_ does not exist in inventory\n", @line;
> #################################################################
>
> print @items;
> print "\n";
> ----End Code----
That's about as compressed as it gets! You'll be astounded by how much
faster it is than your code for reasonable amounts of data.
perldoc perldata (for hashes)
perldoc -f split (better than regex for this purpose)
perldoc -f map (because I don't like writing explicit loops :-)
Welcome to the big leagues!
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 03 Mar 1999 20:59:29 GMT
From: vinger@ford.com
Subject: cursor visibility with Curses module?
Message-Id: <7bk7rb$onk$1@nnrp1.dejanews.com>
Hello,
I'm wondering: UNIX C curses library implements a function curs_set() which
controls cursor visibility. However, the perl Curses module doesn't have this
function. Is there a way to control cursor visibility from perl?
Thanks.
- Slav Inger.
- vinger@ford.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 04 Mar 1999 09:09:13 +1300
From: Mehran Aghaei <aghaeim@genesis.co.nz>
Subject: Re: date (week number)
Message-Id: <36DD96E9.579E49@genesis.co.nz>
Cim wrote:
>
> I need to get current week's number (week 9 currently). It can be from
> the beginning of current year or from EPOCH. I have a separate data
> for each week and i need to display that data according to current
> week, next week and the one after that.
> Any ideas. Can localtime alone and/or special math help me. Any
> modules that could do it.
>
> thanks.
-----------
here you are,2 functions to find week of year.Please read the headers
first.
#----------------------------------------------------------------------------
sub weekofyear {
# usage: &weekofyear
#
# gives a week number for today
# Weeks are judged to start on Monday. (Apologies to all who know
better.)
# If the year starts in the middle of the week, the second week of
the year
# still starts on the next Monday.
local ($week, $elapsedsecs, $offset);
local ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
$isdst);
local ($sec0, $min0, $hour0, $mday0, $mon0, $year0, $firstday,
$yday0, $
jnk);
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
gmtime(t
ime);
$elapsedsecs = (($yday*24 + $hour)*60 + $min)*60 + $sec -1;
($sec0, $min0, $hour0, $mday0, $mon0, $year0, $firstday, $yday0,
$jnk) =
gmtime(time - $elapsedsecs); # 1 sec past midnight on 1st day of year
#print "$sec0, $min0, $hour0, $mday0, $mon0, $year0, $firstday,
$yday0,
$jnk\n<BR>";
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtim
e(time);
$offset = (8 - $firstday)%7; # days until next Mon
#print "The year started on day $firstday of the week. The
offset is $of
fset days.\n<BR>";
$week = ($offset > 0 )?int(($yday - $offset)/7) + 2:int(($yday -
$offset
)/7) + 1;
}
#-------------------------------------------------------------------
sub WeekOfYear {
# usage: &WeekOfYear($date)
#
# returns an integer as week number for a given date
# date must be in a correct format and correct as there is
# no test on input date.Weeks are assumed to start on Monday
#
# eg. &WeekOfYear('19990104') --> 2
use Time::Local ;
my $thedate= @_[0]; # YYYYMMDD
my ($dowbase,$doythis,$basesecs,$thissecs,$adjdoy,$weeknumber);
$basesecs = timelocal(1, 1, 1, 1, 0, substr($thedate,2,2));
$thissecs = timelocal(1, 1, 1,
substr($thedate,6,2),substr($thedate,4,2)-1 ,
substr($thedate,2,2));
$dowbase = (localtime($basesecs))[6];
$doythis = (localtime($thissecs))[7] + 1;
$adjdoy = $doythis +(15 - $dowbase);
$weeknumber = ($adjdoy - ( $adjdoy % 7)) /7;
#print " local time $thedate, week is $weeknumber ";
return ($weeknumber);
}
---------------------------------------------------------------------
Protect privacy, boycott Intel PIII: http://www.bigbrotherinside.org
---------------------------------------------------------------------
------------------------------
Date: Wed, 03 Mar 1999 13:28:03 -0700
From: Arne Jamtgaard <arnej@fc.hp.com>
Subject: Re: date (week number)
Message-Id: <36DD9B53.C27@fc.hp.com>
Cim wrote:
> I need to get current week's number (week 9 currently). It can be from
> the beginning of current year or from EPOCH. I have a separate data
> for each week and i need to display that data according to current
> week, next week and the one after that.
> Any ideas. Can localtime alone and/or special math help me. Any
> modules that could do it.
Well, from epoch it's:
int(( # round to a whole number
(time/(24*60*60)) # secs since 1/1/1970 / secs in a day
+4) # since 1/1/1970 was a Thursday
/7) # 7 days in a week
+1 # since we start w/ week 1, not week 0
For week number in a year, you'd have to find the # of secs for
Jan 1 of that year and subtract it from time up above. See
Time::local for the timelocal function. You might also have to
adjust the "4" depending on what day of the week Jan 1 was this
year... For 1999 it'd be a "5".
There's more helpful stuff inthe Time library for perl.
HTH,
Arne
------------------------------
Date: Wed, 3 Mar 1999 12:30:31 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: date (week number)
Message-Id: <MPG.11473bbef8dec06c9896cd@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <36dd8d2d.1854504@news.online.ee> on Wed, 03 Mar 1999
19:37:26 GMT, Cim <cim@online.ee> says...
> I need to get current week's number (week 9 currently). It can be from
> the beginning of current year or from EPOCH. I have a separate data
> for each week and i need to display that data according to current
> week, next week and the one after that.
> Any ideas. Can localtime alone and/or special math help me. Any
> modules that could do it.
Sure. (localtime)[7] gives you the day of the year (Jan. 1 == 0), and
(localtime)[6] gives you its weekday (Sunday == 0). 'Special math' such
as '% 7' will give you a measure of how many weeks have passed.
The unresolved problem is how to define week 0 or 1. The ISO 8601
standard should apply in Estonia, and says "A week is identified by its
number in a given year. A week begins with a Monday, and the first week
of a year is the one which includes the first Thursday, or equivalently
the one which includes January 4." The 'special math' is left as an
exercise for the reader.
Don't use POSIX:strftime with the '%U' or '%W' specifier, because they
have a different definition that probably doesn't apply where you are
("the first [Sunday|Monday] as the first day of oeek 1")
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 3 Mar 1999 21:18:34 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: fork() for Win32
Message-Id: <36dda72a.0@news.new-era.net>
Jason Gadde (jasongadde@home.com) wrote:
> Does anyone have any ideas on how I can get around using fork( ) in my
> script that runs a on Win32 platform? I know fork() (and others) are
> not supported. But I need to use a Win32 platform and have interprocess
> communication. Thanks!
You can use Perl's new threading feature. Threads are the
modern way of doing what fork used to do.
Scott
------------------------------
Date: Wed, 03 Mar 1999 20:19:09 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: fork() for Win32
Message-Id: <36de991a.755768@news.skynet.be>
Scott McMahan wrote:
>You can use Perl's new threading feature. Threads are the
>modern way of doing what fork used to do.
"modern" probably meaning "needing the latest and fastest machine".
;-)
Bart.
------------------------------
Date: 03 Mar 1999 13:34:25 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: fork() for Win32
Message-Id: <xkfvhgijory.fsf@valdemar.col.hp.com>
scott@aravis.softbase.com (Scott McMahan) writes:
> Jason Gadde (jasongadde@home.com) wrote:
> > Does anyone have any ideas on how I can get around using fork( ) in my
> > script that runs a on Win32 platform? I know fork() (and others) are
> > not supported. But I need to use a Win32 platform and have interprocess
> > communication. Thanks!
>
> You can use Perl's new threading feature. Threads are the
> modern way of doing what fork used to do.
Er, no. Threads and fork() do two different things. For one thing,
threads generally share data, and processes created by fork() share only
file descriptors (and not always those, depending on various factors).
Also, the fork/exec pair is a fairly common idiom (at least on OSes that
support them), and is simply not possible with threads.
Yes, you can simulate many of the above things with threads, and you can
certainly do many of the things you used to do with fork() with threads,
but they are by no means equivalent.
-=Eric
------------------------------
Date: Wed, 3 Mar 1999 13:43:17 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: fork() for Win32
Message-Id: <a2iD2.6653$YV6.3484@news2.giganews.com>
Jason Gadde wrote in message <36DD3701.C8609A3B@home.com>...
>Does anyone have any ideas on how I can get around using fork( ) in my
>script that runs a on Win32 platform? I know fork() (and others) are
>not supported. But I need to use a Win32 platform and have interprocess
>communication. Thanks!
You can use Win32::Spawn() or some of the other similar functions
like Win32::Process and Win32::AdminMisc::CreateProcess(). Use these to
launch a new copy of your script.
The parent process can either open an anonymous pipe and bind it
to STDIN/STDOUT. If you specify the new process to inherit handles
then your child process will inherit STDIN/STDOUT as one end of your
pipe.
The parent could also use Win32::Pipe to create a named pipe which
the child process connects to. This provides full duplex communication.
dave
--
=================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
http://www.roth.net the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net
Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/
------------------------------
Date: Thu, 04 Mar 1999 07:02:33 +1100
From: Mick <horizon@internetexpress.com.au>
Subject: Re: How do I start?
Message-Id: <36DD9559.57621C45@internetexpress.com.au>
Hi Doc...I don't know if it will be available in your area, but try the
book -
Perl for dummies 2nd edition.
It comes with Perl 5.005 on CD (For Unix and Windows)...
It is a great starting point.
Mick
Doc wrote:
> Hi
> I am a very experienced programmer using an Intel Pentium PC with Win95.
> I must be going senile because I have spent days on perl.com trying to
> find what I need to start using perl, and what to do with it. I have
> downloaded everything from 'perl for W32' to activestate's build 509, to
> DCOM, to binary GCC. Every area seems to suggest something different.
> I would appreciate it if some kind person would just tell me which files
> I need to install, and what else needs to be done, so that I can start
> writing programmes in perl for the internet. Having programmed in many
> languages I thought that I would need a weekend to come to terms with
> most of this - 4 days and still can't do 'HELLO WORLD' is embarrassing!
>
> Thanks in advance, (and hope)
> doc
>
> --
> Doc
--
HORIZON
Software Solutions
Developers / Consultants
-= Integrated Systems / Internet / Unix /
Windows / Linux =-
------------------------------
Date: 3 Mar 1999 21:09:54 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: HTML to MSWORD, PDF, POSTSCRIPT
Message-Id: <7bk8f2$o2$1@gellyfish.btinternet.com>
On Wed, 03 Mar 1999 12:23:04 +0100 Philip Newton wrote:
> Rollo Chan Ka Chun wrote:
>>
>> Is there any method or module which can convert a HTML file to MSWORD or
>> PDF or POSTSCRTIPT file???...thanks for your attention and help.
>
> AFAIK MS Word (at least Word 97) can read HTML directly; no need to
> "export" the HTML to anything else. This has nothing to do with Perl,
> though.
Although of course one could use Win32::OLE to control the operation
in Perl.
/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: 3 Mar 1999 21:19:09 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: I'm looking for a good code editor for PERL for Win NT
Message-Id: <36dda74d.0@news.new-era.net>
Alejandro Eluchans (alejandro.eluchans@umb.edu) wrote:
> I need a good text editor for PERL code that among other things, it must
> indent nested code automatically.
What specific reasons do you have for not using Emacs?
Scott
------------------------------
Date: Wed, 3 Mar 1999 20:05:31 GMT
From: Steven Parker <sparker@wash.inmet.com>
Subject: PERL ODBC on LINUX
Message-Id: <36DD960B.4635A866@wash.inmet.com>
Does anybody know if there exists a PERL ODBC module for use on Linux?
Any help is much appreciated.
-steve
------------------------------
Date: Wed, 3 Mar 1999 13:47:48 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: Please, An example of win32::NetResourse.
Message-Id: <s6iD2.6658$YV6.3422@news2.giganews.com>
Gareth Jones wrote in message <36e9813a.9448812@news.demon.co.uk>...
>Do you happen to know why AddConnection is implemented like this? If
>you call it with zero length strings for the password / username, it
>translates them to nulls before invoking the api call. This seems to
>me to be unnecessary (without the translation, I could just give nulls
>for the username and password), and it prevents the use of
>AddConnection for creating a null session.
Gareth,
I have no idea what went through the mind of the developer when he
coded the extension. Actually, there are several issues that seem to make
little sense with that extension. ;)
dave
--
=================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
http://www.roth.net the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net
Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/
------------------------------
Date: Wed, 03 Mar 1999 21:23:34 GMT
From: robert@iminet.com (Robert Saunders)
Subject: Re: Question on NET::POP3
Message-Id: <225B355EC27793B6.40664AC090AAB2BE.9FE9ECA8E7F2399E@library-proxy.airnews.net>
Works like a charm.. thank you sir..
On Wed, 03 Mar 1999 19:44:22 GMT, euclid@fantom.com (Dimitri
Ostapenko) wrote:
>In article <78B4BB8E4FEA3F8B.C5985DFEDACF8CE8.85170917C5383D0F@library-proxy.airnews.net>,
> robert@iminet.com (Robert Saunders) writes:
>> I have read the information in the Perl Cookbook along with the readme
>> that came with NET::POP3
>>
>> I am trying to get past the very first part of the program.. below is
>> the code that I am using.. I have replaced $mail_server with a dummy
>> name to post here and the same with the username and password..
>>
>> When I run this from a prompt.. I get the error message
>>
>> Username password didnt work
>>
>> So it gets connected to my mail server without a problem. and I have
>> checked the logs on the mailserver to confirm that a connection is
>> being started.. I have checked and rechecked the username and
>> password that I am using and can put them into a regular email program
>> and have no trouble getting the mail from the machine. So what I am
>> missing..
>>
>> #!/usr/bin/perl
>>
>> use Net::POP3;
>>
>> $mail_server = "madeupname.com";
>> $username = "madeupusername";
>> $password = "madeupuserpassword";
>>
>> $pop = Net::POP3->new($mail_server)
>> or die "Can't open connection to $mail_server : $!\n";
>>
>> $pop->login("$username", "$password")
>> or die "Username password didnt work: $!\n";
>>
>> Robert Saunders
>> robert@iminet.com
>>
>>
>I use Mail::POP3Client; and it works just fine.
>
>here's excerpt from perldoc POP3Client:
>#!/usr/local/bin/perl
>
> use Mail::POP3Client;
>
> $pop = new Mail::POP3Client("me", "mypass", "pop3.do.main");
> for ($i = 1; $i <= $pop->Count; $i++) {
> foreach ($pop->Head($i)) {
> /^(From|Subject): / and print $_, "\n";
> }
> print "\n";
> }
>
>this should get you started.
>
>___
>
>Dimitri Ostapenko,
>3D CAD Designer/System Administrator
>Fantom Technologies Inc.
>
>
------------------------------
Date: 3 Mar 1999 21:53:11 GMT
From: kelley@nospamlexis-nexis.com (Kelley Peagler)
Subject: Running Perl scripts in real-time
Message-Id: <7bkb07$svs$1@mailgate2.lexis-nexis.com>
I'm using Perl 5.004, and I don't think this is a problem, but more of an enhancement that I might need to make.
All of my CGI scripts that I write are in Perl. In my current group, we have CGI scripts that are written as a combination of Perl and Bourne shell. How, you ask? The script that the form calls (Perl) merely parses the data and assigns them to variables, which are passed to the script that actually does the work (Bourne).
This is the problem. As the Bourne shell script(s) execute, the information is sent to the browser in real-time. My scripts (which do all parsing and processing) send the data back to the screen after all steps have been executed, giving the user all of the information at once. Most CGI scripts that I've seen operate in this manner, but the people who use these forms prefer the real-time effect, even though these scripts are less efficient. Any suggestions? TIA!
Please remove the "nospam" to reply directly.
--
Kelley Peagler Kelley.Peagler@lexis-nexis.com
Software Engineer (937) 865-6800 x5243
Science Direct
If a person with multiple personalities threatens suicide, is that considered a hostage situation?
------------------------------
Date: Wed, 03 Mar 1999 21:19:25 GMT
From: ddreams@my-dejanews.com
Subject: sendmail / perl problem
Message-Id: <7bk90j$pr4$1@nnrp1.dejanews.com>
Hi all... I've got a problem and I'm not sure if it's perl or linux... I'm
trying to write a short script that sends an email to inactive users. As
such I loop through the lastlog and get a list of users I want to mail.
Within that loop I'm mailing them as follows:
open(MAILFILE,"|/usr/sbin/sendmail -oi -t");
print MAILFILE qq!
To: $user\@the.correct.host
From: Administrators <director\@students.missouri.edu>
Subject: Warning... Inactive Account To Be Removed
The message body goes here...basically a 3 line message
-administrators
!;
Sendmail fails with "No recipient addresses found in header"...
But, when I run sendmail by hand:
/usr/sbin/sendmail -oi t
To: testuser@localhost
From: admin@localhost
Subject: test
body here
^d
I get a valid message sent to testuser@localhost...
What am I doing wrong? Thanks!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 3 Mar 1999 21:13:23 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Standard for inline Perl in HTML?
Message-Id: <7bk8lj$o5$1@gellyfish.btinternet.com>
In comp.lang.perl.misc Steffen Beyer <sb@sdm.de> wrote:
> In comp.lang.perl.misc David M. Chess <chess@watson.ibm.com> wrote:
>
>> Is there any sort of nascent or semi standard (or even just existing
>> practice) for how you embed Perl within HTML? I'm thinking of
>> something like JSP, only for Perl rather than Java. As in
>
>> <p>
>> The wise words for today are:
>> <perl>$now = scalar localtime; `wisewords $now`;</perl>
>> <p>
>
>> or whatever. The embedded Perl code would be executed on the
>> server, and the result would replace the entire <perl>...</perl>
>> section in the data sent to the client. I'm sure you get the
>> idea! *8)
>
>> Is anyone doing this?
>
> There are currently several solutions.
>
> The first (and best, IMO) is ePerl from Ralf Engelschall.
> See http://www.engelschall.com/sw/eperl/
> or http://www.perl.com/CPAN/authors/id/RSE/
> It is written in C (thus it's fast) and you can choose yourself
> what delimiters you want for tagging the Perl code.
>
> Another solution is EmbPerl, and there's a third whose name I can't
> remember right now.
>
If one is running Apache with mod_perl then you can use Apache::ASP to
do things like you would with ASP on NT.
/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: Wed, 03 Mar 1999 20:16:56 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: sysopen and NT
Message-Id: <36dd9899.626364@news.skynet.be>
Monte Westlund wrote:
>Our ISP says we have full read, write permissions for the directory in
>question.
And execute? I think you need it in order to create new files.
HTH,
Bart.
------------------------------
Date: Wed, 3 Mar 1999 13:53:38 -0800
From: "Dave Roth" <xrxoxtxhxdx@xrxoxtxhx.xnxextx>
Subject: Re: The Win32::AdminMisc::GetDriveSpace function
Message-Id: <XbiD2.6664$YV6.3449@news2.giganews.com>
mirak63@my-dejanews.com wrote in message
<7bjm3g$7rl$1@nnrp1.dejanews.com>...
>Has anyone usee the Win32--GetDriveSpace function. I don't have any
examples
>in either of the two books I have on Perl for Win32. I'm using the latest
of
>the ActiveState Perl builds and I think I have it installed correctly but
I'm
>getting some goofy error when I try to run the script. A working example
>would be appreciated.
GetDriveSpace( $Drive )
This function returns an array consisting of the total drive capacity and
the
available space on the specified drive.
If successful it returns an array otherwise it returns undef.
use Win32::AdminMisc;
$Drive = 'c:\';
( $TotalDriveSpace, $TotalFreeSpace ) =
in32::AdminMisc::GetDriveSpace( 'c:\' );
( $TotalDriveSpace, $TotalFreeSpace ) =
in32::AdminMisc::GetDriveSpace( '\\\\server\c$' );
dave
--
=================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
http://www.roth.net the illusion of integrity
Win32, Perl, C++, ODBC, Training
rothd at roth dot net
Our latest Perl book is now available:
"Win32 Perl Programming: The Standard Extensions"
http://www.roth.net/books/extensions/
------------------------------
Date: 3 Mar 1999 20:44:33 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: URGENT! Where Do You Hide The CGI Cards From The Spiders?
Message-Id: <7bk6vh$np$1@gellyfish.btinternet.com>
On 3 Mar 1999 15:37:35 GMT Greg Bacon wrote:
> In article <7biao8$1qi$4@client2.news.psi.net>,
> abigail@fnx.com (Abigail) writes:
> : Get some spider eating birds.
>
> I knew an old lady who swallowed a fly.
> I don't know why she swallowed the fly.
> Perhaps she'll die.
>
...
Strange but true.
Shortly after the 'bottles of beer' program challenge a while back I
was on and holiday far away from any computer and started to think how
one might write a program to present this song. Then I get back to the
real world with computers and stuff and gave up the project ...
/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: 3 Mar 1999 20:49:14 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: URGENT! Where Do You Hide The CGI Cards From The Spiders?
Message-Id: <7bk78a$ns$1@gellyfish.btinternet.com>
On Wed, 03 Mar 1999 16:50:08 GMT dturley@pobox.com wrote:
> In article <ZLZC2.79$hc3.684@nswpull.telstra.net>,
> mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>
>> This has absolutely nothing at all to do with perl.
>
> Agreed, but allow me this: the file I'm about to refer to is *.pl file. :-)
>
>
>> Spiders
>> will simply not find it if there is no link to them. Well behaved
>> spiders can be stopped with a robots.txt file. Etc.
>
> This is how I understand it as well. However, recently I was searching my
> name in one of the search engines, maybe HotBot, but I can't remember. (Come
> on, you all do it :-) I received a hit that was a config file for one of my
> scripts being used on someone's server. The file was called config.pl and
> there's no link to the file on any web pages, yet the spider indexed it. The
> person was running the script from a web directory, not a special cgi-bin
> directory, so does this mean the the spiders actually do something like a
> readddir, rather than just following links?
>
If there is no default page and directory reading has not been forbidden
then a server will read the directory at the behest of some client but only
if those conditions are met.
I would suggest that there must be a link to the file *somewhere* or the
file has been implicitly submitted to a search engine. Have you checked
with a search like 'links:blah.blah.com/config.pl' in AltaVista.
/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: Wed, 3 Mar 1999 12:11:38 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: warning: undefined filehandle diag check?
Message-Id: <MPG.1147375731cf4d129896cc@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7bk2bu$ot0@catapult.gatech.edu> on 3 Mar 1999 19:25:50 GMT,
+jeff <gt5146c@acmey.gatech.edu> says...
> Here's the warning:
>
> Value of <HANDLE> construct can be "0"; test with defined() at
> libDGT.pl line 65535 (#1)
>
> (W) In a conditional expression, you used <HANDLE>, <*> (glob),
> each(), or readdir() as a boolean value. Each of these constructs
> can return a value of "0"; that would make the conditional
> expression false, which is probably not what you intended. When
> using these constructs in conditional expressions, test their
> values with the defined operator.
I wonder how many person-hours this particular foolishness has cost the
Perl programming community. The diagnostic was introduced in 5.004 to
deal with a file which matches /^0\Z/m, which most people would agree is
*not* a valid 'text' file (defined as a sequence of 'lines' -- strings
terminated by new-line characters). This was persnickety pedantry,
mercifully fixed in 5.005.
...
> while( <TABLE> ) {
...
> I can't figure out why its giving me this error. There are plenty of
> other very similar constructs in the file, but none of the others seem
> to have this problem. In addition, why should I have to check TABLE?
> Its supposed to eventually return "0", thats how it exits the while.
No, it is supposed to return 'undef' eventually, which is FALSE.
Returning '0' is the condition the diagnostic was intended to deal with.
But the above cannot be the code that is causing the diagnostic. It
must be code of the form:
while ($line = <HANDLE>) { # *A*
and you can fix the problem (in 5.004) by replacing that by:
while (defined($line = <HANDLE>)) {
The same dispensation that always applied to the code you quoted above
now (in 5.005) applies to the code marked *A* also.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 3 Mar 1999 19:51:10 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: web browser in Perl?
Message-Id: <7bk3re$h9p$2@news.fsu.edu>
HI, I had the idea of writing a web browser in Perl. I have the
O'Reilly book 'Web Client Programming in Perl' and the 'Perl Cookbook'
which has a chapter on web programming. I'm finding that things don't
work as well as they are supposed to. Modern day web pages have
java code and tables and other things that the html parser modules
cannot handle.
Is writing a browser in Perl realistic as a part-time project for one
person? What other cool things could be done in Perl as a project
involving the web? If anyone has any ideas it would be appreciated.
Also, if you have any code that you could send me to get me started
I would be very grateful.
Thanks
------------------------------
Date: Wed, 03 Mar 1999 15:09:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Where is Randal's "HTML to CGI.pm" converter??
Message-Id: <comdog-ya02408000R0303991509250001@news.panix.com>
In article <7bk2in$l5o@dgs.dgsys.com>, jete@dgs.dgsys.com (Jete Software Inc.) posted:
> I remember that Randal Schwarz's wrote an HTML to CGI.pm converter in
> one of his Web Techniques magazine columns. I went to the Web Techniques
> site, but they don't have an adequate way of searching for a particular
> article. So after an hour, I gave up looking.
>
> Can anyone supply the URL to the article.
http://web.stonehenge.com/merlyn/WebTechniques/
then use the Find feature of your browser to search for "HTML" (case
senistivity will help) and you'll be led right to it. you could
also search for CGI.pm in the same way and immediately find the
article rather than waiting for a response from one of the millions
of people who might read your post.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 03 Mar 1999 15:32:47 -0500
From: Elaine Ashton <elaine@cts.wustl.edu>
Subject: Re: Where is Randal's "HTML to CGI.pm" converter??
Message-Id: <36DD9C6F.47B24FB3@cts.wustl.edu>
"Jete Software Inc." wrote:
> Can anyone supply the URL to the article.
http://www.stonehenge.com/merlyn/WebTechniques/col30.html
e.
------------------------------
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 5047
**************************************