[7274] in Perl-Users-Digest
Perl-Users Digest, Issue: 899 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 21 07:07:18 1997
Date: Thu, 21 Aug 97 04:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 21 Aug 1997 Volume: 8 Number: 899
Today's topics:
Re: *Really* dynamic function loading? <tom@mitra.phys.uit.no>
Call for help: SDF locales (Ian Clatworthy)
Calling ISQL from within Perl <pegit.swedmap@mbox300.swipnet.se>
Re: code conversion.... <ajohnson@gpu.srv.ualberta.ca>
Converting text to Excel data with UNIX <joepet@server.berkeley.edu>
Embedding Perl5.004_01 on WinNT <jerry_hicks@bigfoot.com>
Re: Embedding Perl5.004_01 on WinNT <jerry_hicks@bigfoot.com>
Re: Embedding Perl5.004_01 on WinNT <jerry_hicks@bigfoot.com>
Re: FAQ Database <seay@absyss.fr>
Re: Field Length (M.J.T. Guy)
Re: Germany_Colonge needs help... Path conflict ! <gordon.leslie.mcdorman@sap-ag.de>
Re: help with this search pattern problem!! (Matti Kinnunen)
Re: HELP: Search and replace!! <polone@sanasys.com>
Re: How do I find the system date/time? <seay@absyss.fr>
Re: How to Wrap long lines?? (Novice) <petri.backstrom@icl.fi>
Howdy Cousin! <jerry_hicks@bigfoot.com>
Re: I'm looking for a perl logo... <seay@absyss.fr>
Re: Passing 1 programs O/P to anothers I/P via file han <dbe@wgn.net>
Re: Passing 1 programs O/P to anothers I/P via file han <seay@absyss.fr>
Perl & Forms <amerar@unsu.com>
PERL 5.001 on WIN NT 4.0 with IIS 3.0 <dqr@mailhost.tornado.be>
perl compiler: can't locate object error <alan.hobesh@ucop.edu>
Re: perl question <polone@sanasys.com>
range operator bug? (Martin Goldstern)
Re: Reading a string, splitting it, and using it (M.J.T. Guy)
Re: setuid and perl <seay@absyss.fr>
Re: Sockets <seay@absyss.fr>
Re: Sockets <petri.backstrom@icl.fi>
Re: split() with capturing parantheses doesn't work cor <tom@mitra.phys.uit.no>
Re: unexpected foreach value (M.J.T. Guy)
Re: Unix text file problem <seay@absyss.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Aug 1997 11:28:15 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: *Really* dynamic function loading?
Message-Id: <nqo67szopg0.fsf@mitra.phys.uit.no>
zerkle@krakatoa.cs.ucdavis.edu (Dan Zerkle) writes:
> : I want to do some very late loading and execution of subroutines,
> The problem is that I don't know the names of the library
> files or functions until after the program is running.
> So, I use eval() to generate the proper "use" line and
> function calls.
use is just a compile-time wrapper around require and import. If you
want to do this at runtime, just say require. Snipping from the
perlmod manpage:
Perl modules are included into your program by saying
use Module;
or
use Module LIST;
This is exactly equivalent to
BEGIN { require "Module.pm"; import Module; }
or
BEGIN { require "Module.pm"; import Module LIST; }
As a special case
use Module ();
is exactly equivalent to
BEGIN { require "Module.pm"; }
Also, for calling functions by name, look at the entries for symbolic
references in the perlref manpage.
I don't think you need eval for what you're doing
> Here's an example.
[pkg snipped]
> #!/pkg/bin/perl
[...]
> eval("use ".$pkgname.";\n".$pkgname."::".$subname."()");
> warn $@ if $@;
require "$pkgname.pm";
import $pkgname;
&{"$pkgname"."::$subname"}();
> eval($pkgname."::".$sub2name."()");
> warn $@ if $@;
&{"$pkgname"."::$sub2name"}();
(You need to separate the string with the package name from the "::"
to avoid Perl looking for your variables in strange namespaces. Thus
the "$a"."::$b" above.)
Yes, I tested this and it does work.
> I'm not sure about the consequences here. Even though I'm
> a Perl newbie, I'm pretty sure that the eval() is going to
> have a big overhead if I call the functions like that repeatedly.
> If so, does anyone know a more efficient way to do it?
I'm sure you're right about the overhead. I tend to avoid evals
whenever possible. With the reference mechanism, that tends to be
most of the time.
As an aside, you should probably name your package/module with an
inital capital letter. Lowercase names are "reserved" for pragmata
like strict and integer.
> Dan Zerkle zerkle@cs.ucdavis.edu
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 21 Aug 1997 02:43:06 GMT
From: ianc@mincom.com (Ian Clatworthy)
Subject: Call for help: SDF locales
Message-Id: <5tg9vq$ees$1@pithy.mincom.oz.au>
Keywords: SDF,internationalization,locales
If you are a non-English speaker and can spare a few minutes,
I'd appreciate it if you could help me improve SDF's support
of non-English languages. SDF is a freely available documentation
system which can translate POD and SDF into lots of other formats.
SDF is completely implemented in Perl (of course).
See http://www.mincom.com/mtr/sdf/ for details.
If you'd like to help, simply edit the file below and
email me the result. I'm planning to name each file using
the POSIX country specifier, so please use that convention
in the Title.
Thanks in advance,
Ian Clatworthy (ianc@mincom.com)
--------------------------------
# $Id$
#
# >>Title:: en.sdl - English Locale
#
# >>History::
# -----------------------------------------------------------------------
# Date Who Change
# 19-Aug-97 ianc
# -----------------------------------------------------------------------
#
# Generated list titles
!define DOC_TOC_TITLE "Table of Contents"
!define DOC_LOF_TITLE "List of Figures"
!define DOC_LOT_TITLE "List of Tables"
# Navigation strings
!define HTML_TEXT_CONTENTS "Contents"
!define HTML_TEXT_PARENT "Parent"
!define HTML_TEXT_PREVIOUS "Previous Topic"
!define HTML_TEXT_NEXT "Next Topic"
!define HTML_TEXT_HOME "Home"
!define HTML_TEXT_CATALOG "Catalog"
!define HTML_TEXT_SEARCH "Search"
------------------------------
Date: Thu, 21 Aug 1997 12:12:52 +0200
From: Pinne <pegit.swedmap@mbox300.swipnet.se>
Subject: Calling ISQL from within Perl
Message-Id: <33FC14A4.3505@mbox300.swipnet.se>
Hi
Running Perl on NT S 4.0 w IIS 3.0 sp3.
I try to call the ISQL cmd-line utility fro mwithin
a Perl script.
But it won't work unless I call it through a bat-file.
Anyone any suiggestions.
Thanks in advance for any help
------------------------------
Date: Thu, 21 Aug 1997 01:29:57 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: code conversion....
Message-Id: <33FBE065.796D6309@gpu.srv.ualberta.ca>
Richard J. Finn wrote:
!
! I was wondering if anyone could help me...
!
! I'm trying to turn a string of characters into their
! ASCII codes seperated by |'s. I then need code that does the
! reverse. I have them in TCL... but I need to also have them in
! Perl. Could anyone convert the following procedures?
[snip tcl procs]
you can try these:
sub convert {
return join '|', map{ord} split //,shift;
}
sub un_convert {
return join '', map{chr} split /\|/,shift;
}
(I'm sure there are other ways as well)
regards
andrew
------------------------------
Date: Thu, 21 Aug 1997 01:16:08 -0700
From: Joe Petrow <joepet@server.berkeley.edu>
Subject: Converting text to Excel data with UNIX
Message-Id: <Pine.ULT.3.96.970821011541.18864B-100000@server>
Could somebody point me to some information on a Perl routine that
converts tab delimited text data in native Excel format?
Or if not that, to a place that specifies exactly what native Excel format
is?
Thank you.
Joe Petrow
joepet@server.berkeley.edu
http://server.berkeley.edu/~joepet
------------------------------
Date: 21 Aug 1997 06:07:37 GMT
From: "Jerry Hicks" <jerry_hicks@bigfoot.com>
Subject: Embedding Perl5.004_01 on WinNT
Message-Id: <01bcadf8$d60fddf0$4acebbcd@jhicks>
I've been able to get a basic embedded Perl running satisfactory on a
single thread of a multithreaded WinNT app (written using Microsoft
Foundation Classes).
The docs lead me straight through it and the simple case of initializing
Perl and evaluating snippets of code works great.
Then, I ran into a couple of snags...
This program needs to run in this sequence:
maybe_several_times_usually_once() {
perl_alloc();
perl_construct();
perl_parse(embedding argv);
...long running application specific stuff...
perl_destruct()
perl_free();
}
The problem is, Perl dies in perl_parse after the first iteration
completes.
The perl_destruct function does an early return [perl.c:line 238], before a
temporary file created by the command line eval is closed [e_fp], causing
an IO error on the next invocation of perl_parse();
After reading the code in perl.c, I tried removing the return which depends
on an "exit()" to complete destruction of the interpreter context. That
seems to work OK, but causes a memory leak during the regular expression
regression test. I suspect that is why the return was put in there
Any suggestions? Obviously, I can't depend on exit() to clean up for me
since I may need to iterate.
This is going through a QA group enlightened enough to allow the use of
Perl, but they will not tolerate memory leaks since it screws their other
regression tests unrelated to Perl.
TIA,
Jerry Hicks
jerry_hicks@bigfoot.com (email replies appreciated)
------------------------------
Date: 21 Aug 1997 06:25:56 GMT
From: "Jerry Hicks" <jerry_hicks@bigfoot.com>
Subject: Re: Embedding Perl5.004_01 on WinNT
Message-Id: <01bcadfb$65982e80$4acebbcd@jhicks>
Looks like 5.004_02 will fix this... Wonder when it goes to release?
Jerry Hicks <jerry_hicks@bigfoot.com> wrote in article
> .
> .
> Any suggestions? ...
>
> TIA,
>
> Jerry Hicks
> jerry_hicks@bigfoot.com (email replies appreciated)
>
>
------------------------------
Date: 21 Aug 1997 08:05:19 GMT
From: "Jerry Hicks" <jerry_hicks@bigfoot.com>
Subject: Re: Embedding Perl5.004_01 on WinNT
Message-Id: <01bcae09$478db820$98741fcc@jhicks>
oops... I glossed over the "multiplicity" section of perlembed...
:@
------------------------------
Date: Thu, 21 Aug 1997 11:47:06 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: FAQ Database
Message-Id: <33FC0E9A.4E152419@absyss.fr>
Jason McNutt wrote:
>
> I am developing an FAQ but I haven't seen any scripts to create and
> search a flat database on an FAQ. If anyone has suggestions or know
> where to find the script let me know. I don't want to re-invent the
> wheel.
I've never seen anything that does this, but that doesn't mean much. It
would be fairly straight forward to reinvent this wheel.
Do something like "perldoc -f". Keep your data in pod format with all
the questions as header lines (=head2 How do I do FOO without doing
BAR?). When you have a question, look at the header lines, chop
everything down to the next one. For a bit of speed, you could cache
these headerlines in a hash of $question=>linenum pairs. Then you can
now do your lookup of the keys of this hash, and just hop directly to
the correct line number. This should save a lot of I/O time.
If you want to speed up your searches even more, you build a hash of
$word=>[questions] where each word points to the set of questions that
contains the word (delete "the", "and" and other common words). When
someone enteres a query, just return the union of the sets for OR type
searches or the intersection for AND type searches.
- doug
------------------------------
Date: 21 Aug 1997 10:43:49 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Field Length
Message-Id: <5th655$1m7$1@lyra.csx.cam.ac.uk>
Joshua Marotti <jpm@iti-oh.com> wrote:
>John Grimm wrote:
>
>> How do I determine the length of a variable?
>
>I can't remember if this is totally correct... I may be wrong, but I
>believe, if it is a string, you can place it into an array with a simple
>assign declaration (@string = $string). Then you find the count simply
>by $count = $#string.
Sorry, but that's complete rubbish.
@string = string
will make @string an array of length 1 with $string[0] equal to $string.
So $count will always be set to 0.
You should actually use the length function (surprise surprise); see
perldoc -f length.
Mike Guy
------------------------------
Date: Wed, 20 Aug 1997 22:32:01 GMT
From: Gordon McDorman <gordon.leslie.mcdorman@sap-ag.de>
To: nc-werneral@netcologne.de
Subject: Re: Germany_Colonge needs help... Path conflict !
Message-Id: <uyb5wbi5a.fsf@sap-ag.de>
>>>>> "AW" == Alexander Werner <nc-werneral@netcologne.de> writes:
AW> after installation of perl.5.001 to windows nt 4.0 plattform
AW> the scripts do not work fine ...
AW> with the command :
AW> <FORM METHOD="POST"
AW> ACTION="http://194.8.194.70/perl5/bin/perl.exe?D:\perl5\docs_pl\my_file.pl">
AW> everything works well. But that is not a solution.
[...]
AW> what else can I do ?
The following:
1. Obtain an up-to-date copy of perl.
See http://www.activeware.com or
http://www.perl.com/CPAN/authors/Gurusamy_Sarathy/
2. See the Win32 Perl FAQ:
http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html
3. Consult your server's documentation on how to set up CGI
scripts. If this does not help, ask in a CGI related
news group. (comp.infosystems.www.servers.ms-windows, or
one of the CGI related news groups)
4. Read the latro security announcement:
http://www.perl.com/news/latro-announce.html
Hope this helps.
--
--------------------------------------------------------------
The opinions expressed above are mine, not my employer's.
gordon.leslie.mcdorman@sap-ag.de
------------------------------
Date: 20 Aug 1997 16:36:41 +0300
From: matti@universe.pc.helsinki.fi (Matti Kinnunen)
Subject: Re: help with this search pattern problem!!
Message-Id: <lz90xxc6xi.fsf@universe.pc.helsinki.fi>
If you just need to extract the urls and are using *nix, write
grep href file | cut -d\" -f1,2 | cut -d' ' -f3
If the problem is a part of a larger Perl-program, try something
like
---
#! /usr/local/bin/perl
# to select url's from altavistas output
#
while (<>) {
my $line = $_;
next unless ($line =~ /href/ );
my $ind = index($line,'"')+1;
$line = substr($line,$ind,index($line,'/"')-$ind);
print $line,"\n";
}
---
which does what you asked for.
Hope this helps
--
* matti.kinnunen@helsinki.fi *
* http://universe.pc.helsinki.fi/~matti/contact.html *
* !!! +358-(0)40-593 50 91 but try first +358-(0)9-191 23978 *
------------------------------
Date: Wed, 20 Aug 1997 23:42:55 -0500
From: Patrick O'Lone <polone@sanasys.com>
To: vscarpenter@qgraph.com
Subject: Re: HELP: Search and replace!!
Message-Id: <33FBC74F.272E@sanasys.com>
Vinny Carpenter wrote:
>
> Hi there. I've got a quick question about searching and replacing in
> Perl. Here's what I
> want my script to do. Go thru a file and find every occurance of a
> particular word. If
> it finds that word, I want it to delete that line and replace it with
> another word that I specify.
> Here's what I'm doing right now.
>
> perl -e 's/Internet/Intranet/gi' -p -i.bak file.html
>
> This works fine and replaces every occurance of Internet with Intranet.
> Now I want it to
> replace the whole line with simply the word Intranet.
>
> perl -e 's/Internet * /Intranet/gi' -p -i.bak file.html
The subsitution should be like /.*Internet.*/Intranet/
--
Patrick O'Lone
Sana Systems Webmaster Administrator
polone@sanasys.com
"The edge is everything..."
------------------------------
Date: Thu, 21 Aug 1997 11:50:18 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: How do I find the system date/time?
Message-Id: <33FC0F5A.8DB4472@absyss.fr>
Brad Herder wrote:
>
> Is that really correct? Is Unix going to return 100 in the year
> 2000? Or is it going to return 00?
>
> I'd really like to know.
Then read the docs, don't post to USENET. Try "perldoc -f localtime".
When you do, look for the bit about the year 2023. Just in case you
don't have perldoc on your system, I'll do it for you.
~> perldoc -f localtime
=item localtime EXPR
Converts a time as returned by the time function to a 9-element array
with the time analyzed for the local time zone. Typically used as
follows:
# 0 1 2 3 4 5 6 7 8
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
All array elements are numeric, and come straight out of a struct tm.
In particular this means that $mon has the range 0..11 and $wday has
the range 0..6 with sunday as day 0. Also, $year is the number of
years since 1900, that is, $year is 123 in year 2023.
If EXPR is omitted, uses the current time (C<localtime(time)>).
In a scalar context, returns the ctime(3) value:
$now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
Also see the Time::Local module, and the strftime(3) and mktime(3)
function available via the POSIX module.
------------------------------
Date: Thu, 21 Aug 1997 13:06:01 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: How to Wrap long lines?? (Novice)
Message-Id: <33FC1309.4ED2@icl.fi>
Satyajit Patel wrote:
>
> Hi all,
> I have been working with perl for a bit now. But I have not figured out
> how to
> wrap a very long line when printing it to screen.
> I saw someone had written code to do that but I can't remember where I
> saw it. Can someone please help with this?
Goto http://www.perl.com/CPAN/ and find and use
the Text::Wrap module.
Apparently, you would also benefit from getting
familiar with the use of services such as
http://www.dejanews.com
http://altavista.digital.com
And see also:
http://www.perl.com/FAQ/
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
Date: 21 Aug 1997 05:23:50 GMT
From: "Jerry Hicks" <jerry_hicks@bigfoot.com>
Subject: Howdy Cousin!
Message-Id: <01bcadf2$abfd3400$4acebbcd@jhicks>
Well,
I do freelance Perl work, but am a bit of a prude. Sorry.
Anyway, just saw the family name out there...
Best Regards,
Jerry Hicks
jerry_hicks@bigfoot.com
------------------------------
Date: Thu, 21 Aug 1997 12:04:55 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: I'm looking for a perl logo...
Message-Id: <33FC12C7.C8D3F19@absyss.fr>
Jim Scofield wrote:
>
> Don't laugh. From what I hear, Gateway is going after companies that use
> Cows for marketing.
Does this mean that Ben&Jerry's are in trouble?
- doug
------------------------------
Date: Thu, 21 Aug 1997 02:00:47 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
To: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: Passing 1 programs O/P to anothers I/P via file handles
Message-Id: <33FC03BF.440C@wgn.net>
Mark Worsdall wrote:
>
> Hi, I have a script that sends me an email. It opens the unix mail
> program and then just print stuff to it via the print command with the
> handle MAIL. While this program is open I want to open another (Easy I
> guess) and pass it's Output direct to the Mail program input while that
> is open.
>
> I think I might be on the right trail below but is there such a thing as
> doing a:-
>
> print MAIL TRACE
>
> (where MAIL is the handle for the mail program and TRACE is the handle
> for the traceroute program, so data flow directly from it?)
>
> HELP I am all confused!
>
> # $surfer is an IP address.
> # $traceprog is the location and name of traceroute.
>
> # Open The Mail Program
> open(MAIL,"|$mailprog -t");
>
> print MAIL "To: jaydee\@worsdall.demon.co.uk\n";
> print MAIL "From: A.perl.script\n";
>
> # Check for Message Subject
> print MAIL "Subject: $surfer\n\n";
>
> print MAIL "Today: $date\n";
> print MAIL "$ENV{'HTTP_X_FORWARDED_FOR'}:- $surfer\n";
> print MAIL "Visited from : $ENV{'HTTP_REFERER'}\n";
> print MAIL "using browser: $ENV{'HTTP_USER_AGENT'}.\n\n\n";
>
> if ($surfer eq $ENV{'HTTP_X_FORWARDED_FOR'}) {
> if ($ENV{'REQUEST_URI'} eq '/index.stm') {
> open(TRACE,"|$traceprog "+$surfer);
> close (TRACE);
Just replace those two lines with something like:
@tracelines = `$traceprog $surfer`;
print MAIL @tracelines;
or
if (open (TRACE, "$traceprog $surfer|")) {
while (<TRACE>) {
print MAIL;
}
close TRACE;
}
> }
> }
> close (MAIL);
HTH,
--
,-/- __ _ _ $Bill Luebkert
(_/ / ) // // DBE Collectibles
/ ) /--< o // // http://www.wgn.net/~dbe/
-/-' /___/_<_</_</_ Email: dbe@wgn.net
------------------------------
Date: Thu, 21 Aug 1997 11:34:09 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Passing 1 programs O/P to anothers I/P via file handles
Message-Id: <33FC0B91.49F2335B@absyss.fr>
Mark Worsdall wrote:
>
> Hi, I have a script that sends me an email. It opens the unix mail
> program and then just print stuff to it via the print command with the
> handle MAIL. While this program is open I want to open another (Easy I
> guess) and pass it's Output direct to the Mail program input while that
> is open.
>
> I think I might be on the right trail below but is there such a thing as
> doing a:-
>
> print MAIL TRACE
>
> (where MAIL is the handle for the mail program and TRACE is the handle
> for the traceroute program, so data flow directly from it?)]
What you would want is
print MAIL <TRACE>;
where both MAIL and TRACE are well opened file handles. The <> operator
(read a line from the file handle) is the part that you forgot. What
were you seing? A few bytes of garbage in your MAIL file? This
solution isn't too effecient for large TRACE files (line oriented I/O
isn't the best), so maybe you could try something like
while ( !eof TRACE )
{
read(TRACE, $buffer, 4096);
write(MAIL, $buffer);
}
As this sucks data 4k at a time, it should be more effecient (assuming
that 4k is a multiple of your filesystem blocksize , tune this something
else if not). You can also look at File::Copy, because if I read that
correctly (I've never used it this way), you could try
use File::Copy;
cp(Mail, Trace);
and boom, its done. This would have the advantage of being more
effecient on systems with fixed length records (VMS, etc), so it should
be more portable. Of course, that may not interest you.
- doug
------------------------------
Date: Wed, 20 Aug 1997 23:06:52 -0500
From: Arthur Merar <amerar@unsu.com>
Subject: Perl & Forms
Message-Id: <33FBBEDC.173F@unsu.com>
I am writing a Perl/CGI program, one of my first. I have two questions.
1) Can you, and if so how do you, print data to a specific frame on
your page? Is this possible?
2) This kind of relates to question 1, but when you output data to the
screen, must you always re-draw the entire screen? Can I just, say,
print the data between lines 10 and 20????
--
Thanks,
Arthur
amerar@unsu.com
http://www.unsu.com
------------------------------
Date: 21 Aug 1997 13:11:25 GMT
From: "dRAGoNFLy" <dqr@mailhost.tornado.be>
Subject: PERL 5.001 on WIN NT 4.0 with IIS 3.0
Message-Id: <01bcae1b$9fe00520$834395c2@dominique>
Hello,
I have serious trouble installing perl on my IIS 3.0 webserver. I want to
install perl on the Webserver HD (which is easily done with install.bat I
guess) but after that I create a directory called "cgi-bin" in the wwwroot
directory, I make it executable with the Internet Service Manager and I map
it so that http://azul/cgi-bin is the cgi-bin directory. Works fine, but
then comes the problem, when I put a simple script in the cgi-bin directory
and a html file in the samples directory, and I press my submit button
(it's a simple search engine) I arrive at the search.pl script with the
nice error: HTTP/1.0 501 Not Supported
I think he doesn't recognize the .pl file and he doesn't associate it with
the perl.exe interpreter.
Can somebody please help me out with this because it's rather important.
BTW I ain't a Windows NT specialist or IIS 3.0 freak either (yet :)
Thanks in Advance,
Dominique
------------------------------
Date: Wed, 20 Aug 1997 17:05:47 -0700
From: Alan Hobesh <alan.hobesh@ucop.edu>
Subject: perl compiler: can't locate object error
Message-Id: <33FB865B.5CBA34F3@ucop.edu>
I am compiling a perl program with Malcom Beattie's alpha 3
compiler.
We can successfully use the compiler kit to translate
our perl programs to c-source and then compile to RISC
executables, except for the perl that
uses CTlib.pm. The compile is successfull, but during
execution, I always receive the error:
Can't locate object method "new" via package "Sybase::CTlib"
at a_test.pl line 28.
The same perl source runs correctly.
The sybperl extension has been linked to perl statically.
Per the compiler documentation, we have hacked cc_harness to link
CTlib.a and the sybase libraries to the executable.
Does anyone have any ideas how to proceed? I am using the compiler's
-u option with CTlib.pm, but it does not help. I get the same error
with the C or CC backend as well.
I am on a AIX platform, version 4.1.2.0.
Perl is version 5.002.
sybperl is version 2.07.
Thanks,
Alan Hobesh
------------------------------
Date: Wed, 20 Aug 1997 23:55:47 -0500
From: Patrick O'Lone <polone@sanasys.com>
To: +jeff <gt5146c@acmey.gatech.edu>
Subject: Re: perl question
Message-Id: <33FBCA53.4A94@sanasys.com>
+jeff wrote:
>
> I've got a script that does three things, set a variable $cheese = "foo",
> and open up file handle FILE for reading, and print the contents of this
> file to standard output. The file that has been opened has, somewhere in
> int, a string that looks like this: $cheese. When I output to stdout, why
> won't the $cheese in the file be interpolated into "foo"? The code looks
> like this:
>
> $cheese = "foo";
> open( FILE, "$file" );
> while( <FILE> ) { print "$_"; }
>
> and the contents of $file are as follows:
>
> =======
> this is just $cheese for me
> ======
>
> Any ideas?
>
> +jeff
Well, have you tried to use this statement before with the same program:
$cheese = "foo";
open( FILE, "$file" );
while( <FILE> ) { print '$_'; }
When you run this, it prints the literal $_. When you read in data from
a file, it reads it in as:
'this is just $cheese for me'
So it will print the literal $cheese in the statement, not the variables
contents of $cheese, but the word $cheese. Try running this:
print 'this is just $cheese for me';
And you get the same result.
--
Patrick O'Lone
Sana Systems Webmaster Administrator
polone@sanasys.com
"The edge is everything..."
------------------------------
Date: 21 Aug 97 05:58:27 GMT
From: goldstrn@math.fu-berlin.de (Martin Goldstern)
Subject: range operator bug?
Message-Id: <goldstrn.872143107@leibniz.math.fu-berlin.de>
Keywords: range operator
What is
while(<>) {
$x = /a/.."true";
print $x;
}
supposed to do? In my opinion, it should print a "1" whenever an
input line contains an "a" -- the "true" is a true value, so the range
operator should be turned off as soon as it has been turned on.
(Never mind that this is a really stupid way of looking for something
containing "a", of course a simple 'if (/a/) {...}' would be better)
However, apparently the "true" never becomes true -- after the first
line with "a", my perl (5.004_01) prints 1234.... Perhaps "true" is
evaluated numerically, so becomes 0, and of course the line number is
never 0?
"perl -w " tells me that "argument 'true' is not numeric". I agree.
It is not a numeric literal, hence should be evaluated in a Boolean
context. SHouldn't it?
Martin.Goldstern@tuwien.ac.at
------------------------------
Date: 21 Aug 1997 10:05:36 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Reading a string, splitting it, and using it
Message-Id: <5th3tg$em$1@lyra.csx.cam.ac.uk>
Ed Vander Bush <temp.ed.vanderbush@bentley.com> wrote:
>I am reading information from a database I created into an aray
>A line of data in the Database woulde be in this format
>var1|var2|var3|var4|var5|var6|var7
>With Var 1 being a specific id number
>$id = $Cookies{'itg'};
>open(USERDATABASE, "$database")||die "Database cannot be opened";
>@database = <USERDATABASE>;
>close(USERDATABASE);
>foreach (@database){
>if(/^$id/) {
>($idn,$name,$itemone,$itemtwo,$itemthree,$itemfour,$itemfive) =
>split(/|/,7);
>open(LOG, ">$logfile");
>print LOG $name, $itemthree;
>close(LOG);
>My problem is that the variable are not being returned.... Why?
In addition to the /|/ ti /\|/ change suggested by other respondents, you
should check the if statement. It _may_ be doing what you want, but
i) it will be derailed if your $id value happens to contain any regexp
special characters
ii) it matches a prefix of the id field, rather than the whole field
(so that, for example, a $id of 'top' matches a line starting
'topiary| ... ')
To deal with these points, write it as
if (/^\Q$id|/) {
Mike Guy
------------------------------
Date: Thu, 21 Aug 1997 12:12:13 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: setuid and perl
Message-Id: <33FC147D.4BA4189A@absyss.fr>
Al Byers wrote:
>
> I cannot figure out how setuid scripts are supposed to work. I am
> running OSF/1 3.2 on a DEC Alpha and I have concluded that setuid
> scripts will not execute, but I was under the impression that scripts
> run through a perl interpreter should work. So why doesn't the following
> script show the UID as 0 instead of the real uid?
>
> #!/usr/local/bin/perl
> print `ps -O uid -p $$`;
>
> if the permissions are:
> -rwsr-sr-x 1 root users 147 Aug 13 10:20 test.pl
>
> I could have sworn that at one time it did? Is there something I am
> missing? I tried other things, such as trying to open a root-protected
> file, and nothing works.
Some (many? most?) unix systems have deactivated the suid option for
scripts (#! files) (this doesn't effect binary files like compiled C
code) due to security holes. DEC OSF/1 may be on this list (I dunno).
You can experement with creating simple shell scripts and seeing if they
do what you want. If not, your OS simply doesn't allow this.
But never fear,the perl can get around this too (it is an compiled
executable after all). When you built perl (created the binary), what
did you answer to the "emulate suid" option? You can glance through
your Config.pm to find out. No, I don't remember the name of the field,
sorry. If you want to change this value, you'll need to recompile and
re-install perl on your system.
- doug
------------------------------
Date: Thu, 21 Aug 1997 12:03:24 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Sockets
Message-Id: <33FC126C.37B74A7D@absyss.fr>
scottc@creativeloafing.com wrote:
>
> I'd like to open a socket and retrieve the contents of an HTML document
> form a particular URL using tcp/ip, could anyone point me the right
> direction of how to accomplish this with perl?
> Thanks, -Scott
Read the camel if you have it (if not, buy it :-). That is where you'll
learn about how to handle the error conditions. This is also in the
"perlipc" man page. For the simple stuff, "perldoc IO::Socket" has
simple and easily copied examples.
- doug
------------------------------
Date: Thu, 21 Aug 1997 12:45:11 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Sockets
Message-Id: <33FC0E27.53C5@icl.fi>
scottc@creativeloafing.com wrote:
>
> I'd like to open a socket and retrieve the contents of an HTML document
> form a particular URL using tcp/ip, could anyone point me the right
> direction of how to accomplish this with perl?
> Thanks, -Scott
Use the LWP (libwww) modules from CPAN:
http://www.perl.com/CPAN/
Try it like this:
use LWP::Simple;
$contents = get("http://my.host/particular.url");
See also
http://www.perl.com/FAQ/
and familiarize yourself with services such as
http://www.dejanews.com
http://altavista.digital.com
because they'll help you locate questions asked
before, and their possibly existing answers.
regards,
...petri.backstrom@icl.fi
ICL Data Oy
Finland
------------------------------
Date: 21 Aug 1997 10:52:44 +0200
From: Tom Grydeland <tom@mitra.phys.uit.no>
Subject: Re: split() with capturing parantheses doesn't work correctly!
Message-Id: <nqo7mdfor37.fsf@mitra.phys.uit.no>
Michael Schilli <mschilli@mission.base.com> writes:
> Hi Folks,
>
> the match operand with split() doesn't work as I would expect with
> capturing parantheses when an alternative is given.
[...]
> But the following doesn't work: I want either split on blanks OR some
> other string. In case the string is matched, I wanna preserve it, if
> the blank is matched, I don't.
Sorry, no can do.
Split on a regex with parentheses will produce one element in the
resulting list for each capturing parenthesis in your regex, whether
or not it is filled with anything. Stripping null fields is left as
an exercise for the reader. :-)
>From the mouth of the Camel:
"if you say
split /(-)|(,)/, "1-10,20";
you get the value:
(1, '-', undef, 10, undef, ',', 20)"
To be honest, this paragraph didn't make any sense to me until I'd
read the section on split in MRE. Now it does, though.
> This, however,
>
> @a = split(/(b)|\s+/, "a b c");
>
> produces
(a, undef, '', b, '', undef, c)
as indeed it should.
> Any ideas?
grep defined, split(...); # strip out the undefined elements
@a = grep defined, split(/(b)|\s+/, "a b c");
produces
(a, '', b, '', c)
(You still have the empty fields on both sides of 'b', though. You
didn't say you didn't want that)
> Michael Schilli http://mission.base.com/mschilli
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 21 Aug 1997 10:37:49 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: unexpected foreach value
Message-Id: <5th5pt$1ja$1@lyra.csx.cam.ac.uk>
Andrew D. Arenson <arenson@hen.imgen.bcm.tmc.edu> wrote:
>
>Well, I didn't figure out _exactly_ why this is failing, but I've come
>close. It seems that there is a seek/read pair which is using
>the wrong seek value, and thus reading the wrong value. I would
>love to hear any comments about whether people think this _kind_
>of thing should happen. If you give seek a totally bogus value and
>the try to read from that filehandle, should your other variables be
>at risk like this?
Certainly not. If you can cut your program down to a small fragment
demonstrating the bug, please post it here. OTOH I have a sneaking
suspicion that in the process of cutting down your program you'll find
that the effect is caused by something entirely different.
Mike Guy
------------------------------
Date: Thu, 21 Aug 1997 12:42:36 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Unix text file problem
Message-Id: <33FC1B9C.21BF6114@absyss.fr>
NOTE: comp.lang.perl hasn't existed in a while. Please have your news
admin fix this. I've changed the Newsgroups: line to
comp.lang.perl.misc.
CC'ed to poster
parkerd@cc.umanitoba.ca wrote:
>
> 1 6 11 16
> 2 7 12 17
> 3 8 13 18
> 4 9 14 19
> 5 10 15 20 ..etc
>
> I'm trying to use a language (awk, a script or whatever) to automate
> the processing of this file into the following format:
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 11.. etc
>
> In other words append each column onto each other in ascending order.
This works for me
perl -pe 's/\s+/\n/g' FILE | sort -n
- doug
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 899
*************************************