[7646] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1272 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 5 00:07:12 1997

Date: Tue, 4 Nov 97 21:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 4 Nov 1997     Volume: 8 Number: 1272

Today's topics:
     Re: "die" function won't print in CGI!?!! (David Jacoby)
     ARRAYS... Reading file data HELP ME!! <gdoucet@ait.acl.ca>
     Re: ARRAYS... Reading file data HELP ME!! (Tad McClellan)
     CPAN confusion (William R. Ward)
     Re: CPAN confusion (brian d foy)
     Re: crontab -l reformating (Reinvent the wheel?) (Martien Verbruggen)
     FileHandle->flush not working (?) <w.stanton@auckland.ac.nz>
     How do I get rid of HTTP/1.0 200 OK??? (Eric Phillips)
     Re: How do I......? (Martien Verbruggen)
     Is this possible? <kherlitz@nortel.com>
     Re: Is this possible? (Jeremy D. Zawodny)
     Re: Is this possible? (Tad McClellan)
     Re: Need binary for solaris (Martien Verbruggen)
     NT/ Reading command output <vernon.peets@beasys.com>
     pattern matching options <tr7488@swbell.net>
     Re: Perl "Here" document and formatting tabs (William R. Ward)
     Perl file sort HChicowitz@aol.com
     Re: Perl file sort (Tad McClellan)
     Re: running remote shelll under suid perl script ? (Kim)
     Re: Seeking Year 2000 checker OR comment stripper for C (Abigail)
     Re: signal handling (Charles DeRykus)
     SybPerl or Win32::ODBC for use with ISAPI on NT? <tim@hcirisc.cs.binghamton.edu>
     Re: waiting for forks (Charles DeRykus)
     Re: Your opinion on The Perl Journal (TPJ) ? (Jon Orwant)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Nov 1997 00:59:48 GMT
From: jacoby@freighter.ecn.purdue.edu (David Jacoby)
Subject: Re: "die" function won't print in CGI!?!!
Message-Id: <63oge4$r1t@mozo.cc.purdue.edu>

In article <3458FFC6.81A77413@geoplex.com>,
Mani Prasad Kancherla  <mani@geoplex.com> wrote:
>Hi All!
>
>    Please take a look at the following code:
>--------------------------------------------------------------------------------------
>
>#!/usr/bin/perl -w
>use CGI(":standard");
>
>$err_str = start_html("Error").h1("Error:")."Can't find form:
>$!".end_html;
>
>print header;
>die $err_str unless (param("form") eq "trouble_report");
>start_html("blah blah"); print "Some stuff"; end_html;
>--------------------------------------------------------------------------------------

>When the value of "form" is "trouble_report" everything is fine.
>Otherwise,
>Netscape complains "Document has no data". But when I try this program
>from
>the command line I get what is expected in both cases (i.e. when "form"
>=
>"trouble_report" or even otherwise).
>
>Is there something wrong with what I'm doing?
>
>Thanks in advance,
>mani

Well, I hand-start all my CGI (I'm fairly new at this myself), but it looks
to me like the die would come up before you've announced to Netscape that
this is netscape. If you put start_html("foo") before (or, as I do, put in
the Content-Type: stuff in by hand) before the die command*, you'll get something.


*Even better, put minimal header information in the die command, such as
	die "content-type: text/plain \n\n $err_str "
	unless (param("form") eq "trouble_report");

But then there might be some other problems, so test it out for yourself.

-- 
 David Jacoby                           mailto:jacoby@ecn.purdue.edu
 Web Technician and Librarian  http://harbor.ecn.purdue.edu/~jacoby/
 Engineering Computer Network    What do you want? Perl can do that!
---------------------------------------------------------------------


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

Date: Wed, 05 Nov 1997 03:25:48 GMT
From: Guy Doucet <gdoucet@ait.acl.ca>
Subject: ARRAYS... Reading file data HELP ME!!
Message-Id: <345FE68E.B8A8F192@ait.acl.ca>


--------------7321B7110DF214F24127358C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I have a text data file that I need to store in an array to allow for
easy calculations. The file would look like this:

AAAAA    95   40   12
BBBBB    80   34   11
CCCCC    88   33    5
 ...

I would prefer if the fields in each record (row) were separated by a
tab character so that I could easily read the file with a spreadsheet.

What I managed so far was to open the file, read the file in an array
variable, and close the file, for example:

   open(TOTALS,"$basedir/s_totl\.txt");
   @totals = <TOTALS>;
   close(TOTALS);

But know each $total of @totals is the entire record, how do I store
each of its field in a variable too?

All help gratefully appreciated.
Guy Doucet

--------------7321B7110DF214F24127358C
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
I have a text data file that I need to store in an array to allow for easy
calculations. The file would look like this:<TT></TT>

<P><TT>AAAAA&nbsp;&nbsp;&nbsp; 95&nbsp;&nbsp; 40&nbsp;&nbsp; 12</TT>
<BR><TT>BBBBB&nbsp;&nbsp;&nbsp; 80&nbsp;&nbsp; 34&nbsp;&nbsp; 11</TT>
<BR><TT>CCCCC&nbsp;&nbsp;&nbsp; 88&nbsp;&nbsp; 33&nbsp;&nbsp;&nbsp; 5</TT>
<BR><TT>...</TT><TT></TT>

<P>I would prefer if the fields in each record (row) were separated by
a tab character so that I could easily read the file with a spreadsheet.

<P>What I managed so far was to open the file, read the file in an array
variable, and close the file, for example:

<P><TT>&nbsp;&nbsp; open(TOTALS,"$basedir/s_totl\.txt");</TT>
<BR><TT>&nbsp;&nbsp; @totals = &lt;TOTALS>;</TT>
<BR><TT>&nbsp;&nbsp; close(TOTALS);</TT>

<P>But know each $total of @totals is the entire record, how do I store
each of its field in a variable too?

<P>All help gratefully appreciated.
<BR>Guy Doucet</HTML>

--------------7321B7110DF214F24127358C--



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

Date: Tue, 4 Nov 1997 22:28:36 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: ARRAYS... Reading file data HELP ME!!
Message-Id: <klso36.j33.ln@localhost>

Guy Doucet (gdoucet@ait.acl.ca) wrote:

:    open(TOTALS,"$basedir/s_totl\.txt");
:    @totals = <TOTALS>;
:    close(TOTALS);

: But know each $total of @totals is the entire record, how do I store
: each of its field in a variable too?


foreach (@totals) {
   @fields = split;               # put the fields into an array
#   ($firstname, $lastname, $address) = split; # if you know how many fields
   for ($i=0; $i<@totals; $i++) {
      print "$i: $_";
   }
   print "\n\n";
}



: --------------7321B7110DF214F24127358C
: Content-Type: text/html; charset=us-ascii
                ^^^^^^^^^
                ^^^^^^^^^

This is Usenet.

Usenet is not the WWW.

Please stop abusing Usenet so.

Your "newsreader" is misconfigured.


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 04 Nov 1997 18:32:38 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: CPAN confusion
Message-Id: <waan2jkyss9.fsf@am.UCSC.EDU>


Maybe I'm just missing something here, but I find CPAN to be a total
pain in the ass to browse.  If I access the module list I am unable to
find any documentation or detaile descriptions of the modules.  It
seems to me that the package name should be a hyperlink to that
package's manpage.  If I go to the author's page I can usually find
the docs I'm looking for but it's awkward to do it that way.

Who maintains the CPAN web interface that I see mirrored all over the
place and how can I get him/her to change this?

--Bill.

-- 
William R Ward          Bay View Consulting   http://www.bayview.com/~hermit/
hermit@bayview.com     1803 Mission St. #339        voicemail +1 408/479-4072
hermit@cats.ucsc.edu  Santa Cruz CA 95060 USA           pager +1 408/458-8862


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

Date: Tue, 04 Nov 1997 23:02:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CPAN confusion
Message-Id: <comdog-ya02408000R0411972302090001@news.panix.com>

In article <waan2jkyss9.fsf@am.UCSC.EDU>, hermit@cats.ucsc.edu (William R. Ward) wrote:

>Maybe I'm just missing something here, but I find CPAN to be a total
>pain in the ass to browse.  If I access the module list I am unable to
>find any documentation or detaile descriptions of the modules.  It
>seems to me that the package name should be a hyperlink to that
>package's manpage.  If I go to the author's page I can usually find
>the docs I'm looking for but it's awkward to do it that way.

PAUSE (Perl Authors Upload Server) automatically extracts the README
file from distributions and makes a link to it in that module's directory
(the filename ends in .readme).

It's not really a problem with CPAN since it already has the functionlity
you request.  If module authors use README files, or put more helpful
information in their README's (such as the SYNOPSIS of the POD), then you
would have the information that you want.

However, I disagree that detailed information, such as the entire
manpage, should be made available on CPAN.  One can simply download
the module and run it through pod2man or another pod translator.  

>Who maintains the CPAN web interface that I see mirrored all over the
>place and how can I get him/her to change this?

Perhaps I'm misreading your tone, but it's fairly offensive and 
ungrateful rather than suggestive and helpful.  Perhaps you don't 
appreciate the enormonous amount of work in such an undertaking,
especially when the software is given away for free.  Using terms
like "total pain in the ass" and "get him/her to" are not endearing
to the people that can help you, or to those whose work you criticize.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 5 Nov 1997 01:56:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: crontab -l reformating (Reinvent the wheel?)
Message-Id: <63ojo9$1qd$3@comdyn.comdyn.com.au>

In article <63nbgu$jdv@suriname.earthlink.net>,
	bodhi1@nonamesleft.com (bodhi1@nonamesleft.com) writes:
> I am looking for any Perl scripts that will allow me to take the output of 
> crontab -l and format it into something that is readable by normal human 
> beings. It would be ideal if it would put it into a .html format.

In what way is the output of 'crontab -l' not human readable? I am perfectly
capable of reading it, and I am not an alien...

Maybe you could be a bit more specific in telling us what you want?

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | What's another word for Thesaurus?
NSW, Australia                      | 


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

Date: 05 Nov 1997 13:46:01 +1200
From: Worik Macky Stanton <w.stanton@auckland.ac.nz>
Subject: FileHandle->flush not working (?)
Message-Id: <wk7maodsfa.fsf@auckland.ac.nz>

Friends

The following code does not work as I would expect.

    $self->{logfile}->print($line);
    $self->{logfile}->flush;

In that the file is not flushed.  All the infomation is in the file
after I kill the programme with a ^c, but not there while it runs.

What is going on?  Any ideas?

Worik


I have 
C:\Worik\search>perl -v

This is perl, version 5.003_07

Copyright 1987-1996, Larry Wall

        + suidperl security patch
        Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
                All rights reserved.
        Developed by ActiveWare Internet Corp., http://www.ActiveWare.com

Perl for Win32 Build 307 - Built 10:11:54 Jul 15 1997

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.


On windows 95.


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

Date: Tue, 04 Nov 1997 05:32:56 GMT
From: e.phillips@mindspring.com (Eric Phillips)
Subject: How do I get rid of HTTP/1.0 200 OK???
Message-Id: <345eb32a.8853295@news.mindspring.com>

I have a page that is a SSI page at
http://www.starhosting.com/ephillips/index.stm that will display
random text.  My only problem is that when the SSI CGI script is
executed, it also place the text "HTTP/1.0 200 OK"  to the left of
this random text.  How do I get rid of this?

Please let me know!


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

Date: 5 Nov 1997 01:45:12 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How do I......?
Message-Id: <63oj38$1qd$1@comdyn.comdyn.com.au>

In article <345d6cba.17872087@news.mindspring.com>,
	e.phillips@mindspring.com (Eric Phillips) writes:
> Hello all, I have a question about Perl.

No, you don't.

> I want a script that can be called from an <IMG> tag and write to that
> image tag.
> 
> For instance, the tag <IMG src="/cgi-bin/random_img.pl"> would go to a
> random image.

So far I have seen html and cgi. No perl. The fact that you're using a perl
script to perform a CGI task doesn't make it a perl question.

next time try comp.infosystems.www.*

> How do I do this, without using SSI.  This is all leading up to a

make sure your script returns the right mime header (image/gif or so) and then
just stream the image data after that.

> banner rotator that I am building myself, for my needs, but am not
> really an expert at Perl.  Please let me know!!

Why reinvent the wheel? There are tons of those programs about. try
www.cgi-resources.com

Martien

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy  to be
NSW, Australia                      | cynical.


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

Date: Tue, 04 Nov 1997 18:42:47 -0600
From: Kirk Herlitz <kherlitz@nortel.com>
Subject: Is this possible?
Message-Id: <345FC107.FE800C33@nortel.com>

I'm getting up to speed using Perl by using it in some projects
where it's feasible to use Perl instead of C.  One thing that I
tried to do today doesn't seem like it's possible in Perl.  But,
I wanted to find out if I'm right or not.

Bottom line: Is it possible to have an associative array of lists?

We're writing a tool tracking program to track the usage of tools
within our department.  So, I wanted to have an associative array
that would have the tool names as the keys.  These key values 
would reference the list of user ID's of people who have used the
tool.

Declared like this:

%users={@automgr,@autoreg,@decoder,@decoder2,@toolbar,@trapid,@vsosui};

I already played around with this a little to see if it worked.
You are able to reference elements by using $users{$tool[0]}.  But,
in the code that I wrote, it appears that once you assign a value
to any of the 'slots' in the list - this value gets assigned to
EVERY 'slot' in the list - overwriting anything there.  

Doing something like this seems extremely unorthodox anyways since
what I'm trying to do is just add on new elements to these lists
by incrementing the index that I use.  In C it would have to be
statically declared, or use a dynamic data structure like a hash
table, which is what I'm essentially trying to do here.

So - can this be done?  It seemed like a good idea, but, like I
mentioned, kind of an unorthodox method of dynamically building
a data structure.

A hash table would work perfectly for this project, so if anyone
has suggestions about how to fix what I'm doing, or something
completely different, I'd love to hear about it.

I know there are easier ways to do this project, but, like I said,
I'm trying to learn Perl, so I'm trying to challenge myself...

Thanks,

Kirk
kherlitz@nortel.com


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

Date: Wed, 05 Nov 1997 02:26:40 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Is this possible?
Message-Id: <3460d933.690708085@woody.wcnet.org>

[original author automagically cc'd via e-mail]

On Tue, 04 Nov 1997 18:42:47 -0600, Kirk Herlitz <kherlitz@nortel.com>
wrote:

>Bottom line: Is it possible to have an associative array of lists?

Bottom line: Yes!

 http://www.perl.com/CPAN-local/doc/FMTEYEWTK/pdsc/index.html

See some of the recipies there... :-)

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


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

Date: Tue, 4 Nov 1997 22:10:35 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Is this possible?
Message-Id: <rjro36.b03.ln@localhost>

Kirk Herlitz (kherlitz@nortel.com) wrote:
: I'm getting up to speed using Perl by using it in some projects
: where it's feasible to use Perl instead of C.  One thing that I
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That's an awful lot of places  ;-)


: tried to do today doesn't seem like it's possible in Perl.  But,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Heretic!


: I wanted to find out if I'm right or not.
: Bottom line: Is it possible to have an associative array of lists?


from the perldsc man page:

-------------------------------------
=head1 HASHES OF LISTS

=head2 Declaration of a HASH OF LISTS

 %HoL = (
        flintstones        => [ "fred", "barney" ],
        jetsons            => [ "george", "jane", "elroy" ],
        simpsons           => [ "homer", "marge", "bart" ],
      );
-------------------------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 5 Nov 1997 01:53:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Need binary for solaris
Message-Id: <63ojjn$1qd$2@comdyn.comdyn.com.au>

In article <878521969.520@dejanews.com>,
	jmahtani@hotmail.com writes:
> Hello,	I am looking for a binary of perl(for solaris 2.5.1 ). I would be
> very much obliged if someone could let me know where I could find a
> binary for solaris. (I know it is a good idea to compile perl but I just
> wanted to try the binary first before I compile one). Please reply to

It's probably easier, as in less work, to just compile the sources than to
install a precompiled binary, but if you must: try
http://smc.vnet.net/solaris_2.5.html.

> jmahtani@hotmail.com and not to dejanews. Waiting for a response. Thanks.
> Jeetandra

post here, read here.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.       | cynical. It's perfectly easy  to be
NSW, Australia                      | cynical.


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

Date: Mon, 03 Nov 1997 16:23:50 -0800
From: "Vernon E. Peets" <vernon.peets@beasys.com>
Subject: NT/ Reading command output
Message-Id: <345E6B16.7D4F@beasys.com>

I'm converting a script from Unix to NT, in it several external
commands are used but the output is not being picked up on NT.

  $command = "ver";
  $val = "";
  #
  # debug lines
    print STDERR "==============================\n";
    print STDERR "$command\n";
  #
  open( TF, "$command | ") || die "could not open command output $!";
  while ( $stf = <TF> ) {
    #
    # debug line
      print STDERR "                $stf";
    if ( $val eq "" ) {
        $val = $stf;
    }
  }
  close TF;
  chop $val;
  print "$command YIELDS $val\n";

Any thoughts?

Vern.


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

Date: Tue, 04 Nov 1997 22:24:06 -0800
From: Todd Reichert <tr7488@swbell.net>
Subject: pattern matching options
Message-Id: <34601106.24AF@swbell.net>

Does anyone know if you can substitute a variable for a pattern matching
option?  For example:

$OPTION = "i";
$word = "welcome";
$expr = "com";
if ( $word =~ /$expr/$OPTION) { print $word; } 

HELP!!!!!!!


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

Date: 04 Nov 1997 18:44:49 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: Re: Perl "Here" document and formatting tabs
Message-Id: <waalnz4ys7y.fsf@am.UCSC.EDU>

"Phil R Lawrence" <prl2@lehigh.edu> writes:
> I am using the Perl "Here" document to jump into sqlpus for Oracle and do a
> quick "blah:"
> 
> 	system <<"!";
> sqlplus $uname/$upass
> blah;
> blah;
> exit
> !

I don't think this is what you want to do at all.  The << operator
doesn't behave the same in Perl as in the shell.  What you are doing
is exactly equivalent to this:

	system("sqlplus $uname/$upass\nblah;\nblah;\nexit\n");

which the shell will probably treat the same as:

	system("sqlplus $uname/$upass blah; blah; exit");

which is not quite right --- the "blah" stuff should be input to
sqlplus, not part of its command line.  You probably should use
something like this instead:

	open (SQLPLUS, "|sqlplus $uname/$upass") or
	    die "Can't run sqlplus: $!\n";
	print SQLPLUS <<"!";
		blah;
		blah;
		exit
!
	close SQLPLUS or die "Error closing sqlplus: $!\n";

Assuming sqlplus doesn't mind leading tabs on each line, that will
work, but the ! still needs to be at the beginning of the line.  You
could do one of these instead, to format it nicer:

	print SQLPLUS "blah;\nblah;\nexit\n";
or
	print SQLPLUS "blah;
		blah;
		exit
		";
or
	print SQLPLUS ("blah;\n",
		       "blah;\n",
		       "exit\n"
		       );

[snippety-doo-dah]
> PS, where could I include the "bit bucket" in the perl "Here" document to
> discard any errors generated by sqlplus?

Add ">/dev/null 2>&1" after $uname/$upass.

HTH.

--Bill.

-- 
William R Ward          Bay View Consulting   http://www.bayview.com/~hermit/
hermit@bayview.com     1803 Mission St. #339        voicemail +1 408/479-4072
hermit@cats.ucsc.edu  Santa Cruz CA 95060 USA           pager +1 408/458-8862


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

Date: Tue, 04 Nov 1997 18:42:24 -0600
From: HChicowitz@aol.com
Subject: Perl file sort
Message-Id: <878688921.6101@dejanews.com>

I am trying to sort an ASCII file delimited with "|" on the second field
in the record.	I can read the file into a 2-dimensional array, but that
is as far as I can get.  I can't seem to get the sort function to sort it
properly for me in the second field.  Any suggestions?

Thanks,

 - hmc

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 4 Nov 1997 21:36:19 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl file sort
Message-Id: <jjpo36.8s2.ln@localhost>

HChicowitz@aol.com wrote:
: I am trying to sort an ASCII file delimited with "|" on the second field
: in the record.	I can read the file into a 2-dimensional array, but that
: is as far as I can get.  I can't seem to get the sort function to sort it
: properly for me in the second field.  Any suggestions?
  ^^^^^^^^

"properly" is different for strings than for numbers, and you haven't
shared with us what is in the second field.

Since you didn't say (or even provide any sample data to work on, not good),
we get to choose either one.

I choose string compares  ;-)


Pretty darn inefficient, I wouldn't use this on a hefty sized list.

See the entry for sort() in the perlfunc man page (but you surely have
already done that because you wouldn't post a question without
checking the docs first anyway)


------------
foreach ( sort by_second_field @ra ) { print; }

sub by_second_field {
   my $a2 = (split /\|/, $a)[1];
   my $b2 = (split /\|/, $b)[1];

   return $a2 cmp $b2;
}
------------


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Tue, 04 Nov 1997 23:54:43 GMT
From: kktan@concentric.net (Kim)
Subject: Re: running remote shelll under suid perl script ?
Message-Id: <63oco7$n3s@examiner.concentric.net>

I did use $ENV{'PATH'}.. in my original script, the problem I see is not the 
syntax, it is the way the suidperl works. The same script works fine with
Solaris, but gave error when ran under HP-UX with suidperl (i.e. -T switch).


In article <lq1oh41hy62.fsf@bmerhe83.nortel.ca>, Mark Mielke <markm@nortel.ca> 
wrote:
>comdog@computerdog.com (brian d foy) writes:
>
>> In article <345E9C65.5A7B223B@nectar.com.au>, Justin Wills
> <justin@nectar.com.au> wrote:
>> >try %ENV{'PATH'}
>> okay.
>>    #!/usr/bin/perl -w
>>    %ENV{'PATH'} = '/dev/null';
>>    __END__
>>    # Can't use subscript on hash deref, near "'PATH'}"
>>    # (Did you mean $ or @ instead of %?)
>>    # Execution of x aborted due to compilation errors.
>> 
>> darn.  i thought i was going to do something cool! ;)
>
>You could try using $ENV{PATH}... :-) (as opposed to %ENV{PATH})
>This _is_ included in the error. (Did you mean $ or @ instead of %?)
>
>hope this helps,


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

Date: 5 Nov 1997 04:44:45 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Seeking Year 2000 checker OR comment stripper for C/C++
Message-Id: <slrn65vuhl.kcu.abigail@betelgeuse.wayne.fnx.com>

Eric Buckley (Eric.NoSpam.Buckley@edwardjones.com) wrote on 1526
September 1993 in <URL: news:345F7B57.41C8@edwardjones.com>:
++ Bob Weissman wrote:
++ 
++ <snip>
++ 
++ > If such a beast does not exist, I'd be happy with a script which simply
++ > removes all comments from C and C++ source, including multi-line
++ > comments.  Then I could code the rest myself, but I'm not enough of a
++ > perl wiz to know how to strip multi-line comments.
++ 
++ Why not just write it in C? A simple finite state machine does quite
++ nicely.

Yup, but your program doesn't. Regex use FSM's too, and they are
a hell lot easier to write a FSM.



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^(11+?)\1+$/'


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

Date: Wed, 5 Nov 1997 01:45:58 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: signal handling
Message-Id: <EJ5GwM.8FA@bcstec.ca.boeing.com>

In article <345F736D.1DA13D32@nortel.SPAM.THIS.ca>,
Ben Newman  <benneman@nortel.SPAM.BUSTER.ca> wrote:
>
>I have an application which relies on signals from a child process for
>asynchronous event notification.
>The parent process is only ever interrupted while in a loop. I can
>successfully catch the signals (verified
>by putting die/print statements in the signal handling routines) but I
>can't get the code in reset to execute.
>
>Anyone know what's going on?
>
>sub catchSigUsr1 {
>
>    reset();
>
>}
>
>sub catchSigUsr2 {
>
>    reset();
>
>}
>
>sub reset {
>
>    print "Resetting...\n";
>    sleep(2);                          # give everything a chance to
>settle down
>    print ($cmd = "stat off\n");
>    print CSMWTR $cmd;
>    print ($cmd = "stat calib\n");
>    print CSMWTR $cmd;
>    $rate = $rate * 0.95;        # slow things down by 5%
>    print "Restarting at new rate $rate\n";
>    $adjRate = 3600/$rate;
>    return;
>}
>
>$SIG{USR1} = \&catchSigUsr1;
>$SIG{USR2} = \&catchSigUsr2;
>
>

Non reentrant I/O functions such as print should be avoided  
in the signal handler. Even a sleep may be problematic 
if there's another concurrent signal. 

The block eval {}; mechanism is the best way to go. See
pg. 337 Blue Camel. or man perlipc.


HTH,
--
Charles DeRykus


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

Date: 04 Nov 1997 21:20:35 -0500
From: Tim Gray <tim@hcirisc.cs.binghamton.edu>
Subject: SybPerl or Win32::ODBC for use with ISAPI on NT?
Message-Id: <t0n2jkf5e4.fsf@hcirisc.cs.binghamton.edu>

I need to port several sybperl CGI scripts from UNIX to NT.  Does
anyone have experience using sybperl for NT along with the ISAPI perl
from activestate?  Do they work well together?  I would prefer to use
sybperl since that would mean fewer code changes, but if there are
advantages to ODBC I would consider it.  I am used to working with
arrays of array references as return by the sybperl sql() method and
it seems like doing a FetchRow() for every row of data would be less
efficient.  Also I have to do comparisons from one row to the next so
the single array is very convenient.  I have read the Win32::ODBC
readme and FAQ.  Any suggestions, including further reading material,
are welcome.  Thanks.

Tim Gray


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

Date: Wed, 5 Nov 1997 01:01:42 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: waiting for forks
Message-Id: <EJ5Euu.5tt@bcstec.ca.boeing.com>

In article <345FA18A.FE5E852E@earthlink.net>,
matthew rinella  <mrinella@earthlink.net> wrote:
 >    I want my perl script to run a large list of child processes, but
 >only have  2 running at any given time.
 >
 >

Launch 2 initially from the list. Launch another each time a 
process is reaped until process list is empty.

Implementation is left as an exercise for the reader :)


HTH,
--
Charles DeRykus


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

Date: 05 Nov 1997 02:02:34 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Your opinion on The Perl Journal (TPJ) ?
Message-Id: <ORWANT.97Nov4210234@fahrenheit-451.media.mit.edu>


Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:

   ! The Perl Journal seems to be the only magazine dedicated to
   ! Perl.  I went to its website, read some reviews and it looks
   ! to me like a fine journal except for the fact that it's
   ! published only 4 times a year (quarterly).

   that it is only published quarterly is my only complaint :-)

If I were to publish every month, my costs would triple.  More than
triple, because I'd have to hire someone to help me with production.
I'd have to triple the subscription price, so quarterly it stays.  
For now.

Magazines typically get the bulk of their revenue through ad sales;
Perl, being a free language with mostly free utilities, doesn't
provide a lot of ad fodder.  So not much money flows in that way.
(And big thanks to all the advertisers for their support, particularly
ActiveState, The Perl Clinic, and especially O'Reilly.)

But as Perl grows, TPJ subscriptions will increase.  The number of
readers (about 5000) is approaching the point where "general purpose"
computer ads (e.g. ads for Oracle or Dell) start to become viable,
rather than niche ads (e.g. ads for Perl jobs or commercial Perl
software).  When that happens, more money will flow in, and I'll be
able to hire the production staff that I need to produce TPJ with
higher frequency, and I'll be able to pay for the hot-set press,
glossy paper, and heavier use of color that mainstream ads require.

That's my plan, anyway.  I'll certainly move to bimonthly en route to
monthly.

   [snip...]

   the cover of issue 4 volume 1   :-)

   uh oh...that reminds, I forgot to renew my subscription :-(
   gripe #2, they only send one reminder and my memory hasn't
   been the same 'since the accident'! Sure hope I'm not too late
   to restart with the fall issue!

Duly noted.  I'll try to do better in the future -- but at some point
too-frequent reminders become spam (whether email or postal).  Anyway,
Real Magazines contract this out with a "subscription fulfillment
service," and I'll get me one o' those just as soon as I can.  

-Jon

------------------------------------
Jon Orwant            http://tpj.com
Editor & Publisher, The Perl Journal



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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1272
**************************************

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