[19647] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1842 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 29 11:05:36 2001

Date: Sat, 29 Sep 2001 08:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001775905-v10-i1842@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 29 Sep 2001     Volume: 10 Number: 1842

Today's topics:
        Bijeenkomst Amsterdam Perl Mongers, Dinsdag 2 Oktober 2 (Johan Vromans)
        including local file in .cgi <michael@heiming.de>
    Re: including local file in .cgi (Chas Friedman)
    Re: including local file in .cgi <michael@heiming.de>
    Re: Is there a better way to do this?? (Mark Jason Dominus)
    Re: Making A Windows Program from Perl <RAY_electronic_design@t-online.de>
    Re: Making A Windows Program from Perl <pne-news-20010929@newton.digitalspace.net>
    Re: Making A Windows Program from Perl (Abigail)
    Re: maths <thomas@baetzler.de>
        open EXPR, EXPR and strict 'refs' <joe+usenet@sunstarsys.com>
    Re: Peek and Poke on Perl? Goes here another DriverX vi <RAY_electronic_design@t-online.de>
    Re: Perl "plugins" and eval code (Mark Jason Dominus)
    Re: Perl "plugins" and eval code (Mark Jason Dominus)
    Re: Running system programs from CGI <jbritain@home.com>
    Re: Running system programs from CGI <thomas@baetzler.de>
    Re: Sorting by version number... (F. Xavier Noria)
        Statistics::Descriptive Question <mark.riehl@agilecommunications.com>
        Statistics::Descriptive Question <mark.riehl@agilecommunications.com>
    Re: Strange results... <lt@toetsch.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 29 Sep 2001 11:51:48 +0200
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Bijeenkomst Amsterdam Perl Mongers, Dinsdag 2 Oktober 2001
Message-Id: <m2k7yi8guj.fsf@phoenix.squirrel.nl>


[English version follows the dutch text]

Amsterdam.pm staat voor de "Amsterdamse Perl Mongers", een groep van
gebruikers van Perl. In tegenstelling tot wat de naam suggereert is
Amsterdam.pm niet beperkt tot alleen Amsterdam, maar functioneert, tot
er meer gebruikersgroepen in Nederland zijn, als Nederlandse
gebruikersgroep.

Amsterdam.pm organiseert informele bijeenkomsten waar Perl gebruikers
kunnen samenkomen en informatie en gebruikservaringen met betrekking
tot Perl kunnen uitwisselen. Deze bijeenkomsten vinden normaliter
plaats op elke eerste dinsdag van de maand. De voertaal binnen
Amsterdam.pm is in pricipe Nederlands, maar indien nodig zal Engels
worden gebruikt, b.v. om te communiceren met niet-Nederlandssprekende
aanwezigen.

De eerstvolgende bijeenkomst vindt plaats op dinsdag 2 oktober 2001
van 20:00 tot 22:00 uur op het kantoor van XS4All, Eekholt 42, Diemen.

Voor meer details, waaronder een routebeschrijving, zie
http://www.amsterdam.pm.org/Meetings/next_meeting.html

Liefhebbers van een etentje vooraf kunnen tussen 17:45 en 18:15
verzamelen. Om 18:15 (écht om 18:15!) zoeken we een restaurantje in de
buurt om een hapje te eten.

Bezoek onze Web site http://www.Amsterdam.pm.org voor meer details.

[English version]

Amsterdam.pm stands for the Amsterdam Perl Mongers. We're basically a
Perl user group. Despite its name, it is not local to the Amsterdam
environment, but it welcomes Perl mongers from all over the
Netherlands.

Amsterdam.pm organises informal meetings where Perl users can meet,
and exchange information and experiences with regard to using Perl.
The meetings are normally held every first Tuesday of the month.
Although the preferred language for communication is Dutch, English
will be spoken if necessary.

Our next meeting is Tuesday October 2nd, from 20:00 till 22:00 at the
office of XS4All, Eekholt 42, Diemen.

See http://www.amsterdam.pm.org/Meetings/next_meeting.html for
more detail and the directions to get there.

Should you want to join some of us for dinner, please gather between
17:45 and 18:15. At 18:15 sharp we'll leave for a restaurant somewhere
nearby for dinner.

See http://www.Amsterdam.pm.org for more details.


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

Date: Sat, 29 Sep 2001 13:36:08 +0200
From: Michael Heiming <michael@heiming.de>
Subject: including local file in .cgi
Message-Id: <8nb4p9.m03.ln@charon.heiming.de>

Hello,

I'm setting up a CGI, there is a problem while including a local file 
to be print out as html, some vars come from another file, which gets 
read by the cgi and they are missing/empty now.

It works perfectly, if I put in the text, that is in $htmltext 
directly in the cgi, the problem seems to be, that perl can't 
substitute those vars, with my script...:-(

Here is the part that makes the problem:

open (FILE, "<$confdir/$user.conf");
local $/ = undef; # to get all lines
$htmltext = <FILE>;
close FILE;
 
# print the html
print <<END_HTML;
$htmltext
END_HTML

Thx, for any hints.

Michael Heiming


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

Date: Sat, 29 Sep 2001 13:16:11 GMT
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Re: including local file in .cgi
Message-Id: <3bb5c7ee.116769723@news.itouch.net>

On Sat, 29 Sep 2001 13:36:08 +0200, Michael Heiming
<michael@heiming.de> wrote:

>Hello,
>
>I'm setting up a CGI, there is a problem while including a local file 
>to be print out as html, some vars come from another file, which gets 
>read by the cgi and they are missing/empty now.
>
>It works perfectly, if I put in the text, that is in $htmltext 
>directly in the cgi, the problem seems to be, that perl can't 
>substitute those vars, with my script...:-(
>
>Here is the part that makes the problem:
>
>open (FILE, "<$confdir/$user.conf");
>local $/ = undef; # to get all lines
>$htmltext = <FILE>;
>close FILE;
> 
># print the html
>print <<END_HTML;
>$htmltext
>END_HTML
>
>Thx, for any hints.
>
>Michael Heiming
Maybe the file is not really being read. You didn't check for this. Is
the file readable by the cgi script user (often "nobody")? The path to
the file needs to be specified properly - sometimes relative paths
have to be given in some quirky way depending on server settings.
                                             chas


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

Date: Sat, 29 Sep 2001 16:11:35 +0200
From: Michael Heiming <michael@heiming.de>
Subject: Re: including local file in .cgi
Message-Id: <nqk4p9.hd4.ln@charon.heiming.de>

Chas Friedman (friedman@math.utexas.edu) wrote at Saturday 29 
September 2001 15:16:

> On Sat, 29 Sep 2001 13:36:08 +0200, Michael Heiming
> <michael@heiming.de> wrote:
> 
>>Hello,
>>
>>I'm setting up a CGI, there is a problem while including a local
>>file to be print out as html, some vars come from another file,
>>which gets read by the cgi and they are missing/empty now.
>>
>>It works perfectly, if I put in the text, that is in $htmltext
>>directly in the cgi, the problem seems to be, that perl can't
>>substitute those vars, with my script...:-(
>>
>>Here is the part that makes the problem:
>>
>>open (FILE, "<$confdir/$user.conf");
>>local $/ = undef; # to get all lines
>>$htmltext = <FILE>;
>>close FILE;
>> 
>># print the html
>>print <<END_HTML;
>>$htmltext
>>END_HTML
>>
>>Thx, for any hints.
>>
>>Michael Heiming
> Maybe the file is not really being read. You didn't check for this.
> Is the file readable by the cgi script user (often "nobody")? The
> path to the file needs to be specified properly - sometimes relative
> paths have to be given in some quirky way depending on server
> settings.
>                                              chas

Thx..for your answer, but the file is really read, some parts are 
displayed, some are not. That's the file ($htmltext) that should be 
included:

<HTML>
<HEAD>
<TITLE>Title</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<IMG ALT="graph" 
SRC="http://my.hostname/cgi-bin/perf.cgi?log=last&png=small">
<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0>
<TR BGCOLOR=#AAAAAA>
 <TD>
  <FORM ACTION="/cgi-bin/display.cgi" METHOD="POST">
   <TEXTAREA NAME="text" COLS=100 ROWS=10>\n$text</TEXTAREA>
   <BR>Check<INPUT TYPE="checkbox" $status NAME="ENABLE" VALUE="yes">
   <INPUT TYPE="submit" NAME="Save" VALUE="SAVE">
  </FORM>
 </TD>
</TR>
</TABLE>
</BODY>
</HTML>

The problem is the text box which doesn't display $text, which is 
known by the cgi, it's read from another file. Case the above lines 
are direct in "display.cgi" it works perfectly.

Michael Heiming


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

Date: Sat, 29 Sep 2001 11:50:48 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Is there a better way to do this??
Message-Id: <3bb5b598.267f$322@news.op.net>

In article <3BB5625F.FC827F7A@earthlink.net>,
Benjamin Goldberg  <goldbb2@earthlink.net> wrote:
>Which is good, since testing the truth value of a hash doesn't
> work... 

perldata:

       If you evaluate a hash in scalar context, it returns false
       if the hash is empty.  If there are any key/value pairs,
       it returns true.


>a hash in scalar context will return a string describing the number
>of buckets and the number of items per bucket -- this string is
>invariably a true value.

Except when the hash is empty, in which case the string is "0".
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Sat, 29 Sep 2001 13:28:19 +0100
From: "Raymund Hofmann" <RAY_electronic_design@t-online.de>
Subject: Re: Making A Windows Program from Perl
Message-Id: <9p4b8d$qja$07$1@news.t-online.com>

Yes it should be possible to do a marketable Windows program with Perl.

You'll also need:

- A installation Program with nice images that messes up as much of the System on which it is
installed, which can not be undone expect formatting the systems harddisk.
The installation Program should also take care of the case when installing it on W2000/NT to keep
all eventual user-configuration in 'c:\WINNT\system' so the user is forced to run it as admin.
This also gives your Program more access to the System, not restricting your Program to the
powerless actions possible as normal user.

- A nice Package which should say "... for Dummies" to warn people that actually need their systems
(like me).

- The most expensive Perl2exe you can find on the Market, as you should know that the more expensive
the better it gets.

- Some time to mess with 3rd Party tools that are sold to mentally defective People aimed at
satisfying their desire to be a "Programmer".

Raymund Hofmann

"larry steinbeck" <larrysteinbeck@webtv.net> schrieb im Newsbeitrag
news:1158-3BB4CB05-230@storefull-243.iap.bryant.webtv.net...
> Status quo, Perl is the only programming language that I know. Is it
> possible to write a marketable game or business application for Windows
> 98 in Perl (like the packaged PC programs you see for sale at computer
> stores such as Media Play)?
>
> Is it worth learning C++ in order to write a marketable Windows program?
> Or, is it almost as good to write the application in Perl, and convert
> it to an .exe file?
>
> If so, what is the best way, or best perl module to use to accomplish
> this? perl2exe? xs? inline C?
>
> Best to all!
> Lar
>
>




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

Date: Sat, 29 Sep 2001 14:31:14 +0200
From: Philip Newton <pne-news-20010929@newton.digitalspace.net>
Subject: Re: Making A Windows Program from Perl
Message-Id: <djdbrt071qa5cr40g12u24krd8955cstda@4ax.com>

On Fri, 28 Sep 2001 14:09:57 -0500 (CDT), larrysteinbeck@webtv.net
(larry steinbeck) wrote:

> Status quo, Perl is the only programming language that I know. Is it
> possible to write a marketable game or business application for Windows
> 98 in Perl (like the packaged PC programs you see for sale at computer
> stores such as Media Play)?

I imagine so. Do you know PySol? That appears to be going in that
direction -- an easy-to-install application that doesn't require the
end-user to know anything about Python or Tk.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 29 Sep 2001 14:41:39 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Making A Windows Program from Perl
Message-Id: <slrn9rbnaf.pqs.abigail@alexandra.xs4all.nl>

larry steinbeck (larrysteinbeck@webtv.net) wrote on MMCML September
MCMXCIII in <URL:news:1158-3BB4CB05-230@storefull-243.iap.bryant.webtv.net>:
 .. Status quo, Perl is the only programming language that I know. Is it
 .. possible to write a marketable game or business application for Windows
 .. 98 in Perl (like the packaged PC programs you see for sale at computer
 .. stores such as Media Play)?

Yes.

 .. Is it worth learning C++ in order to write a marketable Windows program?
 .. Or, is it almost as good to write the application in Perl, and convert
 .. it to an .exe file?

I do not understand this question. I doubt you understand what you are asking.

 .. If so, what is the best way, or best perl module to use to accomplish
 .. this? perl2exe? xs? inline C?

To accomplish what? Writing a game/application? You'd best use an
editor for that.



Abigail
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: Sat, 29 Sep 2001 13:29:04 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: maths
Message-Id: <s1cbrt4bqn3sn2d04v00iccvr9t3e8kva5@4ax.com>

On Fri, 28 Sep 2001 18:50:01 -0000, David Wall <darkon@one.net> wrote:
[...]
>I'm aware of the FAQ entry, and I follow and agree with its recommended 
>usage, but usenet discussions involving that usage sometimes seem to have 
>a 'religious' tone to them.  Sometimes people seem hyper-sensitive to the 
>way perl is capitalized.
[...]

He said Jehova! ;-)

SCNR,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: 29 Sep 2001 09:07:30 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: open EXPR, EXPR and strict 'refs'
Message-Id: <m3d74ab0x9.fsf@mumonkan.sunstarsys.com>


  % perldoc -f open
       open FILEHANDLE,MODE,LIST
       open FILEHANDLE,EXPR
       open FILEHANDLE
               Opens the file whose filename is given by EXPR,
               and associates it with FILEHANDLE.  If FILEHANDLE
               is an expression, its value is used as the name of
               the real filehandle wanted.  (This is considered a
               symbolic reference, so "use strict 'refs'" should
               not be in effect.)
  ...

The parenthetical remark looks flat-out wrong to me 
wrt strictures and symrefs:

  % perl -Mstrict -wle 'open "mydata", ">&STDOUT"; print mydata "foo"'
  Unquoted string "mydata" may clash with future reserved word at -e line 1.
  foo
  % perl -Mstrict -wle 'open "x", ">&STDOUT"; print x "foo"'
  Unquoted string "x" may clash with future reserved word at -e line 1.
  foo
  % perl -Mstrict -wle 'open "if", ">&STDOUT"; print if "foo"'
  Name "main::if" used only once: possible typo at -e line 1.
  Use of uninitialized value in print at -e line 1.

Perhaps the parenthetical should read something like:

                               ...  (Although not enforced by
           "use strict 'refs'", this value is considered a 
           symbolic reference- see the perlreftut and perlref 
           manpages for details.)

Joe Schaefer
-- 
"There are two ways of constructing a software design; one way is to make it so
simple that there are obviously no deficiencies, and the other way is to make
it so complicated that there are no obvious deficiencies. The first method is
far more difficult."
                                              -- C. A. R. Hoare



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

Date: Sat, 29 Sep 2001 13:06:13 +0100
From: "Raymund Hofmann" <RAY_electronic_design@t-online.de>
Subject: Re: Peek and Poke on Perl? Goes here another DriverX victim ?
Message-Id: <9p49uv$upr$01$1@news.t-online.com>

Maybe here goes a nother DriverX victim ...
DriverX is mainly sold to Visual Basic Idiots wanting to "Peek/Poke" to the hardware the same way on
a professional OS like NT/2000 as they are used to do on proletarian OS's.
It does give any Program in restricted User-Mode to all the Memory / IO-Space it wants.
But it sucks.
On one Machine of me it was shipped with a Product of Windriver, but Windriver seemed to be to
stupid to handle peeking / poking professionally, so the Windriver tool accessing hardware
consistently fails, and they were not able to fix it.
On another Machine (Notebook) DriverX messes W2000 up so that it can't be put into Standby anymore,
sometimes it can't be switched off the usual way, only by cutting power to it.
Luckily de-intalling DriverX and rebooting fixed it.

Raymund Hofmann

"Gary" <gamtci1@mpinet.net> schrieb im Newsbeitrag news:3BAC87B4.381F@mpinet.net...
> My (currently) limited knowledge of this tells me adding
> embedded C wouldn't solve this problem. Using a direct
> memory instruction should raise an exception/memory violation.
> It seems to me this code needs to be some sort of "driver" or
> registered with the OS in some way to be permitted access to
> a fixed address space (or I/O space for that matter).
>
> I hope I'm wrong and you're right.
>
> remove "1" in reply to email




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

Date: Sat, 29 Sep 2001 12:26:00 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Perl "plugins" and eval code
Message-Id: <3bb5bdd8.273f$16e@news.op.net>


In article <CG6t7.1065$6j6.83640@typhoon2.gnilink.net>,
David Allen <mda@idatar.com> wrote:
>my $code = scalar("use Bot::Plugin::$plugin_name;" .
>                           "my $obj = Bot::Plugin::$plugin_name->new();");
>

The scalar() there is not doing anything; you might want to get rid of it.

>This has lots and lots of problems.  The ones I can think of:
>
>- I've always heard that eval'ing string code like that is wicked slow.

When youe val code, Perl has to parse the string, compile it, and then
execute the result.  This takes longer than methods that skip the
parsing and compilation steps.  So, for example,

        $varname = 'fred';
        eval "\$$varname = 'value';";

is fifty to one hundred times as slow as the equivalent:

        $$varname = 'value';

However, these things have an absolute speed also.  The 'eval' version
is slow, but it still executes in less than 500 microsectods (us) on
my old slow computer.  Unless you're planning to do this hundreds or
thousands of times, you won't notice the difference.

Loading a plugin is a rare operation, so you probably shouldn't care
that it costs an extra 500us to do it with 'eval'.

But there's a more important speed consideration.  What is Perl
actually going to do when you execute this code?  'use' will read the
plugin file, parse the code in the file, and execute it.  This is
exactly an 'eval' process; Perl reads in your plugin file and evals
it; that's what 'use' is for, and it is the only way to load modules
or other code into your program.  There is no getting around this.

Now, why are you worried about the cost of running 'eval' on a
two-line string when you were about to load in the entire
Bot/Plugin/Annoy.pm file and eval it?  That's like worrying about
going two miles out of your way on a cross-country road trip.

>- Users could put arbitrary perl to execute in a configuration file where
>they should just be specifying the name of a module.  

That's sort of the point of the plugin, isn't it?

Unless the program runs with some sort of special permissions that the
user does not normally posses (as, for example, with a setuid-root
program, or a CGI program that runs on a server that the user does not
have an account on) there is no security problem here whatsoever.  If
your program is running with the user's permissions, then they can't
get anywhere by abusing it.  Suppose they manage to trick your bot
into loading and executing a malicious plugin.  Big deal; they don't
need your bot to run the plugin, because they could run it themselves
manually.

Now on the other hand, if the bot is running on your server, and users
who do not have accounts are allowed to upload plugins that the bot will
execute, your whole concept is flawed and you might as well give
out free accounts on your computer and post the passwords to usenet.
But that really has nothing to do with 'eval'; it has to do with the
idea of plugins supplied by untrustworthy users.

>I'm not worried about this for security reasons, since if the user
>can edit the configuration file they already have quite a bit of
>control over the program, but I don't like that this is possible.

You'd better say why you don't like it.  Remeber this same user can
take the source code for your bot, alter it, and then run the bot.
What's the problem with letting them load a plugin file?  This is not
a rhetorical question.  Who is being protected from whom, exactly?

>Another problem that I've been having is that if I reload the plugin (by
>dropping all references to the loaded plugin, and basically creating the
>plugin using this method over again) changes that I've made to the perl
>source of the plugin since it was last loaded don't seem to be in
>effect.

'use' keeps track of the files it has loaded, recording them in %INC,
and doesn't load the same file twice.  To fool 'use', just delete the
plugin from %INC.  See 'perlvar' for more finrotmation about %INC.

>Does anybody know of a better way to do this?  Any help would be appreciated.

Personally, I would do:

                
        do "Bot/Plugin/$plugin_name.pm";
        my $obj = "Bot::Plugin::$plugin_name"->new();

This avoids the 'eval' question entirely.  

'do' instead of 'use' here also avoids the %INC feature; 'do' will
reload the file regardless of how many times it has been loaded before.

The only problem with this is that it will die if the plugin file
contains an error.  You want to catch the error in this case.  Perl's
syntax for catching fatal errors is rather confusingly named 'eval'.
This is not the same 'eval' you were using above, which parses and
compiles  a string; all this one does is catch errors:

    my $obj = eval {
            do "Bot/Plugin/$plugin_name.pm";
            my $obj = "Bot::Plugin::$plugin_name"->new();
          };
    if ($@) {
         # the plugin contained an error, and $obj is undefined
    }
  
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Sat, 29 Sep 2001 12:31:41 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Perl "plugins" and eval code
Message-Id: <3bb5bf2c.275e$127@news.op.net>

In article <9p34pk$ntk$1@bob.news.rcn.net>,
Eric Bohlman <ebohlman@omsdev.com> wrote:
>You could use do instead, but you'd get a whole lot of warnings about
>redefined subroutines and the like unless you did some major symbol
>table hackery to "clean out" everything from the old copy.



There's an easy solution to that:

        { local $^W = 0;   # shut up please
          do $file;
          ...
          # thank you
        }

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Sat, 29 Sep 2001 11:17:59 GMT
From: Jim Britain <jbritain@home.com>
Subject: Re: Running system programs from CGI
Message-Id: <cuabrt0mite6jof8ua8000alm9p1k2vtop@4ax.com>

On Sat, 29 Sep 2001 05:47:13 -0400, "Eric" <stratvio@aol.com> wrote:

>"Thomas Bätzler" <Thomas@Baetzler.de> wrote in message
>news:g6a8rtsr24i1nt1lb7c1gbthkdfpu656od@4ax.com...
>> Check the error log of your web server. Your problem is the fact that
>> daemons such as dhcpd run as root, whereas your web server usually
>> runs as an unprivileged user like www-data, httpd or even nobody - so
>> you just don't have the privileges to restart your dhcpd.

<stratvio@aol.com> wrote:
>One thing I don't quite understand is how setuid works, and I haven't been
>able to find great docs on it.  I did "chmod +s <name>.cgi" to the script in
>question, and that's what allowed it to modify the dhcpd.conf file, owned by
>root.  It can't, however, restart the dhcp server.  After having it print
>out the effective and real ids of the process, it's running as apache, even
>though the script is suid root, and I thought should be running as 0.

The problem is that most modern Unix like OSs will not run scripts as
SUID programs -- they end up being big security hole/targets..  The
OSs will run compiled programs only..

CGIWrap, which has been around since 95, or 96 is the solution -- set
the UID to the user account of the script..

Google search -- or: http://cgiwrap.unixtools.org/


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

Date: Sat, 29 Sep 2001 13:44:17 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: Running system programs from CGI
Message-Id: <tmcbrtgk2vj6vfik8meuikjem5fmfcg3pb@4ax.com>

On Sat, 29 Sep 2001 05:47:13 -0400, "Eric" <stratvio@aol.com> wrote:
>One thing I don't quite understand is how setuid works, and I haven't been
>able to find great docs on it.  I did "chmod +s <name>.cgi" to the script in
>question, and that's what allowed it to modify the dhcpd.conf file, owned by
>root.  It can't, however, restart the dhcp server.  After having it print
>out the effective and real ids of the process, it's running as apache, even
>though the script is suid root, and I thought should be running as 0.

chmod usually doesn't work on script files - that's why I mentioned
using a wrapper. 

>My application is that I have a DSL line coming into a residence and being
>shared w/ 30 users.  All I care about is that users of the DSL are paying
>for it ($5/month access fee) to offset cost of having DSL.  The script in
>question is only available on local network (it is accessed through a
>non-standard domain name-register.localnet, served by my dns server.  If the
>web server is reached through this name, there is a virtual host that goes
>to a directory not accessible through public http), and I'm not too worried
>about people on my localnet hacking.  The reason I went w/ this method is to
>try and make things as transparent as possible to users, while making sure
>that they register their computer and pay for the connection.

Hm, if you care about them paying for traffic that goes through your
gateway machine, then why not account for that traffic? There's a
really neat package called net-acct out there that'll produce logs
which can be used to account for traffic. 

HTH,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: 29 Sep 2001 11:15:04 GMT
From: fxn@retemail.es (F. Xavier Noria)
Subject: Re: Sorting by version number...
Message-Id: <9p4afo$4pamb3@news1s.iddeo2.es>

On Sat, 29 Sep 2001 05:26:26 GMT, Jason Boerner <jasonb@computer.org> wrote:

: Does anyone have a sort routine for the following?
: My version sucks!  ;_)
: 
: myprog-1.2.1
: myprog-1.2.10
: myprog-1.2.0
: myprog-1.2.2
: 
: So that the ascending order is:
: 
: myprog-1.2.0
: myprog-1.2.1
: myprog-1.2.2
: myprog-1.2.10

If we have the strings in @versions I think this does the job:

map { $_->[0] }
    sort { $a->[1] <=> $b->[1] or
           $a->[2] <=> $b->[2] or
           $a->[3] <=> $b->[3] }
         map { [ $_, /^myprog-(\d+)\.(\d+)\.(\d+)$/ ] } 
             @versions;

-- fxn


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

Date: Sat, 29 Sep 2001 14:23:28 GMT
From: "Mark Riehl" <mark.riehl@agilecommunications.com>
Subject: Statistics::Descriptive Question
Message-Id: <APkt7.1000$M03.92526@typhoon1.gnilink.net>

All - Does anyone know how to clear a statistics object?  Look at this
snippet of code:

#!perl -w

use strict;
use diagnostics;
use Statistics::Descriptive;

my ($i, $j);

$i = $j = 0;

my ($stat, $mean);

$stat = Statistics::Descriptive::Full->new();
$stat->add_data(1,2,3);
$mean = $stat->mean();

print "\$mean = $mean\n";


The stat object contains 1,2,3.  Is there a way to clear the stat object, or
do I need to create a new one?  For example, now I'd like to calculate the
mean of 4,5,6.  Can I do it with the same object?  If so, how?

I looked in the docs, but didn't see it, maybe I missed it.

Thanks for the help,
Mark




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

Date: Sat, 29 Sep 2001 14:50:12 GMT
From: "Mark Riehl" <mark.riehl@agilecommunications.com>
Subject: Statistics::Descriptive Question
Message-Id: <Eclt7.1012$M03.93893@typhoon1.gnilink.net>

All - I'm using the Statistics::Descriptive module under Win2k.  I'd like to
do the following:

1. Create a Stat::Desc object.
2. Add values using add_data(), perform calculations.
3. Clear the values.
4. Add values using add_data(), perform calculations.
,,,

Question - Is there a way to clear the current values in the object w/o
instantiating a new object?  Here's a little sample of how it works:

#!perl -w
use strict;
use diagnostics;
use Statistics::Descriptive;
my ($i, $j);
$i = $j = 0;
my ($stat, $mean);
$stat = Statistics::Descriptive::Full->new();
$stat->add_data(1,2,3);
$mean = $stat->mean();
print "\$mean = $mean\n";
my $cnt = $stat->count();
print "\$cnt = $cnt\n";

# So here, I'd like to clear the object and restart with a new set of data.

Any suggestions?

Thanks,
Mark




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

Date: Sat, 29 Sep 2001 12:10:54 +0200
From: Leopold Toetsch <lt@toetsch.at>
Subject: Re: Strange results...
Message-Id: <slrn9rb7he.14n.lt@toetsch.at>

Stefan Weiss <weiss@kung.foo.at> wrote:


> While I was playing around with your sig, I accidentally cut&pasted
> pasted a piece of code to the wrong place, 

The sig is of course not belonging to the program. (It gets appended
automatically and chosen from a random pool of sayings from Adventure) 

> cheers,
> stefan

servus,
leo
-- 
Leopold Toetsch <lt@toetsch.at> http://www.toetsch.at/linux/
-
The dome is unclimbable.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 1842
***************************************


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