[10878] in Perl-Users-Digest
Perl-Users Digest, Issue: 4479 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 22 11:07:29 1998
Date: Tue, 22 Dec 98 08:00:21 -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 Tue, 22 Dec 1998 Volume: 8 Number: 4479
Today's topics:
%ENV question <kamran@norsar.no>
Re: %ENV question (Mark-Jason Dominus)
Re: %ENV question dave@mag-sol.com
Re: Assigning to dummy variables in split command (M.J.T. Guy)
Re: check mail with perl (Clay Irving)
Re: Exit status from piped commands (Clay Irving)
Re: Exit status from piped commands <jjn@sanger.ac.uk>
Re: File Upload Script (Sam Curren)
Re: HOWTO: Builiding Perl under Win95/98 using Cygwin32 <newspost@morlock.net>
Module Installation - Need Help (Bryce Pursley)
Re: Module Installation - Need Help (Randy Kobes)
Named pipes problem (Papick Garcia Taboada)
Re: New module Net::RawIP <tripp.lilley@perspex.com>
Re: numbers in base 36 droby@copyright.com
Re: perl CGI File Upload (Sam Curren)
Re: Perl Training - Worth it? <nospam.eam@starfire.mlb.semi.harris.com>
Re: Perl/Java cgi script with pws <pdchapin@unix.amherst.edu>
Re: Perl/Java cgi script with pws <pdchapin@unix.amherst.edu>
perlcc and pTk <jansen@ats.nld.alcatel.nl>
Re: question on <> operator (Tad McClellan)
Re: question on <> operator (Andrew M. Langmead)
Re: Read "keywords" and "description" from a HTML file (Tad McClellan)
Real Newbie--please help <ashparbe@indiana.edu>
Re: regular expression alternation (Tad McClellan)
Re: Retrospective on comp.lang.perl.moderated? <rra@stanford.edu>
Re: Retrospective on comp.lang.perl.moderated? <conmara@tcon.net>
Re: Reversed hash is truncated (Jeffrey Drumm)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 22 Dec 1998 15:14:39 +0100
From: Kamran Iranpour <kamran@norsar.no>
Subject: %ENV question
Message-Id: <367FA94F.636F@norsar.no>
Hi
In my script which is supposed to communicate with an oracle
database I need to set the environment variable LD_LIBRARY_PATH.
If I set the variable outside the script then everything works but
if I chose to do it inside the script by
$ENV{LD_LIBRARY_PATH} = "SOME_LIB_PATH";
then evenif the variable is reported to have been set correctly
I still get an error message:
______________________________________
install_driver(Oracle) failed: Can't load
'/usr/local/perl/lib/site_perl/sun4-solaris/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: ld.so.1: /usr/local/perl/perl: fatal:
libsunmath.so.1: open failed: No such file or directory at
/usr/local/perl/lib/sun4-solaris/5.00404/DynaLoader.pm line 165.
at (eval 2) line 2
at /usr/local/perl/lib/site_perl/Oraperl.pm line 58
______________________________________
The file it fails to find, i.e. libsunmath.so.1 is located
in the directory specified by LD_LIBRARY_PATH.
What am I doing wrong ?
Thanks in advance
Kamran
------------------------------
Date: 22 Dec 1998 09:48:17 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: %ENV question
Message-Id: <75obfh$q45$1@monet.op.net>
In article <367FA94F.636F@norsar.no>,
Kamran Iranpour <kamran@norsar.no> wrote:
>The file it fails to find, i.e. libsunmath.so.1 is located
>in the directory specified by LD_LIBRARY_PATH.
>What am I doing wrong ?
I guess that it is trying to load the library at compile time, but the
environment variable is not set until run time.
Try putting the environment assignment into a BEGIN block:
BEGIN { $ENV{LD_LIBRARY_PATH} = ... }
------------------------------
Date: Tue, 22 Dec 1998 14:49:42 GMT
From: dave@mag-sol.com
Subject: Re: %ENV question
Message-Id: <75obi5$bje$1@nnrp1.dejanews.com>
In article <367F8EAC.190D@norsar.no>,
Kamran Iranpour <kamran@norsar.no> wrote:
> Hi
>
> In my script which is supposed to communicate with an oracle
> database I need to set the environment variable LD_LIBRARY_PATH.
> If I set the variable outside the script then everything works but
> if I chose to do it inside the script by
> %ENV{LD_LIBRARY_PATH} = "SOME_LIB_PATH";
> then evenif the variable is reported to have been set correctly
> I still get an error message:
>
> ______________________________________
> install_driver(Oracle) failed: Can't load
> '/usr/local/perl/lib/site_perl/sun4-solaris/auto/DBD/Oracle/Oracle.so'
> for module DBD::Oracle: ld.so.1: /usr/local/perl/perl: fatal:
> libsunmath.so.1: open failed: No such file or directory at
> /usr/local/perl/lib/sun4-solaris/5.00404/DynaLoader.pm line 165.
>
> at (eval 2) line 2
>
> at /usr/local/perl/lib/site_perl/Oraperl.pm line 58
> ______________________________________
>
> The file it fails to find, i.e. libsunmath.so.1 is located
> in the directory specified by LD_LIBRARY_PATH.
Try setting the environment in a BEGIN block.
BEGIN {
$ENV{LD_LIBRARY_PATH} = "/path/to/your/lib";
}
N.B. Use $ENV{LD_LIBRARY_PATH}, not %ENV{LD_LIBRARY_PATH} as you had above.
Get in the habit of using the -w command line argument and 'use strict' to
catch errors like this.
hth,
Dave...
--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 22 Dec 1998 14:15:21 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Assigning to dummy variables in split command
Message-Id: <75o9hp$5fj$1@pegasus.csx.cam.ac.uk>
Jeff Stampes <stampes@xilinx.com> wrote:
>Larry Rosler wrote:
>> There are two ways, equally appropriate. Using your example:
>>
>> ($karl, $paul, undef, $suzi, undef, undef, $other) =
>> split(/ +/,$linein);
>>
>> ($karl, $paul, $suzi, $other) = (split(/ +/,$linein))[0, 1, 3, 6];
>
>Personally I prefer #2. If you want to use #1, you have to predeclare
>your
>variables if you're being careful, otherwise:
>
>stampes@huckin [6] !!
>perl
>$foo = 'Boulder Colorado 80303 USA';
>my ($city,$state,undef,$country) = split /\s/,$foo;
>Can't declare undef operator in my at - line 2, near ") ="
Actually, that doesn't happen in the latest Perls - 5.005 or later
or the forthcoming perl5.004_05.
Mike Guy
------------------------------
Date: 22 Dec 1998 09:18:01 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: check mail with perl
Message-Id: <75o9mp$cj9@panix.com>
In <75n00h$o2e@panix.com> clay@panix.com (Clay Irving) writes:
>In <9dsf2.1784$t85.14440@news1.cityweb.de> "Patrick Schnorbus" <webmaster@gigagames.de> writes:
>>how can i get mail from a POP3 account with Perl?
>perl -M CPAN -e shell
^
Oops! No space there...
>cpan> m /POP/
>Module Mail::POP3Client (SDOWD/POP3Client-1.19.tar.gz)
>Module Net::POP3 (GBARR/libnet-1.0606.tar.gz)
>Module QPopupMenu (AWIN/PerlQt-1.06.tar.gz)
>Module URI::pop (GAAS/URI-1.00.tar.gz)
>There are at least two Perl modules that may help you.
--
Clay Irving
clay@panix.com
------------------------------
Date: 22 Dec 1998 09:45:49 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Exit status from piped commands
Message-Id: <75obat$f46@panix.com>
In <367F6F63.D41EDDC9@sanger.ac.uk> Jonathan Nicholson <jjn@sanger.ac.uk> writes:
>I want to run a command and capture the output from it, but I also
>want to be able to capture its exit status.
>Can anyone tell me if this will do what I want:-
>open(CMD, "somecommand |") or die "Command failed $!\n";
>@CMDOUT = <CMD>;
>close(CMD);
>print "somecommand ran and exited with status $? output was
>\n\n",@CMDOUT;
>$? should contain the output status & exit signal...
>Is that right?
>Closing the stream won't send a signal to the child process will it?
>Hope somebody can answer these questions,
Try a different approach -- Let's write a small test program called
foo.pl:
#!/usr/local/bin/perl -w
exit 0;
Let's write another one called foo2.pl:
#!/usr/local/bin/perl -w
$status = system("./foo.pl");
print "$status\n";
When we run foo2.pl we get:
0
Let's modify foo.pl to exit with a status of 1:
#!/usr/local/bin/perl5 -w
exit 1;
Run foo2.pl again:
256
Why 256? -- See perldoc -f system:
The return value is the exit status of the program as returned by
the C<wait()> call. To get the actual exit value divide by 256.
Our test program, foo2.pl, could also be written with backticks:
#!/usr/local/bin/perl -w
`./foo.pl`;
print "$?\n";
--
Clay Irving
clay@panix.com
------------------------------
Date: Tue, 22 Dec 1998 15:25:20 +0000
From: Jonathan Nicholson <jjn@sanger.ac.uk>
Subject: Re: Exit status from piped commands
Message-Id: <367FB9E0.B960165A@sanger.ac.uk>
Clay Irving wrote:
> #!/usr/local/bin/perl -w
>
> $status = system("./foo.pl");
> print "$status\n";
>
Yes yes yes, that's all very well, but you cannot capture the output
of the system'd program into an array to process later.
That's the point of the exercise. I need to be able to get both the
STDOUT from the subprogram as well as it's exit status.
I do need to know the signal that it was sent as it is possible for
a sig term to be sent to the program and for it to exit with zero
status. A signal but no status would indicate an error condition as
well as a non zero exit.
Regards,
Jonathan
------------------------------
Date: Tue, 22 Dec 1998 07:59:02 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: File Upload Script
Message-Id: <MPG.10e961a487a7f36d9896c7@news.sonic.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
I have tried several, and had trouble with all the ones using cgi_lib.pl
Using CGI.pm I have been very successful. Let me know if you need any
example scripts, I have several that worked for me.
-Sam
In article <HYxf2.706$kY5.995@nnrp1.ptd.net>, bimmy@hotmail.com says...
> Hello,
>
> I am working on a web site which I would like to incorporate a file
> upload script into. I have found several of these scripts but none of them
> seem to have everything I need. I am fairly new to PERL so I am having some
> problems figuring out how to make the needed modifications. To make things
> worse, the web site I am creating is specifically for Christmas. I am no
> longer able to figure out how to create this script due to the lack of time.
> If anyone is interested in helping me either find one or create one, I will
> unfortunately not be able to pay, cash at least, but I will give you full
> credit for the script with several links throughout the site back to you.
> This web site could see more than a few thousand hits by the end of the
> week! What I need is a file upload script that uploads to an admin specified
> directory, only allows specific files to be uploaded, such as .jpg and .gif
> files. One that also limits file size. If possible the script should also be
> able to remove the uploaded files after a certain period of time on the
> server. If you can help me with this task then please e-mail me as soon as
> possible! Thanks for your time!
>
> -jim
>
>
>
------------------------------
Date: Tue, 22 Dec 1998 10:16:16 -0500
From: "Steven Morlock" <newspost@morlock.net>
Subject: Re: HOWTO: Builiding Perl under Win95/98 using Cygwin32
Message-Id: <SJOf2.3562$qF5.6772418@lwnws01.ne.mediaone.net>
I realized that in my original post I left out a couple important
details. I'd like to correct that here.
There is a need to address the issue of end of lines being CR/NL or
NL on the Windows platform. Cygwin32 by default converts NL to CR/NL
during file I/O by non Cygwin32-savvy applications. This means that
Perl, since it does not support 'binmode' for the Cygwin32 platform, will
not be able to read & write untranslated/binary files. There are two
methods of over coming this. The first is to mount the Cygwin32
partitions in binary mode. The second is to enable binmode support
in Perl. In the original post I had mounted the partition as binary
and neglected to include that fact in the post.
* Using a binary partition:
Mount the Perl source & installation destination partitions in binary
mode. Refer to the Cygnus documentation on 'mount' for details:
http://sourceware.cygnus.com/cygwin/cygwin-ug-net/mount.html
On my system since everything was in the root partition I issued the
following commands from the bash shell:
umount /
mount -b c:\\ /
You must also get and install the gzip'd version of the Perl source code
archive. The zip'd version of the archive has all NL converted to CR/NL
pairs in all text files. So you should be downloading the files ending in
'.gz', not '.zip'.
* Patching Perl to add Cygwin32 binmode support:
For this method you can use either the gzip'd or zip'd version of the
Perl source archive.
Apply the following patch to <PERL>/perl.h:
*** perl.h.ORIG Tue Dec 22 09:22:42 1998
--- perl.h Tue Dec 22 09:43:10 1998
***************
*** 1480,1483 ****
--- 1480,1495 ----
#endif
+ #if defined(__CYGWIN32__)
+ /* USEMYBINMODE
+ * This symbol, if defined, indicates that the program should
+ * use the routine my_binmode(FILE *fp, char iotype) to insure
+ * that a file is in "binary" mode -- that is, that no translation
+ * of bytes occurs on read or write operations.
+ */
+ #define USEMYBINMODE / **/
+ #define my_binmode(fp, iotype) \
+ (PerlLIO_setmode(PerlIO_fileno(fp), O_BINARY) != -1 ? TRUE : NULL)
+ #endif
+
#include "regexp.h"
#include "sv.h"
Regards,
Steve
--
Steven Morlock
Foliage Software Systems
aka The Nerd Farm
http://www.foliage.com
------------------------------
Date: Tue, 22 Dec 1998 14:18:08 GMT
From: hbpursle@duke-energy.com (Bryce Pursley)
Subject: Module Installation - Need Help
Message-Id: <3682a67e.2833327028@news.infoave.net>
I'm trying to install my first module. I've got the module file
(MailTools-1.12) decompressed and unpacked in
c:\perl\lib\MailTools-1.12. I have the help file (Installing CPAN
Modules) displayed in front of me and I'm following the instructions.
The instructions read:
C. BUILD
Go into the newly-created directory and type:
perl Makefile.PL
When I did this I get:
Can't locate ExtUtils/MakeMaker.pm in @INC at makefile.pl line 12.
BEGIN failed--compilation aborted at makefile.pl line 12.
I figured this "@INC" was something like a path statement to certain
utilities so I searched the instructions for @INC and found another
command. It seemed to be the way to print out what @INC had in it's
memory. I ran the following command:
C:\PERL>perl -e 'print "@INC"'
When I did this I got:
Can't find string terminator "'" anywhere before EOF at -e line 1.
Can someone help me fix this whole situtation and get the module
installed. I need to have a perl script send a text file to my boss
via email on my WinNT machine . . . real soon. <G>
Thanks,
Bryce
------------------------------
Date: 22 Dec 1998 15:17:28 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: Module Installation - Need Help
Message-Id: <slrn77vehp.7ag.randy@theory.uwinnipeg.ca>
On Tue, 22 Dec 1998 14:18:08 GMT,
Bryce Pursley <hbpursle@duke-energy.com> wrote:
>I'm trying to install my first module. I've got the module file
>(MailTools-1.12) decompressed and unpacked in
>c:\perl\lib\MailTools-1.12. I have the help file (Installing CPAN
>Modules) displayed in front of me and I'm following the instructions.
>When I did this I get:
>Can't locate ExtUtils/MakeMaker.pm in @INC at makefile.pl line 12.
Hi,
I assume you're using an ActiveState perl? I believe some of
their earlier versions had this problem - if you have such an
early version, go to http://www.activestate.com/ and pick up
the latest release. You might also want to look into their
ppm (Perl Package Manager) which simplifies module installation
(for those modules they have available), or else at the CPAN
module, which is used as
perl -MCPAN -e shell
install Mail::Send
>I figured this "@INC" was something like a path statement to certain
>utilities so I searched the instructions for @INC and found another
>command. It seemed to be the way to print out what @INC had in it's
>memory. I ran the following command:
> C:\PERL>perl -e 'print "@INC"'
>When I did this I got:
>Can't find string terminator "'" anywhere before EOF at -e line 1.
>
Win32 gets confused sometimes with quotes that work in Unix - try
perl -e "print @INC"
There's some README files in the source distribution of perl that
describe this problem and some workarounds, as well as some other
Win32 peculiarities, such as with file globbing.
--
Best regards,
Randy Kobes
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theory.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: Tue, 22 Dec 1998 14:04:33 GMT
From: papick.taboada@gmx.net (Papick Garcia Taboada)
Subject: Named pipes problem
Message-Id: <36819ffb.75330749@news.inka.de>
Hi!
How can I open an named pipe and write/ read some stuff?
Here is my scenario:
one OS/2 machine (named BLOB), running ISDNPM (creates named pipe
\PIPE\ISDNPM.CMD)
... and ...
some OS/2, Win95 and Win98 client machines
Under the OS/2 client, I use Rexx to open the \\BLOB\PIPE\ISDNPM.CMD
named pipe. How can I do this with perl under win98/95 ???
brgds
Papick
----------------------------------------
papick.taboada@gmx.net
http://www.uni-karlsruhe.de/~Papick.Taboada
------------------------------
Date: Tue, 22 Dec 1998 10:43:06 -0500
From: Tripp Lilley <tripp.lilley@perspex.com>
Subject: Re: New module Net::RawIP
Message-Id: <367FBE0A.7A34BB0B@perspex.com>
"William R. Ward" wrote:
> Why not just Net::IP?
Or, better yet, Net::IPv4.
------------------------------
Date: Tue, 22 Dec 1998 15:15:29 GMT
From: droby@copyright.com
Subject: Re: numbers in base 36
Message-Id: <75od2e$d29$1@nnrp1.dejanews.com>
In article <75luud$ces$1@nnrp1.dejanews.com>,
ptimmins@netserv.unmc.edu wrote:
> In article <75k5rg$gtu$1@client3.news.psi.net>,
> abigail@fnx.com wrote:
>
> > Jarkko Hietaniemi (jhi@alpha.hut.fi) wrote on MCMXXXV September MCMXCIII
> > in <URL:news:oeesoedrvpr.fsf@alpha.hut.fi>:
> > ++
> > ++ Okay, give me 123**456 in base 789?
> >
<snip Abigail's answer - correct but lengthy>
> >
> > HTH. HAND.
> >
> > Abigail
>
> I can't get past 60*789**105 on any of the systems I have access to,
> let alone 569*789**328, so I'll ignore that dig :) ... or is there some
> way to derive it, rather than actual numerical computation?
>
> Patrick Timmins
> $monger{Omaha}[0]
>
I suspect it requires actual numerical computation with BigInts.
Here's mine, and it works on a Pentium 166 running Linux 2.0.36.
#!/usr/bin/perl
use strict;
use Math::BigInt;
use subs qw(bigbase2base);
my $x = Math::BigInt->new('123');
$x = $x ** 456;
$x =~ tr/+//d;
print bigbase2base(10, 789, split(//, $x)), "\n";
# sub bigbase2base
# input: < base of input number, in decimal >
# < base of output number, in decimal >
# < array of input "digits" (integers less than input base) >
#
# output: array of "digits" in output base
#
# Credits: modified for BigInts and bases past 36 from
# Brian Foy's base2base. Also simplified some computation.
#
sub bigbase2base
{
my $in_base = shift;
my $out_base = shift;
my @num = @_;
$in_base = 10 unless $in_base =~ /^\d+$/;
$out_base = 10 unless $out_base =~ /^\d+$/;
return @num if $in_base == $out_base;
#convert to a bigint
my $temp_num = Math::BigInt->new('0');
my $count = 0;
foreach my $digit ( @num )
{
$temp_num = $temp_num * $in_base + $digit;
}
my @output = ();
while ($temp_num) {
my $this_digit = $temp_num % $out_base;
$this_digit =~ tr /+/ /;
unshift @output, $this_digit;
$temp_num = ($temp_num-$this_digit)/$out_base;
}
return @output;
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 22 Dec 1998 07:53:20 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: perl CGI File Upload
Message-Id: <MPG.10e9604e78e087e69896c6@news.sonic.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
Use CGI.pm to process that. The wheel has already been invented, let's
use it.
-Sam
In article <367EDFE3.EFC5E0EF@divcomp.com>, esundby@divcomp.com says...
> o use perl to upload a file via a web browser. Things
> seem to work fine when I upload text. However, when I attempt to upload
> a binary file, I get the following error:
>
>
------------------------------
Date: Tue, 22 Dec 1998 10:35:57 -0500
From: Software Sciences <nospam.eam@starfire.mlb.semi.harris.com>
Subject: Re: Perl Training - Worth it?
Message-Id: <367FBC5D.8CA3CCCA@starfire.mlb.semi.harris.com>
Along this subject of perl training- is there any available here in the middle
of technical-nowhere, Central Florida USA? I've contacted every Perl training
company I've seen & so far none offer classes in this region.
Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, Chris Hobbs <chobbs@silvervalley.k12.ca.us> writes:
> :So my question is, "Has anyone attended these courses?" It's $1095 for
> :each, and while I could get the boss to pay for it, I could also buy the
------------------------------
Date: Tue, 22 Dec 1998 09:02:15 -0500
From: "Paul Chapin" <pdchapin@unix.amherst.edu>
Subject: Re: Perl/Java cgi script with pws
Message-Id: <367fa668.0@amhnt2.amherst.edu>
Paul Chapin wrote in message <3677bbe7.0@amhnt2.amherst.edu>...
>I have been able to determine that the Java program does run, and
apparently
>to completion. The problem, therefore, appears to be in getting the Perl
>script to restart - perl doesn't appear to execute anything after the
>@results=`java testjava`; statement. I'm going to try upgrading my version
>of perl and see if that helps, but I'm open to other suggestions.
Upgrading perl didn't get me anything. Anybody have any other ideas?
-----
Paul Chapin
UNIX Manager
Amherst College
413 542-2144
http://www.amherst.edu/~pdchapin
------------------------------
Date: Tue, 22 Dec 1998 09:57:05 -0500
From: "Paul Chapin" <pdchapin@unix.amherst.edu>
Subject: Re: Perl/Java cgi script with pws
Message-Id: <367fb343.0@amhnt2.amherst.edu>
>Paul Chapin wrote in message <3677bbe7.0@amhnt2.amherst.edu>...
>>I have been able to determine that the Java program does run, and
>apparently
>>to completion. The problem, therefore, appears to be in getting the Perl
>>script to restart - perl doesn't appear to execute anything after the
>>@results=`java testjava`; statement.
I've also been able to determine that the problem isn't just with java. If
it do
@results=`perl test.pl`;
I get the same results - runs fine from a DOS prompt but hangs (no error
reported) when run from PWS. It looks like PWS is interfering with how the
new process talks with the original script. At the moment I can't see any
easy way to determine if @results is actually getting anything loaded into
it or not.
All I'm trying to do is use PWS at home so I can do development without
being connected to the final web server. Microsoft even talks about this as
a use of PWS, but it doesn't make much sense if it doesn't work.
Maybe I should just wipe Windows, install Linux, and run a real web server.
At work we are considering how to do our web service in the future and
Microsoft is not making any points with me with this product. The idea of
letting faculty/staff/students do cgi development on their own systems with
PWS is attractive, and makes IIS on NT more attractive versus Apache on
UNIX, but only if it works and in a way we can support.
Anybody out there from Microsoft listening?
-----
Paul Chapin
UNIX Manager
Amherst College
413 542-2144
http://www.amherst.edu/~pdchapin
------------------------------
Date: Tue, 22 Dec 1998 16:04:42 +0100
From: joris jansen <jansen@ats.nld.alcatel.nl>
Subject: perlcc and pTk
Message-Id: <367FB50A.72FF6F88@ats.nld.alcatel.nl>
Hello all Camel-lovers,
I'm having some trouble with the perl compiler. I trie to compile
a pels-script that uses pTk. As all pTk-scripts, there's something like
$top = MainWindow->new();
And that's exactly what's not working. Anyone got a clue ??
Joris
--
+----------------------------------+-----------------------------------+
| Joris Jansen | Alcatel Telecom Nederland |
| jansen@ats.nld.alcatel.nl | Postbus 3292 |
| phone +31 (70) 307 9136 | 2280 GG Rijswijk (ZH) |
| fax +31 (70) 307 9191 | The Netherlands |
+----------------------------------+-----------------------------------+
| No question is too silly to ask, though some are too silly to answer |
+----------------------------------------------------------------------+
------------------------------
Date: Tue, 22 Dec 1998 08:07:22 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: question on <> operator
Message-Id: <q29o57.ru3.ln@magna.metronet.com>
optiknerv1138@yahoo.com wrote:
: Want to do something like this:
: #!/user/bin/perl
You are missing a -w switch there.
: #
: if(<>) { print "there's something on stdin\n";
: } else { print "Type something you twit: ";
: chop($something=<STDIN>);
: }
: Except this doesn't work of course.
: Already looked through the
: Camel book and the llama book.
But you should have looked in the docs that shipped with your
perl distribution first. They are more complete and accurate
than any book (and you can have a machine search through them
for you).
Perl FAQ, part 8:
"How do I check whether input is ready on the keyboard?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Dec 1998 15:55:08 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: question on <> operator
Message-Id: <F4DIvw.81v@world.std.com>
optiknerv1138@yahoo.com writes:
>#!/user/bin/perl
>#
>if(<>) { print "there's something on stdin\n";
> } else { print "Type something you twit: ";
> chop($something=<STDIN>);
>}
>Except this doesn't work of course.
>For example, when you run the ftp command you can
>optionally enter a ip address, or if there was
>nothing entered after ftp command, prog propts for
>input.
One important point to remember is that the filehandle read operator
with the empty argument is a special case in perl. If your situation
doesn't match that special case, you just have to ignore it and
perform the steps explicitly.
The "<>" construct removes the first file in the @ARGV array (the
command line arguments) opens it for reading (giving a warning if it
can't open the file.) and returns a line from it. After the file is
exhausted, it takes the next file until all of the files are
processed. (And as an additional special case, if @ARGV is empty, it
opens standard input instead.)
By the way, your comments in the code and your explanation contradict
each other somewhat. Your text implies that you want to read the first
item from the command line, or prompt if there are not arguments. The
comments, however talk about reading from standard input (but I assume
you mean from the default filehandle which will be the contents of the
first file on the command line.) I know that this is partially what
you are asking about, but I just want to make sure you understand the
difference between a programs argument list and its input stream. (The
shell is reading its standard input to read commands. In the simplest
case, a command is a program named followed by zero or more
arguments. When the shell executes a program, the arguments collected
by the shell are passed to it in its argument list, but they have
nothing to do with the program's standard input.)
In this case, you want the command line argument to be optional, and
you don't want it treated as a filename to be read. So what you want,
is to just grab the data from @ARGV directly.
# try to get the argument from the command line
unless ($something = shift @ARGV) {
# if there was nothing, then prompt the user.
print "Type something...";
$something = <STDIN>;
}
Except if you want to deal with the pathological case where the
command line argument might be the string "0". In that case you
can expand it a bit to:
unless (defined($something = shift @ARGV)) {
print "Type something...";
$something = <STDIN>;
}
--
Andrew Langmead
------------------------------
Date: Tue, 22 Dec 1998 09:03:52 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Read "keywords" and "description" from a HTML file
Message-Id: <occo57.se4.ln@magna.metronet.com>
ChrisG (dont@spam.me) wrote:
: Has anyone any advice on reading the contents of the "keywords" and
: "description" Meta Tags from a HTML file?
use HTML::Parser;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Dec 1998 10:34:14 -0500
From: Anna Shparberg <ashparbe@indiana.edu>
Subject: Real Newbie--please help
Message-Id: <367FBBF5.9734C87F@indiana.edu>
Help! This is a real newbie question!
I have just started learning Perl, and it's my first programming
language. So far I've had no problems with writing and executing a few
simple programs (my platform is Windows95). What annoys me is having to
store and run them in perl5\bin, otherwise they won't run at all. My
path in the autoexec.bat file is set like this:
path %path%;C:\Perl5\perl5\bin;
How do I run Perl from another directory?! Please don't laugh at me!
Thanks,
Anna
------------------------------
Date: Tue, 22 Dec 1998 08:59:04 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regular expression alternation
Message-Id: <o3co57.se4.ln@magna.metronet.com>
Stuart Hughes (sehughes@mistral.co.uk) wrote:
: I'm trying to extract the filename and extension from a scalar using a
: regular expression.
That wheel has already been invented, I'd just use that. See below.
: The following works for file.ext and file.more.ext,
: but it doesn't match file. I thought the alternation clause would catch
: it but it doesn't and so I'm confused ?? any ideas
It does catch it. But it puts it in $3, which you do not access...
: ($name, $ext) = /(?:^(.*)\.(.*))|(^.*)/;
-----------------------
#!/usr/bin/perl -w
use File::Basename;
foreach ( '/home/c/fred.c', '/home/c/fred.orig.c', '/home/c/fred' ) {
($name, $dir, $ext) = fileparse($_, ('\.[^.]*'));
print "dir '$dir' name '$name' ext '$ext'\n";
}
-----------------------
output:
dir '/home/c/' name 'fred' ext '.c'
dir '/home/c/' name 'fred.orig' ext '.c'
dir '/home/c/' name 'fred' ext ''
You haven't said what you want to do with filenames that
start with a dot, eg: .fred
Should that be a $name or a $ext with an empty $name?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Dec 1998 23:49:15 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <ylyao039c4.fsf@windlord.stanford.edu>
In comp.lang.perl.moderated, H M Brand <PROCURA_BV@CompuServe.com> writes:
> I was surprised by a posting rule that inhibits short answers: I was not
> allowed to put two (new) lines in between an original post.
For what it's worth, it was probably more the quantity of quoting than the
quantity of new material. We try to keep the level of new material high
and the level of quoted material low.
The rough rules of thumb (and note that none of the moderators are using
anything automatic to make this decision; it's a judgement call taking
into account the post in question) are that there probably should be some
original text on the first screen of the post and that there should be
more original text than quoted text unless the entire post is quite short.
I realize that that can be quite a hassle in some newsreaders. :/ (I
personally consider that a serious bug in those newsreaders.) It does
help the readability of a group immensely, though, particularly for people
over slow connections.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Mon, 21 Dec 1998 15:42:13 -0500
From: Ken McNamara <conmara@tcon.net>
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <367EB2A4.73F47D66@tcon.net>
I hope you'll continue the moderated page. Is there anyway to sort through
the 'newbie See John run!' stuff on misc and post/move the better questions
onto moderated?
Thanks for the effort it takes to keep the mod page up - it's appreciated.
KenMc
Larry Rosler wrote:
> With year-end-assessment time rapidly approaching, would anyone care to
> comment on how comp.lang.perl.moderated has performed over its life of
> six months or so, relative to the hopes and expectations of its
> proponents?
>
> A cost-benefit analysis at this time might be enlightening.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Tue, 22 Dec 1998 14:10:37 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Reversed hash is truncated
Message-Id: <3680a474.214867585@news.mmc.org>
[ posted, not mailed - invalid mail address ]
On Mon, 21 Dec 1998 21:04:11 -0500, "Robert Gwynne"
<nospam_gwynne@utkux.utk.edu> wrote:
>I'm trying to modify the code for processing everyword in a file found on
>page 280 of the Perl Cookbook so that it prints out a sorted list of values
>by keys instead of keys by values. If I reverse the hash, the resulting hash
>ends up being truncated. Consequently, I don't get a list of all of the
>key/value pairs that SHOULD be in the list.
>
>The following is a simplified snippet of code used to test the result.
>
>#!/usr/local/bin/perl -w
>
>open(TEXT, "file1") || die "Can't open it.";
>%seen = ();
>while (<TEXT>) {
> while( /(\w['\w-]*)/g) {
> $seen{lc $1}++;
> }
> }
>print "Plain old %seen is: \n";
>print %seen, "\n\n";
>print ".................................\n";
>%reversed_seen = reverse (%seen);
>
>print "Reversed %seen is: \n";
>print %reversed_seen , "\n";
>print "...........................\n";
>###################################
>The results follow:
>Plain old %seen is:
>hear1www1readers8examine1be2complaint1asked1i'll1pretty1between1communities1
>tim1
>.................................
>Reversed %seen is:
>10and1hear11that2be3mistakes22the4percent5what7in8readers
>...........................
>
>#########################
>%seen runs off the right side of the page; whereas, %reversed_seen contains
>only ten pairs.
>
>Now, I understand that this happens because not all values in the reversed
>hash are unique; however, I would like to end up with a list of alphabetized
>words in column one and their frequency in column two instead of a list of
>sorted frequencies in column one and unordered words in column two. How can
>I do that? I've spent considerable time trying to solve the problem, looked
>at the books, the FAQ, etc., but can't find the answer.
If you simply want your list of words/frequencies ordered alphabetically by
word, reversing the hash doesn't get you anywhere, as you've noticed.
Here's one way to get what you've asked for:
foreach my $word (sort keys %seen)
{
print "$word\t$seen{$word}\n";
}
If you'd like a list ordered numerically (descending) by word frequency,
then alphabetically by word for words with the same frequency, you need
only build an array with the keys in the order you'd like (the '||' OR
operator in the sort anonymous subroutine lets the comparison "fall
through" to the second level when the first level comes up equivalent):
@keys = sort {
$seen{$b} <=> $seen{$a}
||
$a cmp $b
} keys %seen;
Then simply step through the array:
foreach my $word (@keys)
{
print "$word\t$seen{$word}\n";
}
This is covered in perlfaq4, "How do I sort a hash (optionally by value
instead of key)?"
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
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 4479
**************************************