[13244] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 654 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 26 14:17:26 1999

Date: Thu, 26 Aug 1999 11:10:17 -0700 (PDT)
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, 26 Aug 1999     Volume: 9 Number: 654

Today's topics:
    Re: puzzle <sto@storm.com>
    Re: Running Apache & Active PERL! <john.wood@diamond.co.uk>
    Re: setuid question <djw@smooth1.demon.co.uk>
        SIGCHLD fun and games. <ed.summerfield@lexis-nexix.com>
    Re: Sorting by third field in a random access database (Larry Rosler)
    Re: The extent of double-quotish interpolation (Randal L. Schwartz)
    Re: The extent of double-quotish interpolation <cassell@mail.cor.epa.gov>
        Visibility of inlined subs <john.wood@diamond.co.uk>
        want to start a cgi-programm when someone visits my sit <pruefer@idnet.de>
    Re: want to start a cgi-programm when someone visits my <phil@proteacher.com>
    Re: where command is coming from <ab@cd.com>
    Re: Why use Python when we've got Perl? (Gary O'Keefe)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 26 Aug 1999 17:41:43 +0000
From: Scott Oglesby <sto@storm.com>
Subject: Re: puzzle
Message-Id: <37C57C57.3A336DC@storm.com>

Mark Grimshaw wrote:
> 
> Dear all,
> 
> Here's an interesting puzzle that someone might like to help me with.
> 
> I have some music on a certain well-known downloadable web music site
> from which visitors can listen to music and order CDs etc. and in which
> the music (3 tracks) participates in a hit-parade.  With over 100,000
> pieces on the site, those songs that appear in the top 40 will obviously
> attract more attention and are likely to sell more CDs.  In the
> time-honoured tradition of musical hype (cf popular music record
> companies buying albums to push them up the charts!), I'd like to hype
> my music and push it up the charts.
> 
> I'm reasonably competent in Perl, have su access to a web server machine
> and have written a script that downloads the songs in question several
> thousands of times with as much randomness as I can think of (which
> songs, which of the several download servers they have, fictitious email
> etc.).  However, this does not seem to have any effect.
> 
> If anyone would like to investigate this with me please email me at:
> m.grimshaw@salford.ac.uk
> 
> P.S.  I'm not into hacking and there's nothing illegal about hype!

That 'time-honoured tradition' of musical hype has blessed us with no
end of Backstreet Boys, Brandy, ska lite, and all manner of three-chord
slacker crap. I would politely request that you concentrate on writing
good music, and let word get around from people who are pleasantly
surprised to find it.

In other words:
 avoid the Music::Cliche and Music::Formula packages;
   (in this case, you *should* reinvent the wheel, for every song)
 don't copy stuff from Will Smith's Script Archive;
 set $num_chords to something higher than 4;
 don't do a $key++ for the final verse to "perk things up"
 s/.*fire.+burning desire//;
 s/.*love.+heaven above//;
 
Cheers

-- 
Scott Oglesby
Notes on Microsoft's Style Guide:
http://www.kurumi.com/opinion/ms-style.html


------------------------------

Date: Thu, 26 Aug 1999 18:44:49 +0100
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Re: Running Apache & Active PERL!
Message-Id: <7q3uho$a9q$1@nclient9-gui.server.ntli.net>

I found it pretty much impossible to get Apache to run correctly under
Win95. My final (imperfect) solution was with MS Personal Web Server.




------------------------------

Date: Thu, 26 Aug 1999 03:08:29 +0100
From: David Williams <djw@smooth1.demon.co.uk>
Subject: Re: setuid question
Message-Id: <hyJGjKAdGKx3EwLp@smooth1.demon.co.uk>

In article <37C2FA9F.A129D618@bloomberg.net>, Art S. Kagel
<kagel@bloomberg.net> writes
>the script to become.  For security reasons you many want to make this 
>a 'C' program that verifies the identity itself of the user running it and 
>then, if the real user is authorized, runs the perl script.  This is more 
>secure and the DBAs will be able to just run the perl script directly 
>since they have permissions already and the ordinary users will have to 
>run the suid program to run the script for them.  While you're at it:  
>Whenever I write one of these permission buster programs I ALWAYS have it 
>log the real user and time of execution in a secure and inaccessible log 
>file so I can bash heads when I need to and for CYA.
>
  True, I had to write one of these once (setuid root!). I statically
  linked it - no loading shared libraries like libc.so at runtime and 
  did 

   if getuid() = <required value> 
     {
     do stuff..
     }

  This should mean
   
  a) Since only getuid() is used there is no need to look at passed 
     files,NIS maps etc. to convert the username to a uid. Only the
     relevant entry in the process table needs to examined i.e. no 
     reliance on external files.

  b) getuid not geteuid so no su-ing before hand.

 I think I saw an article once about writing secure UNIX programs so 
 there more to this then just the above.

   
>Art S. Kagel
>

-- 
David Williams


------------------------------

Date: Thu, 26 Aug 1999 13:11:17 -0400
From: Edward Sumerfield <ed.summerfield@lexis-nexix.com>
Subject: SIGCHLD fun and games.
Message-Id: <37C57535.23443418@lexis-nexix.com>

I have a script that traps the SIGCHLD signal and it works fine. The
problem is that I don't have the process id of the child that ended in
that signal handler.

Should I be able to get it? Is there another solution I can't see?

Here is some pseudo/sample code I am using.

$SIG{CHLD} = \&signal_child;

sub signal_child {
  my $signame = shift;
  print "Child process completed.\n";
  find $pid in array.
  I want to remove the $pid from the array here but I don;t know the
$pid.
}

sub start {
    $pid = fork();
    store $pid in array.
}

sub stop {
    if ($pid still in array) {
        kill 9, $pid;
    }
}

Edward Sumerfield.





------------------------------

Date: Thu, 26 Aug 1999 09:20:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting by third field in a random access database
Message-Id: <MPG.122f091c96fc47a7989eae@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7q3men$495$1@nclient11-gui.server.virgin.net> on Thu, 26 Aug 
1999 14:53:42 +0100, LinksNetwork Admin <andrew@linksnetwork.com> 
says...
> I have a large database in which every record is 415 bytes long.   There are
> two 5-byte fields followed by a 50-byte field, plus others.   I want to sort
> the whole lot in ascending alphabetical order by the third field.

Minimal efficiency, simplest coding:

    @out = sort { substr($a, 10, 50) cmp substr($b, 10, 50) } @in;

Maximal efficiency, slightly more complex coding:

    @out = map substr($_, 50) =>
           sort
           map substr($_, 10, 50) . $_ => @in;

This is the "Super String Sort".  For more details, see 
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>.

If you have so much data that extra copies in memory simultaneously may 
be a burden, look in the paper for 'index sort'.

    my $i = 0;
    @out = @in[ map substr($_, 50) =>
                sort
                map substr($_, 10, 50) . pack('N' => $i++) => @in ];

These various approaches should be benchmarked against your dataset.  
YMMV.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 26 Aug 1999 10:28:13 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: The extent of double-quotish interpolation
Message-Id: <m1k8qi78pe.fsf@halfdome.holdit.com>

>>>>> "Lauren" == Lauren Smith <laurensmith@sprynet.com> writes:

Lauren> I'm somewhat surprised that "$f->()" does not make the call to the sub,
Lauren> but "$a[$f->()]" does.

This is simple, when you remember the very simple rule:

	Perl doesn't interpolate expressions, just variables.

$f->() is an expression.  $a[...] is a variable, and you have to
compute the ... to figure out which one.

I don't know why people are so surprised.  Maybe they never learned
the basic rule. :)

Part of the confusion is that:

	$f->{$w} is a variable (same as $$f{$w}, treat $f as a hashref)
	$f->[$x] is a variable (same as $$f[$x], treat $f as a arrayref)
	$f->foo($y) is an expression (invoke method foo on object $f)
	$f->($z) is an expression (same as &$f($z), treat $f as a coderef)

so the similarities are probably enough to lead people to think that
Perl interpolates all "->".  Nope. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Thu, 26 Aug 1999 10:59:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: The extent of double-quotish interpolation
Message-Id: <37C58087.991067C@mail.cor.epa.gov>

elephant wrote:
[a nice, long, interesting discussion, followed by:]
> you're right there .. the doco seems to be quite sparse on this topic

Well, you just wrote a good explication.  Why don't you submit
it, so it can go into the docs somewhere, in the near future?

Perhaps it's more suitable for one of the FMTEYEWTK series...

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Thu, 26 Aug 1999 18:25:32 +0100
From: "Paul Wood" <john.wood@diamond.co.uk>
Subject: Visibility of inlined subs
Message-Id: <7q3tff$a0c$1@nclient9-gui.server.ntli.net>

Some inlined subroutines are being included from a library file (into the
main package), but they don't appear to be working correctly from outside of
that file. Functions in that same file can use them fine, but anything else
(even if I explicitly add the package name) uses the constant names as
strings. If redefine them in each file, I still get the "Constant subroutne
redefined" warning. Any ideas?

Thanks,

-Paul.




------------------------------

Date: Thu, 26 Aug 1999 18:41:12 +0100
From: "Claus Prüfer" <pruefer@idnet.de>
Subject: want to start a cgi-programm when someone visits my site...
Message-Id: <7q3qmj$585$1@news.gigabell.net>

hi there,
ive got a small perl-problem. if someone visits my homepage, i want to start
a perl-script (cgi), which counts the hits on the page...
where should i place the "LINK?" in the html-code ???

Claus Prüfer





------------------------------

Date: Thu, 26 Aug 1999 10:36:05 -0700
From: "Phil Schaechter" <phil@proteacher.com>
Subject: Re: want to start a cgi-programm when someone visits my site...
Message-Id: <5Xex3.3$UK.267@chrome.eng.netapp.com>

You can use SSI to include it, by placing this in your html code:

<!--#exec cgi="/cgi-bin/your_Script.cgi"-->

You must have SSI (server-side include) turned on for your webserver to
recognize this command

Phil

Claus Prüfer wrote in message <7q3qmj$585$1@news.gigabell.net>...
>hi there,
>ive got a small perl-problem. if someone visits my homepage, i want to
start
>a perl-script (cgi), which counts the hits on the page...
>where should i place the "LINK?" in the html-code ???
>
>Claus Prüfer
>
>
>




------------------------------

Date: Thu, 26 Aug 1999 12:04:55 -0500
From: "Blair Heuer" <ab@cd.com>
Subject: Re: where command is coming from
Message-Id: <7q3s4c$c8g$1@holly.prod.itd.earthlink.net>

It was a perl question, a cgi perl question, i guess you could say. Is this
message board only for perl that is not CGI? I thought it was any perl
considering it is miscelaneous. If I am wrong, please tell me, so I can find
a more appropriate board, and not bother people.

Thanks,
Blair Heuer

BTW I found what I needed on some CD while doing something else. What I
needed was HTTP_REFERER.

Greg Bacon <gbacon@itsc.uah.edu> wrote in message
news:7q1htl$kui$3@info2.uah.edu...
> In article <7q1f78$obj$1@ash.prod.itd.earthlink.net>,
> "Blair Heuer" <ab@cd.com> writes:
>
> : If I could get the url of the file from which the form was sent, then I
> : could check to make sure it was the same, so that people do not edit the
> : files hidden inputs (if they do, it will cause a huge security issue...
> : anyone can freely go throughout my computer and read/delete/etc whatever
> : they want).
>
> Do you have a Perl question at all?  If you have CGI questions, maybe
> you should find a newsgroup that, I don't know, has CGI in its name.
> Maybe I'm just crazy.
>
> Greg
> --
> Don't worry about people stealing your ideas. If your ideas are any good,
> you'll have to ram them down people's throats.
>     -- Howard Aiken





------------------------------

Date: Thu, 26 Aug 1999 16:26:47 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37c563bc.26497369@news.hydro.co.uk>

A keyboard was whacked upside David Oppenheimer's head and out came:

>I don't quite understand the relevance of this entire Perl advocacy string
>here.  If Xah thinks that getting mean responses to postings (especially
>postings from newbies) is so very cool, then why waste time over here doing
>postings to the Python newsgroup.  I must say that in most newsgroups I have
>found people friendly and helpful.  If I were to post to a newsgroup and get
>flamed for not knowing anything or given obviously incorrect information just
>to piss me off, I'd never go back.  It would not generate feelings of
>advocacy for me.  Who the hell wants to have some intellectual elitist
>assholes tell you you're ignorant just for asking a question?!

Python is a language that you hear about after conversing with
knowledgeable people, a language recommended by experts to the keen
computer scientist -- I've always thought of Python, perhaps unfairly,
as being the language for those people interested in language design
as an end in itself. But, one way or another, this makes for edifying
conversation between educated people.

Perl on the other hand is the first language anyone even vaguely
interested in putting together an interactive web-server hears about.
That means EVERY DUMBASS IN THE UNIVERSE who wants to put their cock
on the internet and have you virtually stroke it but, importantly,
can't be bothered to actually learn all this computer bullshit posts
to comp.lang.perl.misc.

If your newsgroup (that you'd just paid to download) was filled with
posts like this:

> Subject: [newbee] I am too damn lazy - can't you do this for me?
>
> hay gurus
>
> Im starting up an intractive cock-stroking website
> (http://www.cockstroke.com/). Its going 2 B KEWL!!!
>
> But I NEED A CGI TO MAKE IT WORK!!!
>
> Can you supr-clever gurus write me something??!! It woudnt take
> you any time and ITD B GRATE!!!
>
> THX
> 
> Newbee

then your patience would vapourise, just like ours.

Gary

The newbee post above and any mentioned websites are purely fictional.
Any similarity to a real newbee, (living or dead) or website are
purely co-incidental.

<NOT SERIOUS>
p.s. I've got a great idea: let's teach those smug python bastards a
lesson by re-directing all the newbees to comp.lang.python. Tell them
it's the latest, greatest, thing for developing their CGI scripts.
Tell them its was designed to be easy to write and maintain and it's
built-from-the-ground-up object model is the toast of the town in the
deevelopment community. Tell them all that perl stuff is old-fashioned
and we're only here on cplm out of a sense of nostalgia and as a
favour to the usenet community, redirecting the ignorant newbees to
the python promised land. Tell them that clp is much friendlier and
they DON'T HAVE FAQS, so the newbees'll never get told to RTFF or
FOAD.

We'll see how fast their bottle fills, then.
<\NOT SERIOUS>
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 654
*************************************


home help back first fref pref prev next nref lref last post