[8169] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1787 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 2 11:18:51 1998

Date: Mon, 2 Feb 98 08:00:29 -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           Mon, 2 Feb 1998     Volume: 8 Number: 1787

Today's topics:
    Re: 5 REAL languages (was: Re: AOL SPAM) <jdporter@min.net>
    Re: Bidirectional open2 and buffered output... (Andrew M. Langmead)
    Re: Can PERL test for a process? (Jeff Stampes)
        Converting date to UTC format <pdikant@mgm-edv.de>
    Re: Converting date to UTC format <xxTony.Curtis@vcpc.univie.ac.at>
    Re: daemonizing -- value of setpgrp()? <jdporter@min.net>
        Date (month) sensing <norman.bunn@mci.com>
    Re: Date (month) sensing <xxTony.Curtis@vcpc.univie.ac.at>
    Re: Date (month) sensing <tchrist@mox.perl.com>
    Re: dc.pm.org <jdporter@min.net>
    Re: Decent Perl books <vchandra@mail.delcoelect.com>
    Re: Decent Perl books (Gabor)
    Re: difficulty running perl programs over the web <barnett@houston.Geco-Prakla.slb.com>
    Re: Help:  Testing a CGI script locally/Path to browser (Steve Linberg)
        html tags <benefits@cybertechs.com>
    Re: I'ready to pay (Steve Linberg)
    Re: Looking for a search script for NT (Steve Linberg)
        Looking Vor Binary Compiler <egonzalez@rpimail.mdacc.tmc.edu>
        newbie Q:create a subset <honr@ms.com>
    Re: OLE doesn't work (Chip Salzenberg)
        Q: What is the good way to process data like... dajen@globespan.net
    Re: random number generator? (Steve Linberg)
    Re: random number generator? (Mike Stok)
    Re: s/// Usage Problems (Andrew M. Langmead)
    Re: solution for multiline comments??? (Bjvrn Nilsson)
    Re: solution for multiline comments??? (Andrew M. Langmead)
    Re: Top 500 Posters to rasfw - Long (23k) (John Moreno)
    Re: TYP21D (was: substitute...) (Dave Till)
    Re: TYP21D (was: substitute...) (Dave Till)
    Re: Using -w <barnett@houston.Geco-Prakla.slb.com>
    Re: When was perl created? <barnett@houston.Geco-Prakla.slb.com>
    Re: When was perl created? (Clay Irving)
    Re: Windows NT perl mail command (Steve Linberg)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 02 Feb 1998 09:57:33 -0500
From: John Porter <jdporter@min.net>
To: Sitaram Chamarty <sitaram@diac.com>
Subject: Re: 5 REAL languages (was: Re: AOL SPAM)
Message-Id: <34D5DEDD.4776@min.net>

Sitaram Chamarty wrote:
> 
> >Where does perl fall into that list?

Exactly. Perl isn't IN the list, it CONTAINS the list.

> One ring to hold them all
> One ring to find them
> One ring to (I forgot)
> And in the darkness bind them

  One ring to RULE them all
  One ring to find them
  One ring to BRING them all
  And in the darkness bind them

If I forget the English, I just recall the Black Speech
and translate...

John Porter


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

Date: Mon, 2 Feb 1998 15:17:38 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Bidirectional open2 and buffered output...
Message-Id: <EnrBtE.402@world.std.com>

Chris Schoenfeld <chris@ixlabs.com> writes:

>I am flushing these handles every way I knwo how and nothing seems to
>help.
[stuff deleted]
>my $pid = open2($rdr,$wtr,'squake -dedicated 2 -udpport 26200');


># Unbuffer everything every way I know how.
>$rdr->autoflush();
>$wtr->autoflush();
>autoflush STDOUT 1;
>autoflush $rdr 1;
>autoflush $wtr 1;

You can't flush a filehandle opened for reading. If the source of the
data has not supplied your program with anything yet, there is nothing
your program can do to force it to do so. I'm guessing the problem
lies in the squake program and its output buffering.

By default, most stdio libraries line buffer data when the output
device is a terminal, but block buffer output when it isn't. (and
obviously, a pipe isn't a terminal.)

Take a look at this example, reading the output of another perl
program. The example takes one optional argument, that if true, sets
the child perl process to line buffer its output[Footnote 1],
otherwise it uses the default buffering of the stdio library.


#!/usr/bin/perl -w

# usage: buffertest [buffering_arg]

$buffer = shift @ARGV || 0;
$bufferarg = ($buffer ? '$| = 1' : '');

open COUNT, qq#perl -le '$bufferarg;for(0..10) {print;sleep 1;}'|# or die;

while(<COUNT>) {
  print "at ",time() - $^T, "secs. : received: $_";
}

Now lets take a look at the output:

~/tmp>perl buffertest 1
perl buffertest 1
at 0secs. : received: 0
at 1secs. : received: 1
at 2secs. : received: 2
at 3secs. : received: 3
at 4secs. : received: 4
at 5secs. : received: 5
at 6secs. : received: 6
at 7secs. : received: 7
at 8secs. : received: 8
at 9secs. : received: 9
at 10secs. : received: 10
~/tmp>perl buffertest 0
perl buffertest 0
at 11secs. : received: 0
at 11secs. : received: 1
at 11secs. : received: 2
at 12secs. : received: 3
at 12secs. : received: 4
at 12secs. : received: 5
at 12secs. : received: 6
at 12secs. : received: 7
at 12secs. : received: 8
at 12secs. : received: 9
at 12secs. : received: 10
~/tmp>

See, the example program didn't change how it was reading the child
process, but the results differed depending on how the child did its
buffering.

If this is the problem, and the writing program does not allow any
method of changing its buffering characteristics, then the common
solution is to use psuedo terminals instead of pipes to transfer data
between the processes. The writing processes (and the stdio library it
is probably based on) will see the pty as a terminal and line buffer
its data. See <URL:http://www.perl.com/CPAN-local/modules/by-module/
Comm.pl/ERICA/Comm.pl-1.8.tar.gz> for a library for working with ptys.

[Footnote 1] We're really setting the child process to "command
buffer", not "line buffer". Data will be flushed at the end of each
output function line "print". Since we are only print()ing once for
each line, the result is the same.
-- 
Andrew Langmead


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

Date: 1 Feb 1998 23:37:28 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: Can PERL test for a process?
Message-Id: <6b30vo$df$1@neocad.com>

Michael Wang (mwang@alhena.ibk.ml.com) wrote:
: I just wonder which of the following:
: open(PS, "/usr/bin/ps -ef |") ; # use filehandle
: @PS = `/usr/bin/ps -ef` ;       # save the output to an array

: is "better", or faster. Thanks. 

stampes@huckin [4] more timeit
#!/usr/local/bin/perl -w 
 
use Benchmark;
 
$t0 = new Benchmark;
open(PS, "/usr/bin/ps -ef |") or die "Couldn't open process: $!";
@PS = <PS>;
close PS;
$t1 = new Benchmark;
$td = timediff($t1,$t0);
print "Filehandle took ",timestr($td),"\n";
$t0 = new Benchmark;
@PS = `/usr/bin/ps -ef`;
$t1 =  new Benchmark;
$td = timediff($t1,$t0);
print "Backticks took ",timestr($td),"\n";
 
stampes@huckin [5] timeit
Filehandle took  0 secs ( 0.00 usr  0.01 sys +  0.06 cusr  0.02 
csys = 0.09 cpu)
Backticks took  0 secs ( 0.00 usr  0.00 sys +  0.05 cusr  0.03 
csys =  0.08 cpu)

--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Mon, 02 Feb 1998 15:19:44 +0100
From: Peter Dikant <pdikant@mgm-edv.de>
Subject: Converting date to UTC format
Message-Id: <34D5D600.B3ADDF2A@mgm-edv.de>

Hello,

I am looking for a way to convert a date string into UTC format.
Example:
"Oct 1 00:00:01 1997" should become 875656801.

Thanks
  Peter

----------------------------------------------------
Peter Dikant            pdikant@mgm-edv.de
MGM EDV-Beratung GmbH   http://www.mgm-edv.de
Frankfurter Ring 105a   Tel:    +49 (89) 35 86 80 19
80807 Muenchen          Fax:    +49 (89) 35 86 80 88




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

Date: 02 Feb 1998 15:36:37 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Converting date to UTC format
Message-Id: <7xn2gavzt6.fsf@beavis.vcpc.univie.ac.at>

Re: Converting date to UTC format, Peter
<pdikant@mgm-edv.de> said:

Peter> Hello, I am looking for a way to convert a date
Peter> string into UTC format.  Example: "Oct 1 00:00:01
Peter> 1997" should become 875656801.

check the "Date" modules (e.g. DateCalc and Manip) on CPAN

hth,
tony


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

Date: Mon, 02 Feb 1998 10:46:14 -0500
From: John Porter <jdporter@min.net>
Subject: Re: daemonizing -- value of setpgrp()?
Message-Id: <34D5EA46.5517@min.net>

Chip Salzenberg wrote:
> 
> According to jdporter@min.net:
> >setpgrp() seems to be a BSD-oriented function, which means that it is
> >undependably available on SysV systems, such as Solaris.
> 
> Actually, that's not quite true.  SysV systems have setpgrp(), but it's
> a version with no parameters, unlike the BSD function of the same name
> (which was a STUPID thing for the BSD people to do! but I digress).

ok.  I guess David Curry (Lion book, p. 320) has it slightly wrong.

John Porter


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

Date: Mon, 02 Feb 1998 14:42:11 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: Date (month) sensing
Message-Id: <7XkB.601$U4.798607@news.internetMCI.com>

I need to add some functionality to a PERL program that I have inherited.  I
am not very PERL literate, so bear with me.

I need to create a new output file monthly, so if it's the same month I want
to append to an existing file and if it's a new month I want to create a
file.

This should be fairly straight forward, but the on-line doc doesn't go into
detail on how PERL handles dates.

Thanks,

Norman




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

Date: 02 Feb 1998 15:52:33 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Date (month) sensing
Message-Id: <7x1zxm12ku.fsf@beavis.vcpc.univie.ac.at>

Re: Date (month) sensing, Norman <norman.bunn@mci.com> said:

Norman> I need to create a new output file monthly, so if
Norman> it's the same month I want to append to an existing
Norman> file and if it's a new month I want to create a
Norman> file.

Look at the doc. for the POSIX module, specifically
`strftime' and `localtime'.

hth,
tony


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

Date: 2 Feb 1998 15:15:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Date (month) sensing
Message-Id: <6b4ntk$g2k$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, "Norman Bunn" <norman.bunn@mci.com> writes:
:I need to create a new output file monthly, so if it's the same month I want
:to append to an existing file and if it's a new month I want to create a
:file.

    ($month, $year) = (localtime)[4,5];
    $dir  = '/path/to/logdir/';
    $file = sprintf('%4d%02d.log', 1900+$year, 1+$month);
    $path = "$dir/$file";
    open(OUTLOG, ">>$path") || die "can't append to $path: $!";

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
Spouse, n.:
        Someone who'll stand by you through all the trouble you
wouldn't have had if you'd stayed single.


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

Date: Mon, 02 Feb 1998 10:47:27 -0500
From: John Porter <jdporter@min.net>
Subject: Re: dc.pm.org
Message-Id: <34D5EA8F.7D09@min.net>

Philip Hood wrote:
> 
> If New York has and LA and Boston are gonna have
> organized perl'ers, DC needs to have some as well!

Let's Do It !!!

John Porter -- casting my vote


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

Date: Mon, 02 Feb 1998 08:49:06 -0500
From: "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
Subject: Re: Decent Perl books
Message-Id: <34D5CED2.7E2@mail.delcoelect.com>

Chris Heiden wrote:
> 
> Hello there,
>     I am new to the Perl community.  I was wondering if any of you could
> recommend any books as tutorials and reference to Perl.  I already have
> two from Learning Perl and Learning Perl on Win32 systems from O'reilly
> and Associates.  I just wanted to see what everyone out there with
> actual experience with some books had to say.
> 
> Chris

I just started reading the blue Camel [Programming Perl Sept. 1996
edition] book. It is a lot of fun to read.

V.Chandrasekhar


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

Date: 2 Feb 1998 14:07:46 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Decent Perl books
Message-Id: <slrn6dbkht.lq1.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Chris Heiden <cmheiden@mtu.edu> wrote :
# Hello there,
#     I am new to the Perl community.  I was wondering if any of you could
# recommend any books as tutorials and reference to Perl.  I already have
# two from Learning Perl and Learning Perl on Win32 systems from O'reilly
# and Associates.  I just wanted to see what everyone out there with
# actual experience with some books had to say.
# 
# Chris
# 

perldoc perlfaq2

gabor.
--
    I won't mention any names, because I don't want to get sun4's into
    trouble...  :-)
        -- Larry Wall in <11333@jpl-devvax.JPL.NASA.GOV>


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

Date: Mon, 02 Feb 1998 08:47:52 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: difficulty running perl programs over the web
Message-Id: <34D5DC98.72E4AE8D@houston.Geco-Prakla.slb.com>

Asia-Net wrote:
> 
> Hi there...
> 
> We can't get perl5 to work the way we think it ought to... probably our lack
> of knowledge about the package, but...
> 
> We have a perl script called "dev-add.cgi" which runs correctly from the
> command line, complete with the extra perl HTML encoding of the output.
> The perms & ownership are just like the other (working) CGIs, which are
> all either shellscripts or binary executables.However, when we run it over
> the web, we get a "server error".
> 
> Does anyone have any ideas that might lead to a solution?
> 
> Thanks.
> 
> Aaron Brick.
Lots of ideas, but are any of them relevant....

Is your server set up properly?
Are your scripts in the correct location?
What do your server docs tell you?

How about the error message from your server log?
How about a copy of the script itself?

How about asking in a newsgroup dedicated to cgi?
How about asking in a newsgroup dedicated to your web server?

>From the sound of it, the script is okay, so I suspect that it is your
setup that is lacking.

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Mon, 02 Feb 1998 09:02:16 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Help:  Testing a CGI script locally/Path to browser
Message-Id: <linberg-0202980902160001@projdirc.literacy.upenn.edu>

In article <lgstarr-0102981849470001@ip34-218.bur.primenet.com>,
lgstarr@primenet.com (Linda Starr) wrote:

> What is the path (action = "......../cgi-bin/mydoc.pl") to the browser if
> I am testing CGI scripts locally in WIN 95 and a Mac

This depends on your servers, and how you have configured them.  Please
check your documentation there.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: Sun, 01 Feb 1998 15:45:47 -0500
From: Jason Boxman <benefits@cybertechs.com>
Subject: html tags
Message-Id: <34D4DEFB.20E@cybertechs.com>

I have a script which strips all text in between HTML tags except
spaces. I use following code, which causes an exception error on some
files.

$tester =~ s/(>)(\s)?([^<])*?(\s)?(<)/\1\2\4\5/g;

Is there a better way to preserve the HTML tags and at least one space
in between each tag (if there are any) that will not cause an exception
error on occasion? I appreciate any help you can give me, thanks!

Jason Boxman
benefits@cybertechs.com


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

Date: Mon, 02 Feb 1998 09:03:13 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: I'ready to pay
Message-Id: <linberg-0202980903130001@projdirc.literacy.upenn.edu>

In article <6b440i$oim@everest.vol.it>, "Cristiano" <meetserv@tin.it> wrote:

> I really need a cgi scpript wrote in perl lang.
> 
> Who is able to work ASAP for my need  come alive.........(please)

You might want to post a little more information about the job.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: Mon, 02 Feb 1998 08:59:09 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Looking for a search script for NT
Message-Id: <linberg-0202980859090001@projdirc.literacy.upenn.edu>

In article <34D4E743.6EC82CAD@erols.com>, "Abigael L. Anthony"
<roseala@erols.com> wrote:

> I'm looking for a good search script for windows NT? Something to put on
> my web page so visitors can search the site.

If you're doing text-based searches, you shouldn't need anything
NT-specific.  HotWired did a sample Perl search engine a year or two ago -
head to www.hotwired.com and look for it.

Good luck, and share your solutions.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: Mon, 02 Feb 1998 08:56:34 -0600
From: Eddie Gonzalez <egonzalez@rpimail.mdacc.tmc.edu>
Subject: Looking Vor Binary Compiler
Message-Id: <34D5DEA1.3CEA0097@rpimail.mdacc.tmc.edu>

I am about to install Perl and need a compiler.  I need a binary
compiler to download
for free because there is no current compiler for the server.  Thanks...



Eddie Gonzalez
M.D. Anderson Cancer Center
egonzalez@rpimail.mdacc.tmc.edu




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

Date: Mon, 02 Feb 1998 10:35:33 -0500
From: Raghu Hon <honr@ms.com>
Subject: newbie Q:create a subset
Message-Id: <34D5E7C5.74D9F20E@ms.com>

hi! 
If I have Arrays  @A and @B
How do I create an subset(or delta array)  @C, 
where in @C should contain elements which are 
in @A but Not in @B.
thanks,
-Raj
-----------------------------------------------

I was trying this , but does not seem to work.
any hints please. thanks

%old = @old = @B;
%deltaD = @deltaD = ();

$ct=1;
foreach (@A) 
{
       push(@deltaD,$_) unless $old{$_}++;

	print "DELTA[$ct1]: @deltaD[$ct]\n ";
	$ct = $ct +1;
}

@C = sort keys %deltaD;

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


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

Date: Mon, 02 Feb 1998 14:41:45 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: OLE doesn't work
Message-Id: <6b4m1p$nu9$1@cyprus.atlantic.net>

According to "Michael Sazonov" <mike@inforis.ru>:
>Chip Salzenberg wrote in message ...
>>Sample code would help.
>
>use OLE;
>$excel = CreateObject OLE 'Excel.Application'
> or warn "Couldn't create new instance of Excel App!!";
>$excel->Workbooks->Open( 'test.xls' );
>$excel->Workbooks(1)->Worksheets('Sheet1')->Cells(1,2)-
>>{Value} = 'foo';
>$excel->Workbooks(1)->Worksheets('Sheet1')->Cells(1,2)-
>>{Value} = 'bar';
>$excel->Save();
>$excel->Quit();
>
>is very simple and produces the same error:
>
>Can't call method "Open" without a package or object
>reference at oletest.pl line 4.

Apparently the Workbooks method does not return a blessed object when
called without parameters.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Mon, 02 Feb 1998 07:51:06 -0600
From: dajen@globespan.net
Subject: Q: What is the good way to process data like...
Message-Id: <886426896.2129133574@dejanews.com>

Hi all,

Can anyone tell me what is the best way in Perl to text process a
data structure like the following? If there is a Perl module for this
use is the best. My intend is to read in a source file like the one
below and output to a totally different format (translator).

thanks in advance!

################## example ########
Header(
  Library("my_lib")
  version("1.0")
  ...
)
timing_props(
  proc_var(1.0:1.0:1.0)
  volt_mult(1.0)
)
cell(ram
  celltype(seq)
  // this is a comment line. Another way is to use /* */
  model(delay0
    (spline
       (load_axis 0.1 0.2)
       (input_slew_axis 1.0 2.0)
       ((1.01 2.01)      // multi-D array
       (3.01 4.01)
       )
     )
  )
  model(slew0
     ...
     ...
  )

  pin(a_lat[7:0] pintype(data) \
          timing_props(load_limit(warn(0.1) error(0.2)))

  path(clk *> dout 01 01 DELAY(delay0) SLEW(slew0))
  ...
)




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


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

Date: Mon, 02 Feb 1998 09:04:06 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: random number generator?
Message-Id: <linberg-0202980904060001@projdirc.literacy.upenn.edu>

In article <34D5A8A6.7EE169F7@stro5.vub.ac.be>, Prasad Alavilli
<prasad@stro5.vub.ac.be> wrote:

> Hello,
> 
> I am looking for a reasonable/good random number generator
> for use with Perl.
> Please send me any information on this.

Perl 5.004 has a good one built-in (rand, srand).  Consult the
documentation.  You can also look at the TrulyRandom module on CPAN.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

Date: 2 Feb 1998 09:39:54 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: random number generator?
Message-Id: <6b4lrq$ki$1@stok.co.uk>

In article <34D5A8A6.7EE169F7@stro5.vub.ac.be>,
Prasad Alavilli  <prasad@stro5.vub.ac.be> wrote:
>Hello,
>
>I am looking for a reasonable/good random number generator
>for use with Perl.
>Please send me any information on this.

If you have discounted the srand & rand builtins which are perl's calls
around the C library functions of the same name and documented in the
perfunc manual page then you might want to look at the Math::TrulyRandom
module on CPAN in  .../modules/by-category/06_Data_Type_Utilities/Math
(CPAN is the comprehensive perl archive network, you can get to it by
browsing http://www.perl.com or by ftp-ing to ftp.funet.fi and looking
under /pub/languages/perl/CPAN which also contails a list of ftp mirror
sites)  Another random number module on CPAN is the Math::PSRG.

If that's not good enough you might want to check out the supplied
documentation which allows you to extend perl by building modules which
can call C routines, the perlembed manual page suggests:

     Do you want to:

     Use C from Perl?
          Read the perlcall manpage and the perlxs manpage.

and section 7 of the FAQ has some useful pointers too.  These let you taks
a C random number generator and call it from perl, so you can pick from
many published random number algorithms and get the speed and randomness
you want.

All of the discussion of modules assumes that you're using a recent perl.

Other apporaches include using /dev/random if you're on a system which
supports it.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Mon, 2 Feb 1998 15:25:57 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: s/// Usage Problems
Message-Id: <EnrC79.A73@world.std.com>

Bruce Hodo <bruceh@interaccess.com> writes:

>I'm guessing that I'm not doing something properly, but I can't figure
>out what. Here is my code:

>$query = new CGI('');
>     @record = split(/;/,$record);
>     foreach (@javadbfieldname) {
>          my $field = shift(@record);
>          $field =~ s/'/\'/g;
>          my $paramset = '$query->param(-'."$_=>'$field')";
>          eval $paramset;
>     }

Are you sure that $field contains what you expect it to? How about
$paramset? Have you checked it in the debugger to make sure?

Are you sure you can't replace the eval() with

$query->param("-$_" =>$field);

-- 
Andrew Langmead


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

Date: Mon, 02 Feb 1998 15:19:50 +0100
From: s93bni@csd.uu.se (Bjvrn Nilsson)
Subject: Re: solution for multiline comments???
Message-Id: <s93bni-ya02408000R0202981519500001@snews.zippo.com>

Hi again!

Sorry about the unclarity (silly me).

I want to add a few and sometimes a lot of comment lines, something like
the following:

#!/usr/bin/perl
# First line of comments talking about the intention of the program
# second line, rambling on
# third line bla bla bla
# and so on...
 ...
# last line of big block of comments

use Date::Manip;
use CGI;

 ...
and so on.

Bjvrn (writing this from my home computer, hence the different posting address)


In article <34D5CAB2.24BD78E2@fccj.cc.fl.us>, bill@astro.fccj.cc.fl.us wrote:

> Are you trying to ADD comments or REMOVE comments?
> 
> ??? Bill
> 
> 
> 
> Bjvrn Nilsson wrote:
> > 
> > Hi all!
> > 
> > Has anyone figured out how to in a convienient way do mulitline comments
> > a la C, Java etc.
> > OK, I know that one solution is to write a perl snippet that looks for
> > some special tags (e.g. startcomm and endcomm) and than comment
> > everything out in between those lines.
> > 
> > But is there some kind of simpler solution, where I don't have to
> > process a script with a script?
> > 
> > Bjvrn


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

Date: Mon, 2 Feb 1998 15:32:12 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: solution for multiline comments???
Message-Id: <EnrCHo.ED3@world.std.com>

"Bjvrn Nilsson" <bjorn.w.nilsson@edt.ericsson.se> writes:

>Hi all!

>Has anyone figured out how to in a convienient way do mulitline comments
>a la C, Java etc.

People have, and to prevent the question from being asked over and
over agin, they put it into the FAQ.


       How can I comment out a large block of perl code?
 
       Use embedded POD to discard it:
 
           # program is here
 
           =for nobody
           This paragraph is commented out
 
           # program continues
 
           =begin comment text
 
           all of this stuff
 
           here will be ignored
           by everyone
 
           =end comment text
 
           =cut

-- 
Andrew Langmead


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

Date: Mon, 2 Feb 1998 09:24:40 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Top 500 Posters to rasfw - Long (23k)
Message-Id: <1d3tepe.1izhpmo1d85e6cN@roxboro0-019.dyn.interpath.net>

This is a *bit* off topic here in rasfw, but I'm posting it anyway
(anything to get my numbers up).  But I am cross posting it to clpm and
setting followups there.

Gary J. Weiner <webmaster@austin-williams.com> wrote:

> John Moreno wrote:
> > 
> > William George Ferguson <frgsn@primenet.com> wrote:
> 
> > 
> > > As a matter of idle curiousity, how does your script sort within the
> > > same count of posts?  Obviously not alpha by username; does it sort by
> > > earliest posting date, perhaps?
> > 
> > It doesn't.  I didn't even bother figuring out what the username is,
> > just the address.
> 
> Would you mind posting the code?

No, I don't mind (at the least it'll keep me from loosing it again), but
because I use Netscape for doing the actual connection to dejanews, it's
not exactly portable - it's Mac specific.

Also, the regex I use for getting the email address isn't perfect as it
doesn't take into account any comments within the address.  This code
also has a loop used to waste time while Netscape gets and saves the
statistics - it might not be necessary and if it is necessary it might
not need to be so high, I first used 3200 and by the time it got to the
200th email address the script was 50 lines ahead of Netscape, but
Netscape handled this just fine - at which point I saw that I had made a
mistake so that I was only getting the statistics for the first person
in the list.  After I fixed that, I was a little worried that the script
would pile up some many commands in advance that Netscape would stop
keeping track - so increased the delay.

This takes a couple of hours to run with 1500 addresses and takes up
about 12 megs of disk space.

open (OTHER, ">Dev:Console:rasfw") || die;
select(OTHER);
$|=1;

$infile='rasf.from2';
# I did some harvesting of rasfw and dumped the results
# into here - one address per line.

$netscape='Netscape Communicator';


$count=0;
open (IN, "< $infile") || die;

while (<IN>) {

m/([^\s<]+@[^\s\r,>]+)/;


$email=$1;
$getauthor='http://x5.dejanews.com/dnquery.xp?search=word&maxhits=1&defa
ultOp=and&site=&query=%7ea%20(phenix@interpath.com)%20%26%20%7eg%20(rec.
arts.sf.written)&svcclass=dnserver&ST=QS';
$getauthor=~s/phenix.+?com/$email/;

#print "$getauthor\n";

$count++;
$Count="$count";
$FileName="0" x (5 - length "$Count")."$count";
$SaveAt="Posters:Profiles:$FileName";

MacPerl::DoAppleScript qq{
    tell application "$netscape"
        GetURL "$getauthor" to "$SaveAt"
        end tell
    };

while ($wastetime<6400) {
$wastetime++;
}

print OTHER "$FileName = $email\n";

}

close IN;


After this is run, I use this to tabulate the results - notice that I
make no attempt to tell do anything with newbie posters who haven't hit
dejanews yet.

open (OTHER, ">Dev:Console:rasfw") || die;
$|=1;

open (OUT, "> Posters:Profile Results") || die;
&MacPerl'SetFileInfo("R*ch","TEXT","Posters:Profile Results");


$infile='rasf.from2';

$nl='
';

$count=0;
open (IN, "< $infile") || die;
while (<IN>) {

$count++;
$t="$count";
$FileName="0" x (5 - length "$t")."$count";
$ItsAt="Posters:Profiles:$FileName";

if (open (PROFILE, "< $ItsAt")) {
undef $/;
$profile=<PROFILE>;
close PROFILE;

$profile=~m/$nl([^$nl]*Match[^$nl]+)/;
$matchline=$1;
print OTHER "Matchline $matchline\n";

$matchline=~m/<B>(\d+)[^-]+for/;
print OUT "$FileName\t$1\t$_";

} 
else {
print OTHER "Couldn't open $ItsAt\n";}

$/="\n";

}

close OUT;


-- 
John Moreno


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

Date: 2 Feb 1998 10:09:19 -0500
From: davet@angel.uunet.ca (Dave Till)
Subject: Re: TYP21D (was: substitute...)
Message-Id: <6b4niv$nui@angel.uunet.ca>

In article <34D2BF6C.5C6B20C1@coos.dartmouth.edu>,
Chipmunk  <rjk@coos.dartmouth.edu> wrote:
>You still haven't gotten it, have you?
>
>Unitialized variables are *not* assumed to contain the null string in Perl.
>(Okay, to be fair, it is assumed, by people such as yourself, who happen
>to be mistaken.)

My point is that, in Perl, you can do this:

# $var is undefined
$var += 3;

and Perl will cheerfully convert undefined to 0, yielding a value
of 3.  I agree that it's not good practice to do this, but you can do
it (if you're willing to ignore the -w warning, of course).

>> In my experience, there aren't all that many cases in which the distinction
>> between "" and the undefined value are important.  Other users' mileage
>> may vary.  (If anyone out there knows of obvious pitfalls that beginning
>> Perl programmers unaware of the distinction between "" and undefined
>> risk falling into, please let me know.)
>
>That's great.  Let's hope that the people who learn Perl from your book never
>need to program something outside the bounds of your own experience.

Since I don't like using undefined variables myself, the examples in the
book always initialize counters to 0 rather than relying on the conversion
of undefined to null string to 0, so I think my readers are safe.


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

Date: 2 Feb 1998 10:12:39 -0500
From: davet@angel.uunet.ca (Dave Till)
Subject: Re: TYP21D (was: substitute...)
Message-Id: <6b4np7$o0h@angel.uunet.ca>

In article <6b0koe$ffb$1@cyprus.atlantic.net>,
Chip Salzenberg <chip@pobox.com> wrote:
>> In my experience, there aren't all that many cases in which the
>> distinction between "" and the undefined value are important.
>
>Programs written without regard for the difference between defined and
>undefined values tend to be vulnerable to misbehavior when strings and
>numbers are given unexpected values ("", "0", 0).  Under these
>circumstances, testing !$x is a false positive, where !defined($x) is
>not.

I should point out that I don't like the idea of referencing undefined
variables either, and that the examples in my book don't do it.  I will
concede that I may not be aware of all of the potential dangers of
referencing undefined variables, but I don't think my readers are
being led down the garden path.


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

Date: Mon, 02 Feb 1998 08:30:45 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Using -w
Message-Id: <34D5D895.5CCB177B@houston.Geco-Prakla.slb.com>

Andrew Spiers wrote:
> 
<snip>
> ________________________________________________________________________________
> 
> Name "TempFile::MAXTRIES" used only once: possible typo at
> c:\perl\lib/CGI.pm line 2845.
> _______________________________________________________________________________
> 
As the message states, the called out variable is used only once.  To
fix this, use the variable in some other way inside the
program, like at the beginning, put "$TempFile::MAXTRIES = 0;" or
similar code.  Any use of the variable (other than in comments) is a
valid use, and will stop the message.

Perl is warning you that you might have made a typo because the variable
was only referenced once.

<snip>
> ________________________________________________________________________________
> 
> Name "Config::Config" used only once: possible typo at
> c:\perl\lib/CGI.pm line 79.
> ________________________________________________________________________________
> 
See above.

<snip>
> ________________________________________________________________________________
> 
> Name "CGI::DEFAULT_DTD" used only once: possible typo at
> c:\perl\lib/CGI.pm line 35.
> ________________________________________________________________________________
>
See above. 
<snip>
> ________________________________________________________________________________
> 
> Name "CGI::DISABLE_UPLOADS" used only once: possible typo at
> c:\perl\lib/CGI.pm line 60.
> ________________________________________________________________________________
> 
See above.

> CGI program command line is 'perl C:/PI3WEB/Cgi-Bin\soccerbanex.pl '.
> 
> The code is as follows :
<snip>
> Any ideas ? Many thanks.

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: Mon, 02 Feb 1998 08:49:41 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: When was perl created?
Message-Id: <34D5DD05.99832C10@houston.Geco-Prakla.slb.com>

Webmaster Of Jonspage wrote:
> 
> Hi,
> I'm doing a project on different programming languages and I want to do
> a time line of the languages...so does anyone know when perl was
> created?
I'm quite sure there is.  ;-)

<extraneously large name snipped>

Have a look at http://www.perl.com

Great place to find anything perl.

HTH.

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


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

Date: 2 Feb 1998 10:03:34 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: When was perl created?
Message-Id: <6b4n86$c6@panix.com>

In <34D53CB1.E57584DC@geocities.com> Webmaster Of Jonspage <jonspage@geocities.com> writes:

>I'm doing a project on different programming languages and I want to do
>a time line of the languages...so does anyone know when perl was
>created?

Er... Have you checked http://www.perl.com?

-- 
Clay Irving <clay@panix.com>                  I think, therefore I am. I think? 
http://www.panix.com/~clay/


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

Date: Mon, 02 Feb 1998 08:55:11 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Windows NT perl mail command
Message-Id: <linberg-0202980855110001@projdirc.literacy.upenn.edu>

In article <886205905.1274019843@dejanews.com>, vzanini@xplore.it wrote:

> I'm quite new in Windows NT CGI programming using Perl. An obstacle I've
> found hard to pass is the following: how can I send some data (for
> example the one coming from an HTML form) via E-Mail? I know I can do
> that in UNIX calling the SENDMAIL shell command. But, there is such a
> command also in Windows NT, or does exist an utility which permit to
> execute this function? If someone has some experience in this field,
> please write me!!! Thank you,  Valerio

There is a Win32-specific FormMail.pm that works fine for me.  See CPAN.

-- 
Steve Linberg                  |    National Center on Adult Literacy
Systems Programmer etc.        |           University of Pennsylvania
linberg@literacy.upenn.edu     |        http://www.literacyonline.org


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

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

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