[6514] in Perl-Users-Digest
Perl-Users Digest, Issue: 139 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 15:10:38 1997
Date: Tue, 18 Mar 97 11:59:58 -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, 18 Mar 1997 Volume: 8 Number: 139
Today's topics:
Re: [Q] for loop - making multiple arrays (I R A Aggie)
Re: Access to "my" variables from the debugger (Bob Dougherty)
Re: Beginner - simple problem (HO Travio)
Broken Pipes (tracy allen brown)
Re: Can't open file (Tad McClellan)
CGI libraries won't compile in 5.003_93 <khera@kcilink.com>
differences between FileHandle and *HANDLE{IO} (Tony Apuzzo)
Re: How to read a Fixed Format File? <seay@absyss.fr>
Re: How to read a Fixed Format File? (I R A Aggie)
Need help substituing multiple lines in file (Michael Genrich)
Re: Need help substituing multiple lines in file (Tad McClellan)
Re: Newbie needs help? (crazyblake)
Re: Oracle and Perl5 <sdietri@indiana.edu>
Reccomendation for database usage <abenner@avicom.net>
Re: regex found but forgotten <rootbeer@teleport.com>
Re: regex found but forgotten (Tad McClellan)
regex in context <mstearns@darkwing.uoregon.edu>
Reloading web pages <renman@callamer.com>
Re: Repost: Cookie question (HO Travio)
Re: select statement <tchrist@mox.perl.com>
Server won't run Perl scripts (Fasttrack) <gardh@norway.eu.net>
SORTING ... one more Q <nrakita@xc.xerox.com>
Re: SORTING ... one more Q (Tad McClellan)
the infamous PERL compiler (HO Travio)
Re: the infamous PERL compiler (Tad McClellan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Mar 1997 12:29:22 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: [Q] for loop - making multiple arrays
Message-Id: <fl_aggie-ya02408000R1803971229220001@news.fsu.edu>
In article <8csp1t2tcy.fsf@gadget.cscaper.com>, Randal Schwartz
<merlyn@stonehenge.com> wrote:
+ there. (I think tchrist was voting to move it to
+ CPAN/src/flea-bitten-dead-carcasses/, but that wouldn't have been
+ mirrorable on 8.3 filesystems. :-)
You say that like it's a bad thing.
James - speaking of flea-bitten-dead-carcasses...
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 18 Mar 1997 13:50:28 -0500
From: bobd@cyberenet.net (Bob Dougherty)
Subject: Re: Access to "my" variables from the debugger
Message-Id: <5gmo5k$e70@ux1.cyberenet.net>
In article <332EC67A.F39@fr.bosch.de>,
Mark Andrew <mark.andrew@fr.bosch.de> wrote:
>How do I use the X command to print a "my" variable
>in the perl debugger ?
>
Don't use X, use 'print'
print $foo
--
--
Bob Dougherty bobd@cyberenet.net
------------------------------
Date: 18 Mar 1997 17:52:48 GMT
From: hotravio@aol.com (HO Travio)
Subject: Re: Beginner - simple problem
Message-Id: <19970318175200.MAA28730@ladder01.news.aol.com>
Your question isn't very specific, so I am addressing another angle:
If your cgi resides CGI-BIN directory and you want the directory the user
is coming from, use the enviornment variable
$from_dir=$ENV('HTTP_REFERER');
this is also an easy way to put a back button on you CGI response page....
------------------------------
Date: 18 Mar 1997 12:26:14 -0500
From: brownt@python.cis.ohio-state.edu (tracy allen brown)
Subject: Broken Pipes
Message-Id: <5gmj7mINNeu3@python.cis.ohio-state.edu>
I was hoping someone could explain the possible reasons why the open()
function, when used to fork off a process, could produce a broken pipe error
message.
Tracy Brown brownt@cis.ohio-state.edu
------------------------------
Date: Tue, 18 Mar 1997 12:12:46 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Can't open file
Message-Id: <uulmg5.uc2.ln@localhost>
Eric Bohlman (ebohlman@netcom.com) wrote:
: Stuart Wildish (swildish@pine.shu.ac.uk) wrote:
: : I've got this script that, well, it's going to do lots of stuff, but at
: : the moment I can't even get it to open a file. Here's the relevent code
: : :
: : #!/usr/local/bin/perl
: Where's your "-w"?
: : $database_filename = "/usr/local/httpd/cgi-bin/mploy-database.txt";
: [snip]
: : sub search
: : {
: : open (FILE, $database_location) || print "can't open sodding file";
: It really helps if the main program and the subroutine can agree on the
: name of the variable that holds the filename...
It also really helps if the main program and the subroutine DON'T
NEED to agree on the name (by passing it as an argument).
The original posters code is poorly designed.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 18 Mar 1997 13:16:26 -0500
From: Vivek Khera <khera@kcilink.com>
Subject: CGI libraries won't compile in 5.003_93
Message-Id: <x7n2s1m5fp.fsf@kci.kciLink.com>
I've got Perl 5.003_93 installed on a BSD/OS 3.0 box. I've got it to
the point where pretty much everything works, so I figured I'd start
working on porting over the CGI applications...
So, I've installed CGI-modules-2.75.tar.gz which is as far as I can
tell the latest incarnation of these modules. When I go to run my
programs that were working perfectly happily in Perl 5.003 on BSD/OS
2.1, I get these errors:
% perl -cw foo
Subroutine confess redefined at /usr/libdata/perl5/site_perl/CGI/Carp.pm line 175.
Subroutine croak redefined at /usr/libdata/perl5/site_perl/CGI/Carp.pm line 176.
Subroutine carp redefined at /usr/libdata/perl5/site_perl/CGI/Carp.pm line 177.
[Tue Mar 18 13:13:49 1997] Base.pm: "my" variable $sn masks earlier declaration in same scope at /usr/libdata/perl5/site_perl/CGI/Base.pm line 591.
[Tue Mar 18 13:13:50 1997] Base.pm: "my" variable $qs masks earlier declaration in same scope at /usr/libdata/perl5/site_perl/CGI/Base.pm line 601.
Can't use string ("CGI::Carp::warn") as a subroutine ref while "strict refs" in use.
Callback called exit.
BEGIN failed--compilation aborted at foo line 4.
The first three, ok... just little warnings. The next two, ok.. just
warnings easily fixed. However the last one about CGI::Carp::warn is
a big problem for me... All my scripts have the "use strict" in
effect, and it now seems that this is inherited by other modules used
by my program.
Here's the full text of program foo:
#!/usr/local/bin/perl
use strict;
use CGI::Base;
use CGI::Request;
exit(0);
Any suggestions out there on how to fix up the CGI::Carp module to
turn off strict checking like this? Or maybe make it strict-proof?
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-301-258-8292
PGP/MIME spoken here http://www.kciLink.com/home/khera/
------------------------------
Date: 18 Mar 1997 18:47:50 GMT
From: apuzzo@snake.Colorado.EDU (Tony Apuzzo)
Subject: differences between FileHandle and *HANDLE{IO}
Message-Id: <5gmo0m$ro6@lace.colorado.edu>
I have a function which returns the next line from an input source, where
the input source is either a filehandle or an array. I'd like to be able
to use this with filehandles from both $fh = new FileHandle and STDIN.
However &nextline as defined below will not work with FileHandle. This is
because new FileHandle returns a (scalar) object, not a 'true' filehandle.
I can't check defined(*foo{SCALAR}) since (1) it is always true and (2) I
really need to know if $foo is a filehandle object, not just some generic
scalar.
Is there a way to check *foo and see if it has an instance of FileHandle?
Thanks,
Tony
PS: Any relevant style or usage comments are appreciated
----------------------------------------example--------------------------------------
$_ = &nextline(*STDIN); # works;
$_ = &nextline(*somearray); # works;
$fh = new FileHandle "<filename";
$_ = &nextline(*fh); # fails (*fh{IO} doesn't exist, $fh is a filehandle object)
###
# Get the next line of input from an ARRAY or FILEHANDLE
#
# Returns the next line or undef if no lines available (eof or array empty)
#
# nextline should be called with a typeglob e.g. $_ = nextline(*foo), where
# @foo is an array or <foo> is a filehandle. Note that if foo is both an
# array and a filehandle the array will be processed first, then the file.
# The end of file and the begining of the array are transparent to the
# caller.
#
# A line is defined as a row of an array or a record from a filehandle (a
# line unless $RS is changed)
#
# The input is modified by this function (line shift'd from array, read from handle)
###
sub nextline
{
my ($ref) = @_;
my ($line);
if (defined(*{$ref}{ARRAY})) {
$line = shift @{$ref};
defined($line) && return $line;
}
if (defined(*{$ref}{IO})) {
unless (eof $ref) {
$line = <$ref>;
defined($line) && return $line;
}
}
return undef;
}
--
*
* Be a non-conformist like me and don't use a .sig at all.
*
------------------------------
Date: Wed, 19 Mar 1997 00:00:25 +0000
From: Douglas Seay <seay@absyss.fr>
To: Baruch Promislow <baruch@macom.co.il>
Subject: Re: How to read a Fixed Format File?
Message-Id: <332F2C98.28F9@absyss.fr>
Baruch Promislow wrote:
>
> Hi!
> Is there a way to define a FORMAT for inputing from fixed formatted files,
> similar to the output formats?
>
> I have done all kind of experiments using formats as if for outputting,
> reading a file, but this does not work.
[trimmed comp.lang.perl from the NG list]
Sorry, but to the best of my knowledge, the format stuff
is for output only. The way to handle formatted input
is to use unpack() on each input record.
doug seay
------------------------------
Date: Tue, 18 Mar 1997 12:33:25 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: How to read a Fixed Format File?
Message-Id: <fl_aggie-ya02408000R1803971233250001@news.fsu.edu>
In article <5gj04r$rs4$1@news.NetVision.net.il>, baruch@macom.co.il (Baruch
Promislow) wrote:
+ Is there a way to define a FORMAT for inputing from fixed formatted files,
+ similar to the output formats?
Sure. Try 'unpack' to sort out your in put and 'pack' to understand how to
layout the template for 'unpack'.
James - both found in 'man perlfunc'
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 18 Mar 1997 16:11:05 GMT
From: mikeg@mit.edu (Michael Genrich)
Subject: Need help substituing multiple lines in file
Message-Id: <5gmeqp$n13@senator-bedfellow.MIT.EDU>
I'm having trouble with a simple substitution script that will replace
a certain block of text in a file with another block of text. My script
is as follows:
====
#!/usr/local/bin/perl -w
die "Need filename, you dope" unless @ARGV;
$nuke = $pave = '';
print "What's the string to replace?\n";
while (<STDIN>) {
$nuke .= $_;
}
print "What's the new string?\n";
while (<STDIN>) {
$pave .= $_;
}
`/usr/local/bin/perl -pi -e 's/\Q$nuke\E/\Q$pave\E/gm' $ARGV[0]`;
====
This works fine substituting one line for one line, or even substituting
multiple lines for one line. The problem seems to be pattern matching
over newline characters. I've perused the camel book and some faq's, yet
nothing has done the trick. I've tried using the /s operator for the s///
statement as well.
Any help is most appreciated.
Mike
--
Michael Genrich mikeg@mit.edu
King and Sovereign of Norway mikeg@world.std.com
Supreme Head and First Knowlegian http://web.mit.edu/mikeg/www/
"The fact that I have no remedy for all the sorrows of the world is
no reason for my accepting yours. It simply supports the strong
probability that yours is a fake." -- H.L. Mencken
------------------------------
Date: Tue, 18 Mar 1997 12:41:57 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Need help substituing multiple lines in file
Message-Id: <llnmg5.mg2.ln@localhost>
Michael Genrich (mikeg@mit.edu) wrote:
: I'm having trouble with a simple substitution script that will replace
: a certain block of text in a file with another block of text. My script
: is as follows:
: ====
: #!/usr/local/bin/perl -w
: die "Need filename, you dope" unless @ARGV;
: $nuke = $pave = '';
: print "What's the string to replace?\n";
: while (<STDIN>) {
: $nuke .= $_;
: }
: print "What's the new string?\n";
: while (<STDIN>) {
: $pave .= $_;
: }
: `/usr/local/bin/perl -pi -e 's/\Q$nuke\E/\Q$pave\E/gm' $ARGV[0]`;
: ====
: This works fine substituting one line for one line, or even substituting
^^^^^^^^^^^^
because -p reads one line...
: multiple lines for one line.
^^^^^^^^^^^^
because -p reads one line...
: The problem seems to be pattern matching
: over newline characters.
No, the problem is _getting_ multiple lines into the string that you
are trying to match in.
-p will loop *reading one line at a time*.
You will never match a multiline pattern within a single line string...
: I've perused the camel book and some faq's, yet
: nothing has done the trick. I've tried using the /s operator for the s///
: statement as well.
: Any help is most appreciated.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Mon, 17 Mar 1997 20:55:10 -0800
From: crazyblake@earthlink.net (crazyblake)
Subject: Re: Newbie needs help?
Message-Id: <crazyblake-1703972055100001@max1-lg-ca-04.earthlink.net>
In article <5gfarl$k2t@fridge-nf0.shore.net>, nvp@shore.net (Nathan V.
Patwardhan) wrote:
> These kinds of requests never cease to amaze me -> learning to walk before
> learning to crawl, and/or "just banging something out" has become a tragic
> theme these days.
Well, sorry, but I just needed SOMETHING to cover this task, and I was
told that perl was the easiest way to go about it.
> I'm not trying to flame you, but I'm a bit interested in how you got stuck
> with this program/project if you don't know anything about Perl/programming.
> How do you expect to learn something without doing any background reading?
I've done a bit of background reading, soem tutorials on the web, and IU
understand it fairly well. I'd prefer not to have to go out and buy a
book, but if I absoutly HAVE to, could you make a suggestion as to which
one?
> Then again, your question was very vague, i.e. -
> What version of Perl are you using? What have you read so far? Who told
> you to do this project? What's the program supposed to do? Sockets vary
> between platforms, as (for example) the NTPerl version of Perl doesn't
> have 100% implementation of the sockets you'll see on SUN OS 4.1.3, so asking
> a general question about sockets implementation is rather tough to answer
> unless we know the version/platform you're using.
I'm using perl5, and this project was my own idea (so you can understand
why it may be a little far-fetched). The program is supposed to make a
telnet connection to a specific TCP server, recieve the data that is
automatically sent-out by the server, and listen for connections (where it
would do the same).
I'm using a account on a Linux machine (of which I don't have root
access). All I need is a little info to get me started. Thanks, Blake.
------------------------------
Date: Wed, 19 Mar 1997 07:13:13 +0100
From: simen dietrichson <sdietri@indiana.edu>
To: Wintermute <astone@sprintmail.com>
Subject: Re: Oracle and Perl5
Message-Id: <332F83F9.2B91@norway.eu.net>
Hey,
I've doing a project using perl for NT and connecting to oracle trough
ODBC (roth Win32::ODBC).
It's working fine. Never had any problems.
Gard
Wintermute wrote:
>
> If there is anyone who has successfully integrated Perl 5 w/ODBC.PM and
> Oracle please contact me. I am having extreme difficulties in getting
> it to work.
>
> -- Wintermute
------------------------------
Date: Tue, 18 Mar 1997 11:17:19 -0700
From: Aaron Benner <abenner@avicom.net>
Subject: Reccomendation for database usage
Message-Id: <332EDC2F.374C@avicom.net>
Hello:
I am working on a project in which I need database support. I
would like any recomendations as to which database module I should use
(GDBM, NDBM, OTHER, etc...). In reading some news groups today I
noticed a message that says GDBM has a memory leak. I would like any
recomendations based on personal experience or well known facts etc...
Preferences would even be appreciated. If anyone has any input on the
ability of a database to make multiple connections (READ & WRITE) at the
same time I would be greatful
Please email me at:
termn8er@avicom.net
Thanks
Commadore Peaster
------------------------------
Date: Tue, 18 Mar 1997 09:16:04 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Re: regex found but forgotten
Message-Id: <Pine.GSO.3.96.970318090440.19440I-100000@kelly.teleport.com>
On Tue, 18 Mar 1997, Michael Stearns wrote:
> The substitution DOES get made (I can open the document and see that
> <PgfTag Hidden> has been removed, but the variable $title_placeholder
> does not get set to $1.
> if ($text=~s!\s+<PgfTag\s`Hidden\n+(.*?)\n!\1\n!gs) {
Let's expand that s/// and make it more readable.
s {
\s+ # Whitespace required, match it all
<PgfTag # That literal text
\s # Exactly one whitespace char (why?)
`Hidden # That literal text
\n # Newline required
+ # Gobble up any more newlines
( # Start saving matched text into $1
.*? # Get as few characters as possible
) # End saving to $1
\n # One more newline
} "\1\n"gsx
Well, if you wanted $1 in that last part, why did you use \1 instead? :-)
They mean two different things, although Perl tends to be very forgiving
here for the sake of antique code.
Now, do you see that the stuff to save in $1 is non-greedy? It will try to
match nothing if it can, and it probably can. Maybe you want to change
that star to a plus, which will require at least one character. And maybe
you want to take the 's' off of the end so that that character won't be
just a newline. :-)
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 18 Mar 1997 12:35:44 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: regex found but forgotten
Message-Id: <0anmg5.8g2.ln@localhost>
Michael Stearns (mstearns@darkwing.uoregon.edu) wrote:
: I am working on a Perl script that converts Framemaker MIF -> HTML.
: I have this line, which pulls out a hidden text block in my Frame
: document for the HTML title.
: The substitution DOES get made (I can open the document and see that
: <PgfTag Hidden> has been removed, but the variable $title_placeholder
: does not get set to $1. I have put in the print line for a test, and all
: that is getting printed is a blank line. I believe it should print what
: it found in the parentheses (.*?) in my original regex.
: ###Make the title
: if ($text=~s!\s+<PgfTag\s`Hidden\n+(.*?)\n!\1\n!gs) {
^^
How come you are not using the -w switch to enable compiler warnings?
Or, if you are using it, why are you ignoring the complaint that
it issues about that underlined part?
(.*?) can match zero characters, you know. Maybe it _is_ matching
correctly? We can't tell because you did not give us what $text
is set to...
: $title_placeholder=$1;
: }
: print "$title_placeholder\n";
: Can anyone see what I am doing wrong here?
One thing that you have done wrong is ask why a pattern is not
matching a string, without providing the string that you are
trying to match in...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Tue, 18 Mar 1997 11:46:05 -0800
From: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: regex in context
Message-Id: <332EF0FD.127C64FC@darkwing.uoregon.edu>
I am writing a filter to convert framemaker.mif documents to html.
Everything works, except that I can't figure out a good way to deal with
numbered and bulleted lists. Short of having users put in a marker where
the lists end, I am having a hard time coming up with a good way to know
how to end the <OL> or <UL> sections. Any suggestions are welcome
My current approach, and specific problem, involves narrowing down the
text block to all sections between </H1> and <H1> (since lists don't
traverse these sections of the document. I have found it simple enough
to surround each Bullet paragraph with <UL> .... </UL>
$text =~ s!(</H1>)(.*?)(<H1>)!
my($x,$y,$z)= ($1,$2,$3);
$y =~ s^\s+<PgfTag `Bullet.*?\n+(.*?)\n^\n\n<UL>\n\n$1\n\n</UL>\n\n^gs;
$x.$y.$z
!egs;
And I see how to do a similar thing to just have a <UL> before the first
bulleted item.
$text =~ s!(</H1>.*?<UL>)(.*?)(<H1>)!
my($x,$y,$z)= ($1,$2,$3);
$y =~ s^<UL>^^gs;
...
But I am totally stumped as far as how to only put a </UL> after the
last bulleted item in a section of my document.
I thought I could do something like I have below, where I first test if
there is more than one </UL>, and if so, replace the first one, but I
get a syntax error
...
if $y=~s!(</UL>.*</UL>)! {
$y=~s!</UL>!!gs;
}
$x.$y.$z
!egs;
Can anyone offer any suggestions?
Thanks,
Michael Stearns
------------------------------
Date: Sat, 15 Mar 1997 21:52:34 +0000
From: James Patterson <renman@callamer.com>
Subject: Reloading web pages
Message-Id: <332B1A22.70EA@callamer.com>
Hello, all. One of the cgi scripts I have edits an html page and then
calls that page. I just switched servers and now the page doesn't
reload automatically as it should. I don't know if can be fixed with
perl or not. If you have any answers using perl or server settings,
please write me. I am on Linux now in case that helps. Thanks in
advance.
James Patterson
------------------------------
Date: 18 Mar 1997 18:08:00 GMT
From: hotravio@aol.com (HO Travio)
Subject: Re: Repost: Cookie question
Message-Id: <19970318180701.NAA29425@ladder01.news.aol.com>
I think the problem is that with SSI you have the server running a CGI to
get a response, and include that text in the stream to send to the
browser. I have not seen any other way of using SSI that does anything
contrary. A possible way around this problem would be to direct the user
to your PERL script (maybe HTTP-REFRESH on the actual page. Then have you
PERL script feed them the cookie, and redirect to the actual page that you
want displayed. Like so...
print <<"ENDOFTEXT";
HTTP/1.0 302 Moved Temporarily
Location: http://www.YOURDOMAIN.COM
Set-Cookie: TEST_COOKIE=YES;Expires=Wednesday, 09-Nov-1999 23:12:40
GMT;path=/;\n\n
<html><body>testing</body></html>
ENDOFTEXT
this will feed the cookie and redirect to your page.
hope this helps!
--Travis Kerzic
------------------------------
Date: 18 Mar 1997 14:23:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: select statement
Message-Id: <5gm8hm$sa8$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl, a defunct newsgroup,
"Peter Rozario" <prozario@easyway.net> writes:
:I want to use `select`, to abort the
:read and write operation to the socket, if it takes more than a
:$TIMEOUT value, (say 10 sec).
Wrong approach. You can't use select to do this. You need to
learn about both signal handlers and exception handlers. From
part 8 of the FAQ:
Q: How do I timeout a slow event?
A: Use the alarm() function, probably in conjunction with a
signal handler, as documented the section on "Signals" in the
perlipc manpage and chapter 6 of the Camel. You may instead
use the more flexible Sys::AlarmCall module available from
CPAN.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"If it makes goo on the windshield, we'll call it a bug." --Larry Wall
------------------------------
Date: Wed, 19 Mar 1997 07:13:54 +0100
From: "Gard A. Haugen" <gardh@norway.eu.net>
Subject: Server won't run Perl scripts (Fasttrack)
Message-Id: <332F8422.1ACA@norway.eu.net>
You will need this line in your mime.types file:
type=magnus-internal/shellcgi exts=pl
Then if you still get an error message be aware that the FastTrack
server does distinguish between "small" and "big" letters (! The usual
win-way)
Gard
I am currently using Netscape FastTrack Server 2.0 and Win95. When I
call a cgi
script from a web page, I get the following message:
This server has encountered an internal error which prevents it from
fulfilling
your request. The most likely cause is a
misconfiguration. Please ask the administrator to look for messages in
the
server's error log.
When I check the error log in the server, I find the following:
[15/Mar/1997:23:54:51] failure: for host 127.0.0.1 trying to GET
/cgi-bin/calendar_3.0/calendar.cgi, send-cgi reports: could not send new
process (ERROR_BAD_EXE_FORMAT)
[15/Mar/1997:23:54:51] failure: cgi_send:cgi_start_exec
d:\server\docs\cgi-bin\calendar_3.0\calendar.cgi failed
I have .cgi and .pl associated with Perl.exe under Win95. The first line
of the
script is correct (#!../bin/perl). I've also tried using Perl32.exe.
I've tried
everything I can think of and I always get the same error messages. I'm
sure
it's something simple, but I've been trying to figure this out for days
and I'm
getting nowhere. I would GREATLY appreciate any help anyone could give
me.
------------------------------
Date: Tue, 18 Mar 1997 12:09:09 -0500
From: Nenad Rakita <nrakita@xc.xerox.com>
Subject: SORTING ... one more Q
Message-Id: <332ECC35.102D@xc.xerox.com>
Hello,
I noticed that lot of Q come from the people who need additional info re
sorting. I am one of them, too. I wish to see is there an easy way to
sort the file where each line is made of several elements and I have to
sort the while file by one of these elements. ea:
(file layout with : as delimiter):
123:qwe:A
11:asd:C
45:zxc: B
...
Now, I would like to have in the output file first filed sorted by the
value....
Thanks in advance,
+----------------------------------------------------------+
| Nenad Rakita XEROX Canada |
| UNIX Consultant 5650 Yonge Street |
| (416) 733 6483 phone 9th Floor |
| (416) 733 6097 fax Toronto ON M2M 4G7 |
| E-mail: nrakita@xc.xerox.com CANADA |
+-----+----------------------------------------------------------+-----+
|The future belongs to those who believe in the beauty of their dreams |
| - Eleanor Roosevelt - |
+----------------------------------------------------------------------+
------------------------------
Date: Tue, 18 Mar 1997 12:08:52 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: SORTING ... one more Q
Message-Id: <knlmg5.uc2.ln@localhost>
Nenad Rakita (nrakita@xc.xerox.com) wrote:
: I noticed that lot of Q come from the people who need additional info re
: sorting. I am one of them, too. I wish to see is there an easy way to
: sort the file where each line is made of several elements and I have to
: sort the while file by one of these elements. ea:
: (file layout with : as delimiter):
Sorting files is a good job for the Unix 'sort' command.
Sorting _arrays_ is done easily enough within perl.
I'll assume that you can handle reading the data from a file into
an array. Then you just sort the array.
: 123:qwe:A
: 11:asd:C
: 45:zxc: B
: ....
: Now, I would like to have in the output file first filed sorted by the
: value....
There _is_ and easy way (more than one, of course) to do that.
"sorted by the value"
What's "the value"?
the first, second, or third field?
to do it for the second field:
----------------
#! /usr/bin/perl -w
@ra = qw( 123:qwe:A 11:asd:C 45:zxc:B );
foreach (sort by_2nd @ra) {
print "$_\n";
}
sub by_2nd {
my($a2) = (split(/:/, $a))[1];
my($b2) = (split(/:/, $b))[1];
$a2 cmp $b2;
}
----------------
This is _very_ inefficient. If your lists are large, you would want
to use a different method (such as the Schwartzian Transform).
But for reasonably small lists, I would call the above 'easy'...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 18 Mar 1997 18:20:07 GMT
From: hotravio@aol.com (HO Travio)
Subject: the infamous PERL compiler
Message-Id: <19970318182000.NAA00118@ladder01.news.aol.com>
Howdy:
Perhaps some of you gurus have seen this animal somewhere. Specifically I
am looking for one that will run on IRIX 5.3 on an SGI machine. I thought
I located it once on an MIT server, but alas, I have misplaced my
bookmark.
Also, has anyone used any PERL compiler?
How efficient is it?
Does it give you a noticable speed gain?
any help is always greatly appreciated!
Travis Kerzic
hotravio@aol.com
http://www.hecklers.com
------------------------------
Date: Tue, 18 Mar 1997 12:55:00 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: the infamous PERL compiler
Message-Id: <4eomg5.5j2.ln@localhost>
HO Travio (hotravio@aol.com) wrote:
: Perhaps some of you gurus have seen this animal somewhere. Specifically I
: am looking for one that will run on IRIX 5.3 on an SGI machine. I thought
: I located it once on an MIT server, but alas, I have misplaced my
: bookmark.
Can't help with that.
: Also, has anyone used any PERL compiler?
Not me (yet)
: How efficient is it?
: Does it give you a noticable speed gain?
: any help is always greatly appreciated!
any reading of the free perl documentation is greatly appreciated!
When I do a word search for 'compiler' in the new Perl FAQs, I find:
---------------------------
=head2 How can I compile my Perl program into byte-code or C?
Malcolm Beattie has written a multifunction backend compiler,
available from CPAN, that can do both these things. It is as of
Feb-1997 in late alpha release, which means it's fun to play with if
you're a programmer but not really for people looking for turn-key
solutions.
I<Please> understand that merely compiling into C does not in and of
itself guarantee that your code will run very much faster. That's
because except for lucky cases where a lot of native type inferencing
is possible, the normal Perl run time system is still present and thus
will still take just as long to run and be just as big. Most programs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
save little more than compilation time, leaving execution no more than
10-30% faster. A few rare programs actually benefit significantly
(like several times faster), but this takes some tweaking of your
code.
Malcolm will be in charge of the 5.005 release of Perl itself
to try to unify and merge his compiler and multithreading work into
the main release.
You'll probably be astonished to learn that the current version of the
compiler generates a compiled form of your script whose executable is
just as big as the original perl executable, and then some. That's
because as currently written, all programs are prepared for a full
eval() statement. You can tremendously reduce this cost by building a
shared libperl.so library and linking against that. See the
F<INSTALL> podfile in the perl source distribution for details. If
you link your main perl binary with this, it will make it miniscule.
For example, on one author's system, /usr/bin/perl is only 11k in
size!
---------------------------
So, since I'm sure you are a good net citizen, and have therefore
searched the available documentation before posting, I guess you
need a clearer explanation or something?
If so, what part are you unclear on?
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
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 139
*************************************