[10258] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3851 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 29 15:09:16 1998

Date: Tue, 29 Sep 98 12:00:35 -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           Tue, 29 Sep 1998     Volume: 8 Number: 3851

Today's topics:
    Re: $ and abs (Abigail)
    Re: Alternate colors in tables with perl command? (Abigail)
    Re: CGI to CGI <racronkite@nospam_hrl.com>
    Re: CGI.pm - forms within tables - How to? (brian d foy)
    Re: CGI.pm - forms within tables - How to? (Steven D Jones)
        compress::zlib, win32 (Andreas Grueninger)
    Re: Cookies w Perl on IIS 3.0 (David Jacoby)
    Re: Cookies w Perl on IIS 3.0 <pinne@pegit.se>
    Re: delayed $aa += $n desired (Mark-Jason Dominus)
        Handling children with SIG{CHLD} and waitpid (Tramm Hudson)
    Re: help needed huntersean@hotmail.com
    Re: Help with system() on NT (Mark Leighton Fisher)
        How do I sort a multidimensional array???? <smaring@gte-es.com>
    Re: How do I sort a multidimensional array???? <baliga@synopsys.com>
    Re: Many processes communication - How To? <sergio@mail.pt>
        mod_perl /home/.htaccess wierdness. schwern@starmedia.net
        Need help with interpolation of a scalar !! ? (Steve maZe)
        Need method to round real number to two decimal places (Roy Kenneth Scaife)
    Re: Need method to round real number to two decimal pla (Larry Rosler)
    Re: Need method to round real number to two decimal pla <racronkite@nospam_hrl.com>
    Re: Poll: How Did You Learn Perl? <uri@camel.fastserv.com>
    Re: Poll: How Did You Learn Perl? <phinneas@eskimo.com>
        restricting script execution? <work@nospam.idea.co.uk>
    Re: restricting script execution? <eashton@bbnplanet.com>
        SRC: encrypt your Perl scripts! :-) <gbacon@cs.uah.edu>
    Re: SRC: encrypt your Perl scripts! :-) <eashton@bbnplanet.com>
        UserGetMisc.al  library <davidc@meta4.es>
        Will this FORM process the information slow?? (Newbie)
        Win32 Perl for x86 standard or Active State <avi318k1@pn.nettuno.it>
    Re: Win32::OLE (Jan Dubois)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 29 Sep 1998 16:31:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: $ and abs
Message-Id: <6ur21f$ol1$2@client3.news.psi.net>

Tianxiong (tianxiong@aol.com) wrote on MDCCCLV September MCMXCIII in
<URL:news:19980929005321.05885.00003474@ng-fd1.aol.com>:
++ 
++ I've tried to seek an answer, but failed ...
++ 
++ 1) How to handle the '$' in a string?  For example, after reading a line from a
++ file like "abc 234 $-20.00 $30.02 kkk xxx", I want to extract "$-20.00" and
++ "$30.02" first, then get "-20.00" and "30.02".  What should I do?  I tried to
++ use 'split' with "$" as the delimiter, but didn't know how to handle '$'.  How
++ can I trim "$-20.00" into "-20.00"?

Assuming $str contains something like '$-20.00':
        $str =~ s/^\$//;

++ 2) How to use function "abs"?  I tried "abs (-20);" but it didn't work for me. 
++ Do I miss something?


Yes. You forgot to qualify "didn't work". What's going on? Is it sitting
on the couch all day, watching soap opera's? Is it on strike? Did it
die? Does it have some vacation days?




Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: 29 Sep 1998 16:32:20 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <6ur22k$ol1$3@client3.news.psi.net>

Daniel Pray (daniel@intecomp.com) wrote on MDCCCLV September MCMXCIII in
<URL:news:daniel-2809982259380001@usr10-dialup43.mix1.sacramento.cw.net>:
++ I've seen some professional web site that have a perl script list a
++ database request.  The table is alternated rows of color. Does anyone know
++ how to do this?

I would use crayons.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: Tue, 29 Sep 1998 09:52:58 -0700
From: "Robert Cronkite" <racronkite@nospam_hrl.com>
Subject: Re: CGI to CGI
Message-Id: <6ur3a5$coq@hacgate2.hac.com>

Try hidden fields in your form

Robert




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

Date: Tue, 29 Sep 1998 11:27:13 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <comdog-ya02408000R2909981127130001@news.panix.com>
Keywords: from just another new york perl hacker

In article <OC6Q1.1042$7Q6.6921163@news2.voicenet.com>, hex@voicenet.com (Matt Knecht) posted:

>Steven D Jones <Steve_D_Jones@hp.com> wrote:
>>I would like to create a form which is formated by placing the input fields 
>>inside of a table.  Here's an html example:
>
>[ snip HTML ]
>
>>How would I do this using CGI.pm?
>
>You don't.  CGI.pm doesn't know anything about tables.

well, it does have methods to create tables just like the other
HTML thingys...

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>


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

Date: Tue, 29 Sep 1998 18:06:11 GMT
From: Steve_D_Jones@hp.com (Steven D Jones)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <6ur7io$6rk@fcnews.fc.hp.com>

In article <3610FF71.283C9D9@inlink.com>, Brent Michalski <perlguy@inlink.com> wrote:
>You could put the FORM tags outside of the TABLE tags.  It really
>doesn't matter.  Then just do a:
>
>$q->start_form;
>...Table stuff here...
>$->end_form;
>
>HTH

What I'm looking for is specific syntax examples.  I've used CGI.pm to create 
both tables and forms, but not both together.  I can't figure out the syntax 
to put the different radio buttons from a common radio group into different 
cells of a table.

Thanks.

Steve_D_Jones@hp.com


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

Date: Tue, 29 Sep 1998 15:51:16 GMT
From: grueni@stuttgart.netsurf.de (Andreas Grueninger)
Subject: compress::zlib, win32
Message-Id: <361101f1.2233972@news.lf.net>

I have problems to install the perl module Compress-Zlib-1.01
Configuration:
NT 4.0SP3, Perl 5.00502, Visual C++ 5.0.
1.
 I downloaded ZLib 1.13 + the patches for the Visual C++ 5.0 compiler
from the zlib home page and created the zlib.dll and the zlibstat.lib.
2.
I copied zlib.h, zlib.dll, zlib.lib, zconf.h in the directory g:\zlib.
3.
I uncompressed Compress-Zlib-1.01 and changed in makefile.pl the paths
for the zlib library to g:\zlib\zlib.lib and for the include files to
g:\zlib. The makefile is then created without comments.
4.
The zlib.dll can't be built and I get the following errors.
Obviously the library with the zlib functions is not found or not in
the right format. I checked the makefile and g:\zlib\zlib.lib is the
first library of the LDLOABLIBS.

Any help is very appreciated.

Errors:
   Creating library blib\arch\auto\Compress\Zlib\Zlib.lib and object
blib\arch\a
uto\Compress\Zlib\Zlib.exp
Zlib.obj : error LNK2001: unresolved external symbol _zlibVersion
Zlib.obj : error LNK2001: unresolved external symbol _gzopen
Zlib.obj : error LNK2001: unresolved external symbol _gzdopen
Zlib.obj : error LNK2001: unresolved external symbol _gzread
Zlib.obj : error LNK2001: unresolved external symbol _gzerror
Zlib.obj : error LNK2001: unresolved external symbol _gzwrite
Zlib.obj : error LNK2001: unresolved external symbol _gzflush
Zlib.obj : error LNK2001: unresolved external symbol _gzclose
Zlib.obj : error LNK2001: unresolved external symbol _adler32
Zlib.obj : error LNK2001: unresolved external symbol _crc32
Zlib.obj : error LNK2001: unresolved external symbol
_deflateSetDictionary
Zlib.obj : error LNK2001: unresolved external symbol _deflateInit2_
Zlib.obj : error LNK2001: unresolved external symbol _inflateInit2_
Zlib.obj : error LNK2001: unresolved external symbol _deflate
Zlib.obj : error LNK2001: unresolved external symbol _deflateEnd
Zlib.obj : error LNK2001: unresolved external symbol
_inflateSetDictionary
Zlib.obj : error LNK2001: unresolved external symbol _inflate
Zlib.obj : error LNK2001: unresolved external symbol _inflateEnd
blib\arch\auto\Compress\Zlib\Zlib.dll : fatal error LNK1120: 18
unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x19'




---------------------------
Andreas Grueninger

PRIVATE: grueni@stuttgart.netsurf.de
 OFFICE: grueninger@lfl.bwl.de
---------------------------


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

Date: 29 Sep 1998 16:58:50 GMT
From: jacoby@harbor.ecn.purdue.edu (David Jacoby)
Subject: Re: Cookies w Perl on IIS 3.0
Message-Id: <6ur3ka$edd@mozo.cc.purdue.edu>

In article <3610C237.552E@pegit.se>, Pinne  <pinne@pegit.se> wrote:
>Hi, does
>anyone know what the deal with cookies under IIS 3.0 is
>Why can't i access or set them them using the 
>$ENV{'HTTP_COOKIE'} variable ?

I don't use IIS, I use Apache, but I don't see the specific server 
having that much to do with it.

You should be able to find what cookies are set with the environment
variable, but you shouldn't be able to set them with it. That would be
like asking someone to think of a number, having that person write it
down, scribbling out their number and writing a new one and expecting
the person to now be thinking of the new number.

But the problem is more germane to a web froup, not this one.

>Please, I need help urgently 
>If, please reply to my email as well 

Now that's just rude.

>/regards
>Bjvrn-Eke Segrell / Pegit AB


-- 
Dave Jacoby		   I wish I could give brother Bill his big thrill
jacoby at ecn.purdue.edu   I would set him in chains at the top of the hill
http://purdue.org/~jacoby/ Then send out for some pillars and Cecil B. Demille
Father. Guitarist. Geek.   He could die happily ever after - Bob Dylan


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

Date: Tue, 29 Sep 1998 20:04:50 +0200
From: Pinne <pinne@pegit.se>
Subject: Re: Cookies w Perl on IIS 3.0
Message-Id: <36112142.2355@pegit.se>

Ooops, forgot mentioning i'm using Perl 5.003 on IIS.
And that i try to set them in the response-header of the document as
usual, not with the ENV-variable
(fore-head-slap)

However, I can't seem to be able to either set or read them.
I have it working on a a Appache-server w.o probs.

> >Please, I need help urgently
> >If, please reply to my email as well
> 
> Now that's just rude.
> 

Hmmmm, why would that be rude ????

Was just in a hurry

/cheers
Bjvrn-Eke Segrell / Pegit AB


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

Date: 29 Sep 1998 13:38:50 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: delayed $aa += $n desired
Message-Id: <6ur5va$cdq$1@monet.op.net>

In article <rg90j3xcef.fsf@calf.saltfarm.bt.co.uk>,
Tony Bass  <aeb@saltfarm.bt.co.uk> wrote:
>mjd@op.net (Mark-Jason Dominus) writes:
>
>> In article <6uqci0$crk$1@nntp2.ba.best.com>, Xah <xah@best.com> wrote:
>> >Is there a way to get something like $aa =+ 2, so that the value of the
>> >variable is returned before it is incremented?
>
>> 	(($aa,$aa+=2)[0])
>
>yielding the post-value,

Yes, my mistake.  As you point out, Perl doesn't dereference the
variable until after the addition occurs.  This is bizarre, but I
would have tried it before I opened my yap.  I foolishly thought that
the left-to-right order guaranteed by `,' would actually guaranteed
left-ro-right order of evaluation, like it does in C.

	(($dummy = $aa, $aa+=2)[0])

and such variations do work.


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

Date: 29 Sep 1998 12:22:21 -0600
From: tbhudso@panther.cs.sandia.gov (Tramm Hudson)
Subject: Handling children with SIG{CHLD} and waitpid
Message-Id: <6ur8gt$dvb$1@panther.cs.sandia.gov>

Folks,

I have written a small toolkit to map a function onto a dataset
in parallel via fork() since Perl 5.004_04 doesn't have the
thread support that would make this easier.  Additionally, the
map function accepts and extra parameter that limits the number
of jobs running simultaneously to prevent it from easily swamping
the system on a large dataset.

According to the perlipc podpage, my code can loop like this:

           use POSIX ":sys_wait_h";
           sub REAPER {
               my $child;
               while ($child = waitpid(-1,WNOHANG)) {
                   $Kid_Status{$child} = $?;
               }
               $SIG{CHLD} = \&REAPER;  # still loathe sysV
           }
           $SIG{CHLD} = \&REAPER;
           # do something that forks...

There is a problem with the return from waitpid -- it returns 0 if
no child has exited, -1 if there are no children to exit or the pid
of a child that has exited.  So, to fix that up a tad...

My code that works is very similar.  This is on Linux/AXP, so I don't
have to use the horrid SysV signal semantics:

 $SIG{CHLD} = sub {
        while( (my $pid = waitpid(-1,&WNOHANG) > 0 ) {
          push @done_pids, $pid;
          $children--;
        }
  };

Elsewhere in the code I do a loop on $children:

  while( $children > 0 ){
      print "$$: $children children: all=@child_pids (@done_pids)\n";
      sleep;
  }

So if I fork eight sub processes and seven of them return very close
together, one SIGCHLD will be generated.  The wait loop in $SIG{CHLD}
handles the seven of them in the while.  Occasionally, after it has
terminated, but before the handler has returned and the process is
ready to receive more SIGCHLD's, the last process will die.

So my main loop has just gone to sleep, expecting to be awaked when
the signal arrives.  The signal handler has exited, also expecting
to be invoked when the child dies.  Except it has already happened
and my code sits there in deadlock...

I have an ugly work around that involves checking the status of waitpid
just before going to sleep in the main loop.  It seems that the
semantics of signals are very poorly laid out if the obvious, clean
design fails.  Yes, I know the POSIX group had to work to fit the
specs to have the same operational characteristics of the Unixes of
the day, but is it necessary to propigate them into Perl?

Is there a clean, deadlock free way to do this somewhat common task?

Anyway, there are other problems with my code that I need to track
down (like DBM corruption from the parallel jobs somehow).  If I can
isolate that problem I'll be a happy camper.

I've thrown in the Parallel map and mapn code.  Feel free to comment on
it.  mapn() maps a function onto an arbitrary number of lists, just
like the long running discussion from a little while ago.

#!/usr/bin/perl -w

package Parallel;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(pmap mapn apply);

use Carp;
use POSIX ":sys_wait_h";

sub apply
{
  my ($func,$args) = @_;
  foreach (@$args) {
        if( my $rc = $func->($_) ) { return $rc }
  }

  return undef;
}

sub mapn
{
  my ($func,@arrays) = @_;
  my @rc;
  my $i = 0;

  while( apply( sub { $i <= $#$_ }, \@arrays ) ) {
    push @rc, $func->( map {$_->[$i]} @arrays );
    $i++;
  }

  @rc;
}

sub pmap
{
  my ($max_n,$func,@arrays) = @_;

  die "pmap: max_n must be greater than zero: $max_n" unless $max_n > 0;

  return mapn( $func, @arrays ) if $max_n == 1;

  my $old_handler = $SIG{CHLD};
  my $children = 0;
  my @done_pids;
  $SIG{CHLD} = sub {
        while( (my $pid = waitpid(-1,&WNOHANG))>0 ) {
          push @done_pids, $pid;
          $children--;
        }
  };


  my @rc = mapn(
    sub {
      sleep while $children >= $max_n;
      $children++;

      #print "$$: About to spawn a new child\n";
      if( my $pid = fork() ) { return $pid }

      # Restore what ever they were using before we grabbed it
      $SIG{CHLD} = $old_handler;
      $func->(@_);
      exit;
    },
    @arrays );

  my $old_sigalrm = $SIG{ALRM};

  eval {
    $SIG{ALRM} = sub { die "Time out while waiting\n" };
    alarm( 300 );
    while( $children > 0 ){
      print "$$: Waiting for $children children: all=@rc (@done_pids)\n";
      sleep;
    }
  };

  if( $@ ) {
    warn "$$: Timedout: $children left (@rc) (@done_pids)\n";
    map { kill $_ } @rc;
  }

  $SIG{CHLD} = $old_handler;
  $SIG{ALRM} = $old_sigalrm || 'IGNORE';
  print "$$: All children dead: (@done_pids)\n";
  @rc;
}

__END__

-- 
  o   hudson@cs.tulane.edu            tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.cs.tulane.edu/~hudson/     H 505.266.59.96   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: Tue, 29 Sep 1998 15:22:28 GMT
From: huntersean@hotmail.com
Subject: Re: help needed
Message-Id: <6uqtvj$avf$1@nnrp1.dejanews.com>

The reason for this is that '+' is a magic character that has a special
meaning in regular expressions (regexps).  Use the \Q & \E modifiers to quote
your search string thusly...

 		s/\Q$search\E/$replace/gie;

BTW it would be a good idea to add the /o modifier to the end of your s///

 		s/\Q$search\E/$replace/gieo;

You could also do "perldoc perlre"

Sean Hunter

In article <F01IJL.6o4@liverpool.ac.uk>,
  bjjgann@liv.ac.uk wrote:
> I have a small perl script which opens a file , searches for a string and
> replaces the string then saves the outcome to another file. This works fine
> unless the serach string is a + to which i get an error :-
>
> /+/: ?+* follows nothing in regexp
>
> below is the code:-
>
> ($infilename = a);
> ($outfilename = b);
> ($search = "+");
> ($replace = "");
>
> open(IN,$infilename) ||		die "cannot open $infilename for
reading";
> open(OUT,">$outfilename") || die "cannot create $outfilename";
>
> while (<IN>) {
> 		s/$search/$replace/gie;
> 		print OUT $_; # print that line to file $b
>
> }
> close(IN);
> close(OUT);
>
> The code works fine with other $search variables such as = or &
>
> Any help appreciated
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Tue, 29 Sep 1998 13:26:42 -0500
From: fisherm@tce.com (Mark Leighton Fisher)
Subject: Re: Help with system() on NT
Message-Id: <MPG.107af068fc5eb44d989699@news-indy.indy.tce.com>

In article <360FF9DB.B8805B8C@mail.tju.edu>, 
george.kuetemeyer@mail.tju.edu says...
> scottw7562@my-dejanews.com wrote:
> > I read the docs and apparently the `backtick` method is not supported under
> > NT ?? otherwise I should be able to capture and supress the output of the
> > command.
> >
> The `backtick` method *does* work with NT.

You just have to remember that NT has differents commands, like:
	print `cmd /c dir`;
instead of
	print `ls`;
to list the contents of the current directory. (Or you can get something 
like the MKS Toolkit (<URL:http://www.mks.com/>), and have Unix/POSIX
commands under NT -- the MKS Korn Shell is in my Startup group...) 
==========================================================
Mark Leighton Fisher          Thomson Consumer Electronics
fisherm@indy.tce.com          Indianapolis, IN
"Browser Torture Specialist, First Class"


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

Date: Tue, 29 Sep 1998 16:36:52 +0000
From: Steve Maring <smaring@gte-es.com>
Subject: How do I sort a multidimensional array????
Message-Id: <6ur2jf$8v9$1@news-1.news.gte.net>

I have a two dimensional array that I would like to sort based on the x
element of [x][y]

I tried this;

@array = ( [3,2,1], [1,3,4], [6,7,8] );
print("before sort\n");
for ($i=0;$i<=$#array;$i++) {
        print("$array[$i][0] $array[$i][1] $array[$i][2]\n");
}

@array = sort($array[$a][0] cmp $array[$b][0]);        <--- does not
like this

print("after sort\n");
for ($i=0;$i<=$#array;$i++) {
        print("$array[$i][0] $array[$i][1] $array[$i][2]\n");
}


Can someone offer a suggestion?

Thanks.

-Steve Maring
Tampa, FL



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

Date: Tue, 29 Sep 1998 11:32:19 -0700
From: Yogish Baliga <baliga@synopsys.com>
To: smaring@gte-es.com
Subject: Re: How do I sort a multidimensional array????
Message-Id: <361127B3.A7BA9333@synopsys.com>

sort { $a->[0] <=> $b->[0] } @array;

-- Baliga

Steve Maring wrote:

> I have a two dimensional array that I would like to sort based on the x
> element of [x][y]
>
> I tried this;
>
> @array = ( [3,2,1], [1,3,4], [6,7,8] );
> print("before sort\n");
> for ($i=0;$i<=$#array;$i++) {
>         print("$array[$i][0] $array[$i][1] $array[$i][2]\n");
> }
>
> @array = sort($array[$a][0] cmp $array[$b][0]);        <--- does not
> like this
>
> print("after sort\n");
> for ($i=0;$i<=$#array;$i++) {
>         print("$array[$i][0] $array[$i][1] $array[$i][2]\n");
> }
>
> Can someone offer a suggestion?
>
> Thanks.
>
> -Steve Maring
> Tampa, FL





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

Date: Tue, 29 Sep 1998 17:43:15 -0300
From: Sergio Bernardo <sergio@mail.pt>
Subject: Re: Many processes communication - How To?
Message-Id: <36114663.54C208CD@mail.pt>

> See "Unix-Domain TCP Clients and Servers" in that same perlipc
> man page. Works fine for me.

Thank you all that answered me!

After some problems with a missing autoflush,
my problem is solved using a socket! 

Sergio Bernardo
sergio@mail.pt


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

Date: Tue, 29 Sep 1998 18:04:34 GMT
From: schwern@starmedia.net
Subject: mod_perl /home/.htaccess wierdness.
Message-Id: <6ur7fi$mf6$1@nnrp1.dejanews.com>

Hi, I'm attempting to compile Apache 1.3.2 (I tried Apache 1.3.1,too) and
mod_perl 1.15_01 (tried 1.15, too) under Solaris X86 and coming up with a
strange error during testing.  After a make test, most everything fails.  Upon
looking at t/logs/mod_perl_error_log I see:

[Tue Sep 29 13:41:38 1998] [warn] [notice] child_init for process 8963,
report a ny problems to [no address given]

[Tue Sep 29 13:41:40 1998] [crit] (13)Permission denied: /home/.htaccess
pcfg_op enfile: unable to check htaccess file, ensure it is readable [Tue Sep
29 13:41:41 1998] [crit] (13)Permission denied: /home/.htaccess pcfg_op
enfile: unable to check htaccess file, ensure it is readable ...<repeated
about 50 more times>... [notice] child process 8963 terminating [notice]
push'd PerlChildExitHandler called, pid=8963 [notice] END block called for
startup.pl [notice] Destruction->DESTROY called for $global_object


I have no idea why its looking in /home/.htaccess.  I set APACHE_PREFIX to
/home/schwern/etc/apache, which exists and is readable/writable/executable by
me.  I grepped all of the mod_perl and apache source and could not find a
reason for this.  I'm using only the Apache modules included by default in
Apache_1.3.2/src/Configuration.tmpl.

t/conf/httpd.conf has ServerRoot set to /home/schwern/src/mod_perl-1.15_01/t
and DocumentRoot set to /home/schwern/src/mod_perl-1.15_01/t/docs, as it
should be.


I made with 'CC=gcc perl Makefile.PL USE_APACI=1
APACHE_PREFIX=/home/schwern/etc/apache EVERYTHING=1 CC=gcc'

I have no idea why this is happening.  Anyone else?

--

Michael G Schwern                                       Applications Engineer
(212)548-9643             Starmedia Networks                       Unix Bigot
schwern@starmedia.net                                 Certified Stupid Person
            @h{@a[grep{!$_%2}0..$#a]}=@a[grep{$_%2}0..$#a];

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Tue, 29 Sep 1998 18:46:20 GMT
From: steveg@nospam.org (Steve maZe)
Subject: Need help with interpolation of a scalar !! ?
Message-Id: <36112979.435485718@news.usmicro.com>



 Here is the code and the output: 

knowing that 
$current ends up being  "something".html
adn $logfile is the path to a log file (Duh :)

foreach $temp (@htmllist)
        {
        $current = `basename $temp`;
        print "current is $current<BR>\n";
        print "logfile is $logfile<BR>\n";
        $pagehit = `grep $current $logfile | wc -l`;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Problem is here (I think)
        print <<EOF1;
                Number of Hits for $current is $pagehit<BR><BR>
EOF1
$hits = 0;
         }


 The problem is that $pagehit ends up as 0. and if I enclose $current
in '' in gives me a fixed number (2390) ?? .. don't get it ... help
anyone ?? 
 I am failry new to perl and I did look through the camel book but to
no avail !! 


 HELP 

 THX
 steve


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

Date: 29 Sep 1998 17:51:58 GMT
From: rscaife@falcon.csc.calpoly.edu (Roy Kenneth Scaife)
Subject: Need method to round real number to two decimal places
Message-Id: <6ur6nu$rff$1@cscnews.csc.calpoly.edu>

I am looking for a method of rounding a real number to two decimal places.
e.g. 3.534364 --> 3.53

Using printf is _not_ an option as   
the new value will then be used for further calculations.  

Thanks in advance.

Roy K Scaife

Keywords: -- 


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

Date: Tue, 29 Sep 1998 11:36:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need method to round real number to two decimal places
Message-Id: <MPG.107ac88dfa70552d9897cb@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <6ur6nu$rff$1@cscnews.csc.calpoly.edu> on 29 Sep 1998 17:51:58 
GMT, Roy Kenneth Scaife <rscaife@falcon.csc.calpoly.edu> says...
> I am looking for a method of rounding a real number to two decimal places.
> e.g. 3.534364 --> 3.53
> 
> Using printf is _not_ an option as   
> the new value will then be used for further calculations.  

Why is using sprintf _not_ an option, to get the rounded value into a 
variable that can then used for further calculations?

However, if the value is not negative, you can use:

$rounded = int(100 * $number + 0.5) / 100;

but why bother?  Use:

$rounded = sprintf '%.2f', $number;

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


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

Date: Tue, 29 Sep 1998 11:11:33 -0700
From: "Robert Cronkite" <racronkite@nospam_hrl.com>
Subject: Re: Need method to round real number to two decimal places
Message-Id: <6ur7tg$h9k@hacgate2.hac.com>

How about multiplying by 100, adding .5, taking the int and dividing by 100

$x = 3.534364;
$x = int(($x * 100) + .5));

Robert




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

Date: 29 Sep 1998 12:18:14 -0400
From: Uri Guttman <uri@camel.fastserv.com>
To: "Phinneas G. Stone" <phinneas@eskimo.com>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <sarsohavqnt.fsf@camel.fastserv.com>

>>>>> "PGS" == Phinneas G Stone <phinneas@eskimo.com> writes:

  PGS> I've noticed a few comments regarding Matt's scripts, and as a
  PGS> relative newbie who has recently implemented Matt's guestbook for
  PGS> a customer, I wonder if someone could clue me in as to how to fix
  PGS> this problem.

rewrite them from scratch? toss them in /dev/null?

they are crappy code at best and buggy at worst. stay away from
them. there are better programs out there (free and commercial) for all
of those. they haven't been updated in years nor will they. the fixes
everyone does keep get reinvented. 

uri

-- 
Uri Guttman                  Fast Engines --  The Leader in Fast CGI Technology
uri@fastengines.com                                  http://www.fastengines.com


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

Date: Tue, 29 Sep 1998 10:20:22 -0700
From: "Phinneas G. Stone" <phinneas@eskimo.com>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <361116D6.88BCD15A@eskimo.com>

Randal Schwartz wrote:

> >>>>> "Phinneas" == Phinneas G Stone <phinneas@eskimo.com> writes:
>
> Phinneas> I've noticed a few comments regarding Matt's scripts, and as
> Phinneas> a relative newbie who has recently implemented Matt's
> Phinneas> guestbook for a customer, I wonder if someone could clue me
> Phinneas> in as to how to fix this problem.
>
> You fix it by writing your own stuff, inspired by Matt's scripts.
> There's not much you can do to patch Matt's scripts to work right.
> That's like patching a Yugo to make it a real car. :)
>

  Ok, sounds great. Thing is, I'm just not ready for prime-time yet. Even if I did
write a script that did the same thing, I'm not experienced enough to know if it was
any better, or maybe worse, than Matt's. But I'm getting there :) For the time being,
I need to stick with hacking and slashing other peoples' [free (I'm po)]  code and
asking dumb questions of you guys. What does everybody think of Selena Sol's code?




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

Date: Tue, 29 Sep 1998 18:26:09 +0100
From: Kiril <work@nospam.idea.co.uk>
Subject: restricting script execution?
Message-Id: <36111831.D23C3845@nospam.idea.co.uk>

Dear All


I am trying to think my way through a 'project', and a few questions
cropped
up that I hope someone will be able to enlighten me on....specifically,
whether
what I am trying to achive is possible or not - without hacking the perl
code
itself

This is the scenario - imagine a UNIX system...
a directory like 
/some/project
with, say a .../system and a .../user sub-dir.
each of the three has a bunch of perl scripts in them.

the 'main' program resides in .../project, some other stuff in the other
2 dirs.

1. once the 'main' program is initialised, no scripts can access
anything 
outside of .../project. afaik, the only way to achieve this is by having 
a chroot() in there somewhere, or a root-suid wrapper.

2. once the 'main' is initialised, it presents a CLI, or serves a
socket, 
or something, allowing a user to type in 'commands'. most commands will
need to run-time execute a script in either /system or in /user. this is 
something I think can be done using eval(), right ?

3. while those 'extra' scripts are executing, perl itself must be able
to 
deal with any errors in those scripts without terminating. again, I
think
eval() can take care of it.

4. here comes the fun part... a script in /system must be allowed to do
practically anything, including modifications of files in both /system
and
/user, but a script in /user must under no conditions be able to modify
files anywhere else except /user... is there any way at all to control
this?

I guess what it comes to is - before the script in /user is executed,
can the
parent 'environment'(?) be set in such a way that a /user script cannot
access
any (all?) built-in functions within Perl. OTOH, the /user script is
allowed to 
call functions from files in /system, which will do _some_ sort of
checking, and 
then (say) access files, etc...

what I am driving at is (I suppose) is a 'security' shell between an
eval'd script
and the functions it calls.

can anyone tell me whether this is possible 'in principle', or should I
just forget
the whole idea and/or start reading the perl source ?



Kiril


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

Date: Tue, 29 Sep 1998 17:46:28 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: restricting script execution?
Message-Id: <36111A83.B5D338D6@bbnplanet.com>

Kiril wrote:

> 1. once the 'main' program is initialised, no scripts can access
> anything
> outside of .../project. afaik, the only way to achieve this is by having
> a chroot() in there somewhere, or a root-suid wrapper.

Set the environment up such as

$ENV{'PATH'} = '/usr/bin:/pkg/acct/sbin';
$ENV{'IFS'} = $ENV{'IFS'} ne '' ? $ENV{'IFS'} : '';
$< = $>;

> what I am driving at is (I suppose) is a 'security' shell between an
> eval'd script
> and the functions it calls.

Psst...I think someone did this already and comes with the source of
Perl.
> 
> can anyone tell me whether this is possible 'in principle', or should I
> just forget
> the whole idea and/or start reading the perl source ?

Reading the source is fun :)

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


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

Date: 29 Sep 1998 17:00:13 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: SRC: encrypt your Perl scripts! :-)
Message-Id: <6ur3mt$nct$1@info.uah.edu>

You can also find this at

    <URL:http://www.cs.uah.edu/~gbacon/perl/encrypt>

Enjoy!

#! /usr/bin/perl -w

# Copyright (c) 1998 Greg Bacon.  All Rights Reserved.
# This program is free software.  You may distribute it or modify
# it (perhaps both) under the terms of the Artistic License that
# comes with the Perl Kit.

use strict;
use integer;

foreach my $file (@ARGV) {
    unless (open FILE, $file) {
        warn "$0: failed open $file: $!\n";
        next;
    }

    my $key = int rand 256;

    my $out = <<EOTop;
#! /usr/bin/perl

my \$prog = '';

{
    my \$key  = $key;
    local \$/;
 
    \$prog = pack "c*",
             map { \$_ = \$_ ^ \$key }
             unpack "c*", <DATA>;
}

eval \$prog;
__END__
EOTop

    while (<FILE>) {
        $out .= pack "c*",
                map { $_ = $_ ^ $key }
                unpack "c*", $_;
    }
    close FILE;

    unless (open FILE, ">$file") {
        warn "$0: failed open >$file: $!\n";
        next;
    }

    print FILE $out;
    close FILE;;
}


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

Date: Tue, 29 Sep 1998 18:18:23 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: SRC: encrypt your Perl scripts! :-)
Message-Id: <361121FE.373723A4@bbnplanet.com>

Greg Bacon wrote:

> # Copyright (c) 1998 Greg Bacon.  All Rights Reserved.
> # This program is free software.  You may distribute it or modify
> # it (perhaps both) under the terms of the Artistic License that
> # comes with the Perl Kit.

I don't know why, but I find this to be pretty ironic(r).

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


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

Date: Tue, 29 Sep 1998 20:26:12 +0200
From: "David c" <davidc@meta4.es>
Subject: UserGetMisc.al  library
Message-Id: <6ur8pa$a0i$1@talia.mad.ibernet.es>


    I need this library to compile one perl script to change user atributes
for Domain.

    I'm using perl5.00402-bindist04-bc version of Perl.

       Can anybody send me this library or tell me where can i get it?

    Thanks.




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

Date: Tue, 29 Sep 1998 19:02:24 GMT
From: Focus12@xxbigfoot.com (Newbie)
Subject: Will this FORM process the information slow??
Message-Id: <36112a9b.4960861@news.iaehv.nl>

Hello,

I want to make a form processor that only members of a site can use.
If a member want to use the form on his or her site, they will have to
add the following line to their form code on their site:

<input type=hidden name="username" value="thisismyusername">

When someone press the submit button the form will open a file,
look for the e-mail corresponding to the username, and then send
the data to the user! So there is no need for the recipient to send
his or her e-mail in the form! What I want to know is if this will
slow don't the form and make the waiting period too long!! If you are
a CGI expert or you know the answer, then please let me know!!

P.S. If you like the idea and want to use it, let me know. I haven't
seen any form that works like this before. Maybe because it takes too
long to process?!?

Many Thanks,

Focus12@xxbigfoot.com
(remove 'xx' from e-mail for reply)


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

Date: Tue, 29 Sep 1998 17:21:42 +0000
From: "James A. Abercromby II" <avi318k1@pn.nettuno.it>
Subject: Win32 Perl for x86 standard or Active State
Message-Id: <36111726.E3D2BE15@pn.nettuno.it>

I am a total newbie to the Win32 ports of Perl, and today I download
the whole CPAN dir /ports/win32/Standard/x86 in it's entirety, I am
alittle confused as to what files are actually to be installed.  I read
the README and now I guess I just need the most recent release of the
file perl5-XXbindistYY.tar.gz.  But there is also a lot of other files
in this dir such DATADUMPER, ALIAS, libwin32 etc. etc. etc.  The other
docs I read left me alittle bewildered.  Is there a web page that gives
in detail the down and dirty install plans for PERL win32 as far as
exactly what files I need.???????


Or
Should I use the PERL WIN32 ACTIVE STATE????????????

FWITW It seems like I can use either or.

Is it easier to install Active State?

My only other experience in installing and coding in Perl is on Debian
and Redhat Linux.

If someone can point me in the right direction it would be greatly
appreciated.


Jim Abercromby

avi318k1@pn.nettuno.it
james.abercromby@aviano.af.mil


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

Date: Tue, 29 Sep 1998 19:54:42 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Win32::OLE
Message-Id: <36151d80.4457709@news2.ibm.net>

[mailed & posted]

ovallari@tse.com (Oscar Vallarino) wrote:

>I am trying to write some Perl code to drive Excel97 through its
>object interface on WinNT 4.0.  I recorded a macro (listed below) to
>identify the OLE automation calls required.  However, I can't find
>anywhere examples of how to translate VBA's statements with multiple
>operands (eg, OpenText, SetSourceData) into Perl's references.   I am
>using ActiveState's Perlscript 5.00502.
>
>Any help will be appreciated.

Hi Oscar,

I tried to do a straight forward translation, but couldn't test it as I
don't have your datafile. BTW, named parameters are specified as a hash
reference as the last parameter to a method call. It is mentioned in the
inline POD!

-Jan

#!perl -w
use strict;
use Win32::OLE qw(with);
use Win32::OLE::Const 'Microsoft Excel';

my $Excel = Win32::OLE->new("Excel.Application");
$Excel->Workbooks->OpenText({
 FileName => 'E:\P9901\results\T00211-00.TXT',
 Origin => xlWindows, StartRow => 1, DataType => xlFixedWidth,
 FieldInfo => [[0,1], [3,1]]
});

my $Range = $Excel->ActiveSheet->Range("A1:B12")->Select;
$Excel->Charts->Add;
my $Chart = $Excel->ActiveChart;
$Chart->{ChartType} = xlXYScatterLinesNoMarkers;
$Chart->SetSourceData({Source => $Range, PlotBy => xlColumns});
$Chart->Location({Where => xlLocationAsNewSheet});
# Location method might invalidate $Chart reference
$Chart = $Excel->ActiveChart;
$Chart->{HasTitle} = 1;
$Chart->ChartTitle->Characters->{Text} = "This is the tible"; # sic!
my $Axis = $Chart->Axes(xlCategory, xlPrimary);
$Axis->{HasTitle} = 1;
$Axis->AxisTitle->Characters->{Text} = "This is elapsed time";

$Axis = $Chart->Axes(xlValue, xlPrimary);
$Axis->{HasTitle} = 1;
$Axis->AxisTitle->Characters->{Text} = "This is transactions";

>--------------------------------------------------------------------------------------------------------------
>
>Sub Macro2()
>'
>' Macro2 Macro
>' Macro recorded 9/28/98 by ovallari
>'
>
>'
>    Workbooks.OpenText FileName:="E:\P9901\results\T00211-00.TXT", _
>Origin:= xlWindows, StartRow:=1, DataType:=xlFixedWidth,
>FieldInfo:=Array(Array(0, _
>        1), Array(3, 1))
>    Range("A1:B12").Select
>    Charts.Add
>    ActiveChart.ChartType = xlXYScatterLinesNoMarkers
>    ActiveChart.SetSourceData
>Source:=Sheets("T00211-00").Range("A1:B12"), _
>        PlotBy:=xlColumns
>    ActiveChart.Location Where:=xlLocationAsNewSheet
>    With ActiveChart
>        .HasTitle = True
>        .ChartTitle.Characters.Text = "This is the tible"
>        .Axes(xlCategory, xlPrimary).HasTitle = True
>        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
>        "This is elapsed time"
>        .Axes(xlValue, xlPrimary).HasTitle = True
>        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
>        "This is transactions"
>    End With
>End Sub



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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 3851
**************************************

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