[6853] in Perl-Users-Digest
Perl-Users Digest, Issue: 478 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 14 21:03:30 1997
Date: Wed, 14 May 97 18:00:26 -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 Wed, 14 May 1997 Volume: 8 Number: 478
Today's topics:
'seek'ing in a file before writing ( Nessim Kisserli )
[Q]Why does this happen? (Marc Aitkin)
Bug report: Perl dumps core on funny split (era eriksson)
Re: CGI Environment vars (Abigail)
Re: exporting new() and a question about local <rra@stanford.edu>
forget the seek..wierd open command found! ( Nessim Kisserli )
Getting Week Number (bjorn.w.nilsson@edt.ericsson.se)
Graphs (GOD4GOLF)
Re: HTML or PS to ASCII conversion? <rra@stanford.edu>
idea for new for loop construct <trenton@ssil.uoregon.edu>
Is there a port for NT <jspeight@mselva.demon.co.uk>
Re: Lists question (Chipmunk)
MacPerl interface (Stephen Frost)
Math::BigFloat::panic (O'Shaughnessy Evans)
Re: Mime types for .cgi, .pl ?? (Philip Nelson)
Module problems. <quemast@bvsd.k12.co.us>
PERL DDE Commands <ericzim@kodak.com>
Perl Neophyte has a Question <rudy@mitec.net>
Re: Regex problem - removing trailing form input (Chipmunk)
REPOST: Perl for NT (.exe) (Greg)
Re: REQ: Perl obfuscator (Chipmunk)
setuid & setgid scripts executed via cgi / internet <markb@medianet.com>
Re: slow script (Chipmunk)
Re: suggestion for the last element position $# (Mike Stok)
Re: Undump (continued) <rra@stanford.edu>
Re: unlink vs. system("rm...") (Chipmunk)
Re: Update: Comparing C, Lisp, Tcl, Perl, Python, Java, <fritz.heinrichmeyer@FernUni-Hagen.de>
Wanted: SmallTalk & Intranet Programmers, Project Mana <Dprice@genevecon.com>
Re: Weather Forecasts via perl <jay@rgrs.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 May 1997 16:45:29 GMT
From: kisserli@cs.uni.edu ( Nessim Kisserli )
Subject: 'seek'ing in a file before writing
Message-Id: <5lcq79$pcl@news.uni.edu>
Hello!
Can anyone tell me why this isn't working?
seek (FILE,0,0) || die "can't seek: $!\n"; #I also tried seek(FILE,1,0)
print FILE "this string should appear at the top of the file..but doesn't!\n";
close(FILE) #it has already been opened!
I use tell(FILE) and it tells me that I'm at the top of the file yet the print
statement never prepends the file, it always appends it.
Help??
Cheers,
Nessim
------------------------------
Date: 14 May 1997 23:27:32 GMT
From: maitkin@cv.hp.com (Marc Aitkin)
Subject: [Q]Why does this happen?
Message-Id: <5ldhp4$6hp@hpcvsnz.cv.hp.com>
Below is some code I put together to group some statistics within
a report. It uses a hash of hash of sorts using the keys as indentifiers
and the last reference (thing3) holds a quantity. Anyway, the abstraction
worked fine, but I was writing this out to a perl format (as you can see
after the quantity assignment), and results were only being propagated
for the first quantity in the innermost interation. The $thing1 and $thing2
seemed to be lost, and subsequent lookups through the innermost loop
returned nulls! So, I quickly put in a workaround, changing the format
to different variables than the actual keys being used, and did a assignment
such as this:
$thing1_OUT = $thing1;
$thing2_OUT = $thing2;
write;
Now this fixed the problem, but it left we wondering why this happened, since
the lost thingy's were dynamically scoped within the process. Anyone?
Please drop me some mail if you can.
foreach $thing1 (keys(%LT))
{
foreach $thing2 (sort (keys %{$LT{$thing2}}))
{
foreach thing3 (sort (keys %{$LT{$thing3}{$thing2}}))
{
$quantity = $LT{$thing1}{$thing2}{$thing3};
write;
}
}
}
Regards,
Marc
------------------------------
Date: Wed, 14 May 1997 10:41:35 +0300 (EET DST)
From: reriksso@cc.helsinki.fi (era eriksson)
Subject: Bug report: Perl dumps core on funny split
Message-Id: <199705140741.KAA29621@vesuri.Helsinki.FI>
(Posted to CLPM [I hope -- our mail2news gateway is funny] and mailed
to Larry Wall.)
Here's a working script:
$ echo foo | perl -ne 'split /\s*,\s*/'
foo
Here's one that dumps core:
$ echo foo | perl -ne 'split /\s*(,\s*)?/'
Segmentation fault (core dumped)
I have verified this bug on two reasonably different Perls; one is an
old Sun 4 running 5.001 unofficial patchlevel 1m, the other one thus:
$ uname -a
OSF1 vesuri V4.0 564 alpha
$ perl -v
This is perl, version 5.003 with EMBED
built under dec_osf at Sep 14 1996 20:48:45
+ suidperl security patch
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
BUGS
Admittedly, it's perhaps not exactly clear what I thought I'd
accomplish with that regular expression.
The manual page doesn't tell you where to send bug reports so I
figured ...
I'm posting to CLPM but not reading it regularly. Newsgroup readers,
please Cc: me with any followups. Thanks.
/* era */
--
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r. <http://www.iki.fi/~era/>
* Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>
------------------------------
Date: Wed, 14 May 1997 05:04:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: CGI Environment vars
Message-Id: <EA5nF0.24v@nonexistent.com>
On Tue, 13 May 1997 22:36:13 -0700, The Nightshadow wrote in
comp.lang.perl.misc URL: news:33794F4D.7B93@thevortex.com.nospam:
++ Can some1 pls give me a pointer to a list of environment variables
++ used in CGI? Thanks.
Follow the road, take a left at the end, and follow the signs
comp.infosystems.www.authoring.cgi.
Djee, how difficult is 'grep -i cgi' on your list of newsgroups?
Even my houseplants can do that.
Abigail
------------------------------
Date: 14 May 1997 14:36:20 -0700
From: Russ Allbery <rra@stanford.edu>
To: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: Re: exporting new() and a question about local
Message-Id: <m3k9l1ivmz.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Justin C Lloyd <lloyd@cs.fsu.edu> writes:
> Should the new() function in a module be exported?
No. When you run it with the syntax:
$object = new Object;
Perl converts that into something roughly equivalent to:
$object = Object::new;
and since the method call is fully qualified, it doesn't need to be
exported. In fact, it *shouldn't* be exported.
> @EXPORT = qw(new, display);
You don't want that comma.
> Also, I have a global hash named %pwfile. However, 'use strict'
> requires it to be package-qualified, so I put
> %ROSTERS::pwfile = ();
> and then I use the variable in two subs in the package, BEGIN and
> another.
No, you don't want to do that. What you want to do instead is:
use vars qw(%pwfile);
in your module and then you can just use the unqualified %pwfile.
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 14 May 1997 17:06:14 GMT
From: kisserli@cs.uni.edu ( Nessim Kisserli )
Subject: forget the seek..wierd open command found!
Message-Id: <5lcre6$pfr@news.uni.edu>
Hello!
Back again. I just got the seek to work. Turns out it will prepend a file if you
open it with: open(FILE,"+<file.txt")
The < isn't documented in the perl manual...it works though ..
------------------------------
Date: 14 May 1997 04:39:01 -0700
From: Bjvrn Nilsson (bjorn.w.nilsson@edt.ericsson.se)
Subject: Getting Week Number
Message-Id: <5lc88l$i8v@drn.zippo.com>
Hi all!
A little thing where I just want to know if there already is a solution.
I want to create a subfunction (or similar) that computes the week number
given a date. I looked at the description of Steffen Beyer's Datecalc, but
it seems to be Unix-specific and it depends upon a C-program. For sure it
has a lot of features, but I only need the week number to run on an NT.
Thanks in advance.
Bjvrn
------------------------------
Date: 14 May 1997 20:13:58 GMT
From: god4golf@aol.com (GOD4GOLF)
Subject: Graphs
Message-Id: <19970515001300.UAA21359@ladder02.news.aol.com>
Hi All :
looking for a Perl Library to do Graphs(Bar charts) .....
does anyone know if there is such a thing ?
thanks
god4golf@aol.com
------------------------------
Date: 14 May 1997 14:33:33 -0700
From: Russ Allbery <rra@stanford.edu>
To: "Jack L. Owens" <jlowens@ptconnect.infi.net>
Subject: Re: HTML or PS to ASCII conversion?
Message-Id: <m3ohadivrm.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Jack L Owens <jlowens@ptconnect.infi.net> writes:
> Often, tables of data are displayed on the web in HTML format for
> display with netscape or some other browser. Netscape allows saving the
> page in HTML format or printing it to a PostScript file. Would someone
> direct me to a utility that will convert either of these formats to a
> flat ASCII file?
lynx -dump for a reasonably modern version of lynx. (Recent versions
support tables.)
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: Wed, 14 May 1997 14:38:22 -0700
From: Trenton Lipscomb <trenton@ssil.uoregon.edu>
Subject: idea for new for loop construct
Message-Id: <Pine.LNX.3.95.970514143652.23054C-100000@ssil.uoregon.edu>
I've been using Perl for over two years now, and have become a big fan
of the language. I admire its intuitive constructs, such as for and
foreach loops, such as:
for(1 .. 5){
print $_;
print "\n";
}
or:
$count = 4;
for $it (1 .. $count){
print $it;
}
However, there is a construct that seems natural to me, but is not
recognized by the interpreter. It is:
for(4 x){
print $_;
print "\n";
}
and, similiarly:
for $it (4 x){
print $it;
}
where $it would be assigned the value of the current iteration of the
loop.
Basically, I'm using the x string repetition operator to say: do this, 4
"times". This seems very intuative and would be a good addition to
future releases of Perl. I don't see any conflicts with another
construction, so the grammar would still be unambiguous with this
addition. Of course, x is currently only a string operator, so that
might result in some problems, but I don't know enough about the
inner-workings of Perl to comment on that. Perhaps someone else has an
idea?
------------------------------
Date: Wed, 14 May 1997 22:21:42 +0100
From: John Speight <jspeight@mselva.demon.co.uk>
Subject: Is there a port for NT
Message-Id: <iqmEuCAmziezEwDP@mselva.demon.co.uk>
Could anyone out there tell me if there is a port of Perl to Windows NT?
If so who sells it is there one from Gnu?
Thanks in advance
--
John Speight
------------------------------
Date: 14 May 1997 20:31:37 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Lists question
Message-Id: <5ld7f9$9ta$4@dartvax.dartmouth.edu>
In article <EA2nEL.9MK@cee.hw.ac.uk>
ceetm@cee.hw.ac.uk (Triantafyllos Marakis) writes:
> sub remove_words {
> local ($string) = @_;
> local return_string = "";
> local @unwanted_words = ("and", "or", "not", "then", "that", "if", "on",
> "in", "the", "it", "is", "when", "from", "all",
> "but", "can", "be", "will");
> if ($string in $unwanted_words) #how can this be implemented?
> {
>
> $return_string = $string;
> }
> return $return_String;
> }
How about this?
# untested
sub remove_words {
local($string) = @_;
local %unwanted_words = # hash of unwanted words
( and => 1, or => 1, not => 1, then => 1, that => 1, if => 1, on
=> 1,
in => 1, the => 1, it => 1, is => 1, when => 1, from => 1, all
=> 1,
but => 1, can => 1, be => 1, will => 1,
);
local @words = split(/(\w+)/, $string); # split into
words/non-words
@words = grep(@words, !$unwanted_words{$_}); # remove unwanted
words
local $return_string = join("", @words); # put back together
return $return_string;
}
Chipmunk
------------------------------
Date: 14 May 1997 22:59:30 GMT
From: frostbyt@shell01.ozemail.com.au (Stephen Frost)
Subject: MacPerl interface
Message-Id: <5ldg4i$16l@proxy5.proxy.ozemail.net>
Hi all,
I had the good fortune (?) to be doing some web design and programming
for someone last Tuesday ... on a PowerMac. I was intrigued by the
interface to MacPerl, but didn't have much opportunity to play with
it. Seems there is a "system window" which traps the output of all
your scripts, and a "system toolbar" at the top of the screen which
seems to "know" about your scripts, giving you the option to compile
and view warnings, run, etc etc.
I'm curious ... would a Mac-o-phile like to post and explain the
benefits of such an interface. Does the Mac not have a "command
line"? Could this sort of interface be grafted onto the Win-32
port of Perl?
Cheers
Steve
------------------------------
Date: 14 May 1997 23:30:51 GMT
From: shaug@callamer.com (O'Shaughnessy Evans)
Subject: Math::BigFloat::panic
Message-Id: <5ldhvb$5oq$1@zinger.callamer.com>
Hmm. Anybody seen this before?
Undefined subroutine &Math::BigFloat::panic called at /usr/local/lib/perl5/Math/BigFloat.pm line 31, <> chunk 1353.
--
O'Shaughnessy Evans
UNIX/Internet Systems Administrator, GST Call America; SLO, CA
mailto: shaug@callamer.com; http://gromit.callamer.com
------------------------------
Date: 14 May 1997 13:58:22 GMT
From: nelsonp@news.dct.com (Philip Nelson)
Subject: Re: Mime types for .cgi, .pl ??
Message-Id: <5lcgdu$4p4$1@gbol.dct.com>
Zonycat (zonycat@flash.net) wrote:
: I am having no luck trying to locall display my cgi scripts. I have
: installed PWS and it works for finding my htm file. When it tries to
: execute the cgi file, a window flashes and it appears to say something
: about not finding something in the Temporary Internet directory. Why on
: earth it is trying to go there I have no idea. I did get the "source "
: of the cgi script to display if I associated the .cgi with a mime type
: of 'text/htm'. I know that is not right.
: Here's is what I got...
: Win95
: PWS installed
: CGI and Perl5 installed
: Registry set as explained in the thread: 'Re: Perl step by step?'
: >
: >click on the folder Script Map | right click in the right frame | New ->
: >string value | enter the extension .pl | right click on the .pl just
: >created | Modify | enter the path to the perl program. (on my machine;
: C:\Perl\bin\Perl.exe %s . Don't forget the " space " %s at the end
: of
[snip]...
You associated .pl with perl scripts but are trying to run a file ending in .cgi? rename it to tryit.pl and see what happens.
--
Philip Nelson
Consultant, Guitarist, etc.
nelsonp@online.dct.com
------------------------------
Date: Wed, 14 May 1997 15:56:52 -0600
From: GuideQueue Master <quemast@bvsd.k12.co.us>
Subject: Module problems.
Message-Id: <Pine.GSO.3.95.970514155614.17891A-100000@bvsd.k12.co.us>
I have two versions of Ping.pm installed. One that only supports
pingecho() and doesn't work on half my machines, and one that is an all
out ping module. Problem is, I can't find anywhere how to access the new
module vs. the old. THe old is:
/usr/local/lib/perl5/Net/Perl.pm
and the new is:
/usr/local/lib/perl5/site-perl/Net/Perl.pm
They both want me to access them with "use Net::Perl", which will always
grab the old one (that doesn't work). How can I tell it to use the new
one?
I wanted to just rename one of them to Pingold.pm, but my admin
thinks there should be a "right" way to do it w/o renaming it. What
should I do?
````'
O O
. . . . . . . . oOOo . . U . . oOOo . . . . . . . . . . . . . . . . .
. .
. Dean J. Brissinger .
. - BVSD GuideQueue/GuideWeb Master (volunteer) .
. .
. "Here's five bucks. Go see the movie, and if you don't like it, .
. I'll take the money back." -- Taxi .
. .
. . . . . . . . . ooo . . . . ooo . . . . . . . . . . . . . . . . . .
------------------------------
Date: Wed, 14 May 1997 16:11:42 -0400
From: "Eric J. Zimmerman" <ericzim@kodak.com>
Subject: PERL DDE Commands
Message-Id: <337A1C7E.388B@kodak.com>
Does anyone have experience issuing DDE commands using PERL on an NT
platform ? (i.e. sending a command from PERL 5 that can be ingested
by a windows/NT application that is currently active)
-much thanks-
Eric Zimmerman
--
(ericzim@kodak.com)
------------------------------
Date: Wed, 14 May 1997 14:59:42 -0500
From: Rudy Richter <rudy@mitec.net>
Subject: Perl Neophyte has a Question
Message-Id: <337A19AD.6778@mitec.net>
I'm using a basic sort sequence to sort by fields of my data, however,
when it returns I find that Perl thinks BLANK fields come before data
filled fields. Right or wrong this doesn't work for me. I need to put
the BLANK fields behind the FILLED fields. I had this...
@sortedkeys = sort by_names keys(%thefile);
sub by_names {
$thefile{$a} cmp $thefile{$b};
}
...this put the BLANKS first. Then I tried this...
@sortedkeys = sort by_names keys(%thefile);
sub by_names {
if ($thefile{$a} eq "") {
1;
} else {
$thefile{$a} cmp $thefile{$b};
}
}
...and although this works better, it still doesn't work correctly.
Anyone know how I can fix it? Thanks!
Rudy Richter
rudy.richter@abii.com
------------------------------
Date: 14 May 1997 20:16:29 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Regex problem - removing trailing form input
Message-Id: <5ld6it$9ta$3@dartvax.dartmouth.edu>
In article <EA4JLC.C9y@ciba-geigy.ch>
david.holmes@bigfoot.com (David M Holmes) writes:
> my $testurl = "http://www.here.com/path/to/file/me.html?a=b&c=d";
> $testurl =~ m/.*?(\?.*)/;
Once you work out the error you mention below, you'll have another one.
This line sets $testurl to 1 if the match is successful, '' if not,
because in a scalar context m// returns true(1) or false('').
> $testurl =~ s/$1//;
Now you're trying to delete the string you saved in the first match.
Instead, you should save with () the part you want to keep:
$testurl =~ s/(.*?)\?.*/$1/;
to replace both of the above two lines.
> print "$testurl\n\n";
>
> The error message I get is:
>
> Uncaught exception from user code:
> /?a=b&c=d/: ?+* follows nothing in regexp at testurl.pl line 13.
When you do s/$1//;, the value of $1 is '?a=b&c=d'. (That's what was
matched in $testurl by your use of m//;) So, what you're doing is
s/?a=b&c=d//; and there's nothing before the ?, so it follows nothing.
You would need to escape the metacharacters in $1 for that substitution
to work.
However, if you use the line of code I suggested above, this problem
will be avoided.
Chipmunk
------------------------------
Date: Wed, 14 May 1997 14:55:21 GMT
From: kokopelli@radix.net (Greg)
Subject: REPOST: Perl for NT (.exe)
Message-Id: <5lcjpa$2b51@farstar.frb.gov>
Is there a way to compile a PERL script to make a .exe for NT?
Gregory Goldstein
mailto:ggg@frb.gov
------------------------------
Date: 14 May 1997 19:57:08 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: REQ: Perl obfuscator
Message-Id: <5ld5ek$9ta$1@dartvax.dartmouth.edu>
arghify.pl looks much improved!
Here are my observations on the new version...
In article <5l8epe$hll@due.unit.no>
Salve J Nilsen <sjn@pvv.ntnu.no> writes:
> # single out the first line - if it begins with #!
> s/^(\#\!.*?[\n\r])/\n/s;
> $head = $1 || "";
Why the [\n\r]? At the very least, you might want to match \n without
a \r.
It won't make a big difference in the output, of course, so it's not a
big deal either way.
> my $msv = "a";
> # (note that the variables will look like "_$msv" in the end :)
The way swap is written right now, I think they'll look like "$msv"
> # ##############################
> # swap() builds a hash (%$hashref) of the $name strings swap()
> # gets each call. If $safe is set, the hash will not be updated,
> # and if $$hasref{$name} does not exist, $name is retuned.
> #
> sub swap {
> my($name, $hashref, $safe) = @_;
> $$hashref{$name} = $msv++ unless ($safe || $$hashref{$name});
> warn "SWAP($hashref) -> $name:$$hashref{$name}\n" if ($DEBUG && !$safe);
> return $$hashref{$name}?$$hashref{$name}:$name;
> }
swap always uses $msv, even though you've defined $mss and $msf in the
code. You should probably pass in the metasyntactic variable as
another parameter.
I notice that some of your calls to swap have $safe=0, and others
$safe=1 - subroutine declarations vs. subroutine calls, for example.
$safe should be the same for identifiers of a given kind - you don't
want to rename subroutines where they're defined and not where they're
called. :-)
> # ##############################
> # Remove text from q|#| to end of line, exept when q|\#|, q|'#'|
> # or q|"#"|.
> # Look out for \\# and similar cases (q|\\\\#| etc).
> # Remove excess (two or more) whitespaces plus newlines/returns.
> #
> warn "Pass 4... Whitespace and comments\n" unless $QUIET;
> s/(
> (?:\\\\)*(?!\\)?([\"\'])[^\1]*(?:\\\\)*[^\\]\1|
> # We don't want to touch strings
> ([\"\'])\2|
> # - not even empty ones!
> (?:\\\\)*\\\#.*?$|
> # and we're aware of escaped hashes
> \$\#.*?$)|
> # and the length-of-array index ($#foo)
> \#.*?$|
> # ... so let's keep this stuff!
> \s{2,}|
> # We want to remove all excess whitespace (but leave one though)
> [\r\n]|
> # and the newlines
> \#.*?$/$1/gmx;
> # and the comments!
Why do you want to remove the newlines?
Why do you match [\r\n] here, when you matched [\n\r] earlier? (see
above)
You match to the end of the line after any of the non-comment instances
of #. This means that, for example, '$#foo=1; # set size of foo to 1'
will not be touched, even though it does contain a comment. I'm not
sure of the best way to solve this problem... Looping over each
occurence of # might work, though...
# remove comments
$pos = 0;
while ( ($pos = index($_, \#, $pos) ) >= 0 ) { # find next
occurence of '#'
if (&is_comment_start($_, $pos)) { # if this '#' marks the start
of a comment
substr($_, $pos, index($_, "\n", $pos)) = "";
# remove everything from here
to end of line
}
}
# is_comment_start
# returns true if # at $pos is the start of a comment
sub is_comment_start {
my($string, $pos) = @_;
return if (substr($string, $pos, 1) ne "#");
$string = substr($string, 0, $pos); # remove '#' and everything
after
# so match can occur at
end of string
return (! ($string =~ /(\\|\$)$/) );
# if it's not escaped or part of a length-of-array index, it's a
comment
}
This code I've given does not check whether the # is in a quoted
string, however. :-(
Also, it hasn't been tested. :-)
I do think that there will always be some cases that arghify.pl won't
be able to handle properly. For example:
$foo = "bar";
$$foo = "baz";
if ($bar eq "baz") {
print "Hello world\n";
}
would be changed to something like:
$a = "bar";
$$a = "baz";
if ($b eq "baz") {
print "Hello world\n";
}
Nevertheless, it's still a cool program and I'm glad to help with its
development!
Chipmunk
------------------------------
Date: Wed, 14 May 1997 14:30:56 -0500
From: Mark Bennett <markb@medianet.com>
Subject: setuid & setgid scripts executed via cgi / internet
Message-Id: <337A12F0.12BD@medianet.com>
I am working on a web browser based cgi program to allow Computer
Operators the option of executing commands as root(cancel print jobs,
kill processes, rm files, etc...) Thus far I have had no luck. Right now
I am trying this:
1) the cgi program is owned by root.
2) the setuid and setgid bits are set on the cgi program.
3) a system call is made to remove a test file in my home dir.
Result: Nada. The file remains.
I think that the http daemon user who actually runs the program is
being blocked. I am not sure. If anyone has any idea how to do this, I
would be very thankfull. I know perl is the language for this, as
opposed to c, but I am getting nowhere doing it over the internet(behind
firewall.)
Thanks a million.
Christopher S. Reickenbacker MEDIANET, Inc.
chrisre@medianet.com Austin, Texas
(512) 343-2002 ext.439 Systems Programmer
------------------------------
Date: 14 May 1997 20:06:30 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: slow script
Message-Id: <5ld606$9ta$2@dartvax.dartmouth.edu>
In article <336FB38C.6DA3@ny.ubs.com>
Glen Culbertson <nnyxcu@ny.ubs.com> writes:
> This approach (borrowed from the random permutations approach to statistical
> testing) will generate 200 tickets in no time flat.
As the number of tickets to generate increases, however, your solution
will slow down - you will be wasting time generating tickets which have
already been generated. If you wanted to generate the maximum number
of unique tickets possible (god forbid), it might take quite a while
for that last remaining ticket to be generated randomly.
Chipmunk
------------------------------
Date: 14 May 1997 23:06:47 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: suggestion for the last element position $#
Message-Id: <5ldgi7$6dr@news-central.tiac.net>
In article <337A3B8A.31DF@mrc-lmb.cam.ac.uk>,
Jong <jong@mrc-lmb.cam.ac.uk> wrote:
>Hi,
>
>I sometimes use a long var name like
>
>
>@correct_group_names_list_long
>
>to get the last element I have to use
>
>$correct_group_names_list_long[$#correct_group_names_list_long]
>
>Rather than this how about using just $#
>
>$correct_group_names_list_long[$#]
Why not use negative subscripts? -1 when used as an array subscript will
get you the last element in recent perls:
DB<1> @listWithLongName = (1 .. 10)
DB<2> print $listWithLongName[-1]
10
In the perldata man page it says:
Variable names
Perl has three data structures: scalars, arrays of
scalars, and associative arrays of scalars, known as
"hashes". Normal arrays are indexed by number, starting
with 0. (Negative subscripts count from the end.) Hash
arrays are indexed by string.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 14 May 1997 14:32:03 -0700
From: Russ Allbery <rra@stanford.edu>
To: Sarah Burcham <sarah@ecl.wustl.edu>
Subject: Re: Undump (continued)
Message-Id: <m3sozpivu4.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Sarah Burcham <sarah@ecl.wustl.edu> writes:
> But the other question is still valid: What is better: Recompiling
> perl with GNU Emacs unexec or using TeX undump? I already know about
> the compiler... I just wanted some advise on these two choices.
TeX undump hasn't been changed in about seven years and doesn't work on
any modern operating system to my knowledge. TeX itself stopped using
undump to build formats eons ago.
GNU emacs unexec has the advantage that it might actually work. :) But
frankly, I rather doubt you'll succeed in getting either of them to work.
Better to just use the compiler if you really *must* have a binary.
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: 14 May 1997 20:37:23 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: unlink vs. system("rm...")
Message-Id: <5ld7q3$9ta$5@dartvax.dartmouth.edu>
In article <EA5AFE.2t0@nonexistent.com>
abigail@fnx.com (Abigail) writes:
> True, but note that 'rm -f' will always succeed; that's what the -f
> is doing. unlink however may fail, when you don't have permission to
> delete it, or when it doesn't exist.
That's why I always use system("rm -f ..."), because, as opposed to
unlink, it doesn't fail when the file doesn't exist. I hate having
lots of nonexistential files lying around that unlink won't remove.
Hehe!
Chipmunk
------------------------------
Date: 14 May 1997 21:04:16 GMT
From: Fritz Heinrichmeyer <fritz.heinrichmeyer@FernUni-Hagen.de>
Subject: Re: Update: Comparing C, Lisp, Tcl, Perl, Python, Java, & Scheme (Guile) Using a Floating Point Numerical Test - Point Inside Polygon
Message-Id: <5ld9cg$kpq@cantaloupe.srv.cs.cmu.edu>
Here are my speed tests for ocaml (olabl variant) on a pentium 200
MHz on the mentioned piece of code.
gcc -O6 : 6.04 sec
ocaml bytecoded, with array bound checking: 79.99 sec
ocaml bytecoded, without array bound checking: 66.20 sec
ocaml native, with array bound checking: 11.33 sec
ocaml native, without array bound checking: 6.38 sec
The results fit with other experiences i made:
1. Native compiled code has roughly the same performance as good optimized
C-Code (with a fibonacci test much faster!!)
2. The bytecode has the best performance around.
The program below is an 1:1 translation, almost no functional
programming introduced (array know their length in good programming
languages :-).
(*The code below is from Wm. Randolph Franklin <wrf@ecse.rpi.edu>
with some minor modifications for speed.
comp.graphics.algorithms FAQ
References:
[Gems IV] pp. 24-46
[O'Rourke] pp. 233-238
[Glassner:RayTracing] *)
let pnpoly xp yp x y =
let npol = Array.length xp - 1 in
let c = ref false in
let j = ref npol in
for i = 0 to npol do
if ((yp.(i) <= y && y<yp.(!j)) || (yp.(!j)<=y && y<yp.(i)))
&& x < (xp.(!j) -. xp.(i)) *. (y-.yp.(i))/.(yp.(!j)-.yp.(i))+.xp.(i)
then
c := not !c;
j := i
done;
!c
in
(* let main () = *)
let count = ref 0 in (* oh, oh, no good functional style *)
let xp = [| 0.0;1.0;1.0;0.0;0.0;1.0;-0.5;-1.0;-1.0;-2.0;
-2.5;-2.0;-1.5;-0.5;1.0;1.0;0.0;-0.5;-1.0;-0.5 |] in
let yp = [| 0.0;0.0;1.0;1.0;2.0;3.0;2.0;3.0;0.0;-0.5;
-1.0;-1.5;-2.0;-2.0;-1.5;-1.0;-0.5;-1.0;-1.0;-0.5 |] in
let incrcount () = count := !count + 1 in
for i = 0 to 99999 do
if pnpoly xp yp 0.5 0.5 then incrcount ();
if pnpoly xp yp 0.5 1.5 then incrcount ();
if pnpoly xp yp (-0.5) 1.5 then incrcount ();
if pnpoly xp yp 0.75 2.25 then incrcount ();
if pnpoly xp yp 0.0 2.01 then incrcount ();
if pnpoly xp yp (-0.5) 2.5 then incrcount ();
if pnpoly xp yp (-1.0) (-0.5) then incrcount ();
if pnpoly xp yp (-1.5) 0.5 then incrcount ();
if pnpoly xp yp (-2.25) (-1.0) then incrcount ();
if pnpoly xp yp 0.5 (-0.25) then incrcount ();
if pnpoly xp yp 0.5 (-1.25) then incrcount ();
if pnpoly xp yp (-0.5) (-2.5) then incrcount ()
done;
Printf.printf "count %d \n" !count
;;
------------------------------
Date: Wed, 14 May 1997 13:57:29 -0700
From: Daniel Price <Dprice@genevecon.com>
Subject: Wanted: SmallTalk & Intranet Programmers, Project Managers
Message-Id: <337A2739.289B@genevecon.com>
GCG Interactive is a creative performance improvement firm specializing
in interactive multimedia and Electronic Performance Support Systems
located in Century City, California. Exciting opportunities are
available with international clients in financial services. We are
seeking talented individuals with experience in the following:
SmallTalk Programmer: VisualAge SmallTalk for OS/2, ENVY, CICS DB2,
IMS a plus, or
Intranet Programmer: CGI, PERL, Javascript. Java a plus.
Project Manager: will have experience with large projects, client
management, and have excellent verbal and written communication skills.
Candidates will also have good communication and organization skills and
a desire to take on an important role in a growing company.
Please FAX resume and cover letter with salary requirements and desired
position to:
ATTN: NewsGroups 5/15
FAX (310) 282 0088 NO CALLS OR EMAIL PLEASE!
------------------------------
Date: 14 May 1997 17:11:09 -0400
From: Jay Rogers <jay@rgrs.com>
To: "G. Bowden Wise" <wiseb@cs.rpi.edu>
Subject: Re: Weather Forecasts via perl
Message-Id: <82zptx3gk2.fsf@shell2.shore.net>
"G. Bowden Wise" <wiseb@cs.rpi.edu> writes:
> has anyone any weather forecast scripts in perl?
This example gets the current weather forecast for Brainerd, Minnesota.
use Net::Telnet ();
my($forecast, $t);
$t = new Net::Telnet (-host => "rainmaker.wunderground.com");
## Wait for first prompt and "hit return".
$t->waitfor('/continue:.*$/');
$t->print("");
## Wait for second prompt and respond with city code.
$t->waitfor('/city code:.*$/');
$t->print("BRD");
## Read and print the first page of forecast.
($forecast) = $t->waitfor('/[ \t]+press return to continue/i');
print $forecast;
exit;
--
Jay Rogers
jay@rgrs.com
------------------------------
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 478
*************************************