[11839] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5439 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 21 10:07:28 1999

Date: Wed, 21 Apr 99 07:00:21 -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           Wed, 21 Apr 1999     Volume: 8 Number: 5439

Today's topics:
    Re: Another bug in Perl? (Andrea LN Spinelli)
    Re: Another bug in Perl? <uri@sysarch.com>
    Re: Any visual editor for Perl: Win32? <camerond@mail.uca.edu>
    Re: Any visual editor for Perl: Win32? latsharj@my-dejanews.com
    Re: C directives <uri@sysarch.com>
        re: CGI programmer wanted <droby@copyright.com>
        EOF on pipe <scru@rdovira.lviv.ua>
    Re: Headers posted from forms <vvb@ibm.net>
    Re: How can I execute non cgi PERL script under NT? <vvb@ibm.net>
    Re: How to determine if a specified disk drive exists <vvb@ibm.net>
        html-to-txt <empgc@ilusion.inesc.pt>
    Re: HTTP Error while calling CGI-Script (written in Per <vvb@ibm.net>
        Is it possible to "reset" the ?? pattern search? (rogDH)
    Re: Is it REALLY impossible to install Perl on Windoze? (Daniel Beckham)
    Re: programmer required (Tad McClellan)
    Re: programmer required <Michael.Cameron@no.spam.technologist.com>
        Random number generator <michel@netstyle.nl>
    Re: Random number generator (Matthew Bafford)
    Re: Random value for Scalar (Bart Lateur)
        Risk for zombies in Randal's WebTechniques Columns fork (Bart Lateur)
        SNMP <philip.smeuninx@be.uunet.net>
        string -> Create SQL Statements? <SpamMeNOT.3pound@iname.com>
    Re: This installation make me nut, please help! kamez@my-dejanews.com
    Re: Unix files in MacPerl (Chris Nandor)
    Re: use Win32::ODBC causes script to hang in browser <rhardicr@hotmail.com>
    Re: Wanna post, need programmer help (Tad McClellan)
        Want to override 'carp' in my own module jboes@qtm.net
    Re: Writing to syslog on Linux (Neil Cherry)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 21 Apr 1999 13:30:18 GMT
From: aspinelli@ismes.it (Andrea LN Spinelli)
Subject: Re: Another bug in Perl?
Message-Id: <371d9ffd.16457397@news.iol.it>

On Mon, 19 Apr 1999 22:57:15 GMT, andy@-nospam-haveland.com (Andrew
Haveland-Robinson) wrote:
[..]
> 	for (split (//, $msgdec)) { $v .= uc sprintf ("%02x", ord($_) ); }
your fix

>However, it still doesn't explain why my fix worked by successfully
>translating the newline without the s option!
Eh?? Your latest two lines make me feel you did not understand
the many posts of this thread! Where would you like
to put the s option in your original fix?

[change of mood...]

I experimented a little with Benchmark, (precious thing to know!)
and the results are quite interesting...

--file r.pl--

foreach( 0..255 ){ $gtable[$_] = sprintf("%%%02X",$_);}

$a = "foo bar baz\nFOO BAR BAZ\n";
		print "$a\n";

$a = $a x 200;

use Benchmark;

timethese( 1000, {

	's///' => sub { my $b = $a;
		$b =~ s/(.)/sprintf("%%%02X",ord($1))/seg;
	},

	's///-global-table' => sub { my $b = $a;
		$b =~ s/(.)/$gtable[ord($1)]/sg;
	},

	's///-global-table-ref' => sub { my $b = $a;
		my $tableref = \@gtable;
		$b =~ s/(.)/$tableref->[ord($1)]/sg;
	},

	's///-local-table' => sub { my $b = $a;
		my @table;
		foreach( 0..255 ){ $table[$_] = sprintf("%02X",$_);}
		$b =~ s/(.)/$table[ord($1)]/sg;
	},

	'split_naive' => sub { my $b = $a;
		my $c;
		for (split (//, $b)) {
			$c .= sprintf ("%02X", ord($_) );
		}
	},

	'split_table' => sub { my $b = $a;
		my @table;
		foreach( 0..255 ){ $table[$_] = sprintf("%02X",$_);}
		my $c;
		for (split (//, $b)) {
			$c .= $table[ ord($_) ];
		}
	},

	'split_global_table' => sub { my $b = $a;
		my $c;
		for (split (//, $b)) {
			$c .= $gtable[ ord($_) ];
		}
	},

}
);

Now look at the results (lines inserted for readability)...

Benchmark: timing 1000 iterations of s///, s///-global-table,
s///-global-table-
ref, s///-local-table, split_global_table, split_naive, split_table...

      s///: 67 wallclock secs (66.79 usr +  0.00 sys = 66.79 CPU)

s///-global-table: 53 wallclock secs (53.28 usr +  0.00 sys = 53.28
CPU)

s///-global-table-ref: 55 wallclock secs (54.82 usr +  0.00 sys =
54.82 CPU)

s///-local-table: 50 wallclock secs (50.14 usr +  0.00 sys = 50.14
CPU)

split_global_table: 49 wallclock secs (48.88 usr +  0.00 sys = 48.88
CPU)

split_naive: 55 wallclock secs (55.53 usr +  0.00 sys = 55.53 CPU)

split_table: 49 wallclock secs (48.27 usr +  0.00 sys = 48.27 CPU)

You see, the 'split' way is faster than the s/// way!
Of course, storing a table of 256 character translations is faster
than calling sprintf every time.
But its is slightly better to compute the table locally 1000 times
than having a global table in the main:: package.
Also, keeping a reference to the global table is of no help.

Intuitive??

See ya
   Andrea



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

Date: 21 Apr 1999 09:52:55 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Another bug in Perl?
Message-Id: <x73e1udqrs.fsf@home.sysarch.com>

>>>>> "ALS" == Andrea LN Spinelli <aspinelli@ismes.it> writes:

  ALS> I experimented a little with Benchmark, (precious thing to know!)
  ALS> and the results are quite interesting...

it would help if your code were more consistant. in the local tables you
don't always use %% to get a single % while in the global you do. did
you cut and paste or retype the sprintf code? also map should be faster
than the foreach. and i highly doubt that using a precomputed global
table is slower than computing the table each time. you probably have
some inconsistancy which is doing that. i am not in the mood to check
with a fine toothed comb all these tests and to rerun them.


  ALS> --file r.pl--

  ALS> foreach( 0..255 ){ $gtable[$_] = sprintf("%%%02X",$_);}

@gtable = map sprintf( '%%%02X' $_ ), 0 .. 255 ;

  ALS> 	's///-local-table' => sub { my $b = $a;
  ALS> 		my @table;
  ALS> 		foreach( 0..255 ){ $table[$_] = sprintf("%02X",$_);}
                                                         ^
                                                         missing %%
  ALS> 		$b =~ s/(.)/$table[ord($1)]/sg;
  ALS> 	},

  ALS> 	'split_naive' => sub { my $b = $a;
  ALS> 		my $c;
  ALS> 		for (split (//, $b)) {
  ALS> 			$c .= sprintf ("%02X", ord($_) );
                                        ^
                                        missing %%


  ALS> 	'split_table' => sub { my $b = $a;
  ALS> 		my @table;
  ALS> 		foreach( 0..255 ){ $table[$_] = sprintf("%02X",$_);}
                                                         ^
                                                         missing %%
  ALS> 		for (split (//, $b)) {
  ALS> 			$c .= $table[ ord($_) ];
  ALS> 		}

$c = join( '', map( $table[ ord($_) ], split (//, $b) ) ) ;

  ALS> 	},

  ALS> 	'split_global_table' => sub { my $b = $a;
  ALS> 		my $c;
  ALS> 		for (split (//, $b)) {
  ALS> 			$c .= $gtable[ ord($_) ];
  ALS> 		}

$c = join( '', map( $gtable[ ord($_) ], split (//, $b) ) ) ;

  ALS> But its is slightly better to compute the table locally 1000 times
  ALS> than having a global table in the main:: package.
  ALS> Also, keeping a reference to the global table is of no help.

after you fix things up i would like to see more proof that the global
table is slower than computing local ones.

also you need to be more careful about comparing benchmarks. did you
check the output of each of these benchmarks to see if you were
generating the correct strings?


uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 21 Apr 1999 07:51:49 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Any visual editor for Perl: Win32?
Message-Id: <371DC9E5.A5E5B30C@mail.uca.edu>

Jim Durkin wrote:
> 
> Hi,
> 
> I'm a newbie to Perl.  Any visual editor commonly used with Perl on windows
> NT?

AFAIK, *all* of the editors commonly used with Perl are visual. I have
not yet heard of an auditory, olfactory, tactile, or gustatory editor
(although I am positive there is something somewhere for translating for
the blind). If anyone knows of one, it should be of interest to all
here.

> Also, can you guide me to any good websites that have network related Perl
> scripts?

http://www.perl.com has more links than you want to know about. Just
avoid "Matt's Scripts."

> 
> Thanks in advance,

You're welcome.

Cameron

> 
> Jim Durkin

-- 
Cameron Dorey
camerond@mail.uca.edu


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

Date: Wed, 21 Apr 1999 13:17:14 GMT
From: latsharj@my-dejanews.com
Subject: Re: Any visual editor for Perl: Win32?
Message-Id: <7fkj4m$vk2$1@nnrp1.dejanews.com>

In article <01be8b6f$dfbe6460$4d96bad1@jdurkin>,
  "Jim Durkin" <jdurkin@gw.total-web.net> wrote:

> I'm a newbie to Perl.  Any visual editor commonly used with Perl on windows
> NT?
I really like Lemmy - fast, nice syntax coloring.  www.softwareonline.org  Of
course, to like Lemmy, you have to like vi. ;-)
--
Regards,
Dick

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 21 Apr 1999 08:59:28 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: C directives
Message-Id: <x790bmdt8v.fsf@home.sysarch.com>

>>>>> "RJK" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:

  >> What C preprocessor does it use then? How do i specify it? 

  RJK> That's a good question.  I'm not sure.  :/

perl -MConfig -le 'print $Config{cpp}'

grep cpp /usr/local/lib/perl5/sun4-solaris/5.00404/Config.pm

<sub in your arch and perl version>

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 21 Apr 1999 11:49:39 GMT
From: Don Roby <droby@copyright.com>
Subject: re: CGI programmer wanted
Message-Id: <7fke0i$qsp$1@nnrp1.dejanews.com>

In article <371a91da.11269790@news.erols.com>,
  diablo@livenet.net (Diablo Killuminati) wrote:
> I opperate a couple of new adult sites and I am in need of a good CGI
> programmer.
>

Are you doing an issue devoted to PerlMonger nudes?

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 21 Apr 1999 16:33:47 +0300
From: Scrobach Ura <scru@rdovira.lviv.ua>
Subject: EOF on pipe
Message-Id: <Pine.BSF.3.91.990421152458.17446A-100000@rdovira.lviv.ua>

The following code will hung forever. The parent will wait for child to
terminate and child will wait for input. As far as i know close on pipe
will rise an EOF on pipe. 
If i change line [12] to 'scalar <CHLDSTDIN>' it works fine so i set up 
pipes fine. I just need a subroutine that forks child and ecex. The main
program outputs some data to child and fetches an error message if there's
such.
I get the same behaviour using IPC::Open3 but similar C program
works fine. If i ommit close on pipe child won't get EOF on read and will
hung waiting for input so i think there's nothing about $| beeng set to 1
but perl's implementation of close. Am i missing something important or the
last chance is to use pseudo terminals to talk to programs that is long and 
painfull way?

[1]  pipe CHLDSTDIN, CHLDSTDOUT;
[2]  $fh = select(CHLDSTDOUT); $| = 1;
[3]  select($fh);
[4]  $pid = fork;
[5]  if ($pid) {
[6]     close CHLDSTDIN;
[7]     print CHLDSTDOUT "message from parent\n";
[8]     close CHLDSTDOUT;
[9]     wait;
[10] } else {
[11]    open STDIN, ">&CHLDSTDIN" or die "cannot dup: $!";
[12]    print "child: got message: ",<CHLDSTDIN>;
[13]    exit(0);
[14] }


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

Date: Wed, 21 Apr 1999 14:07:57 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: Headers posted from forms
Message-Id: <371dbef4@news.uk.ibm.net>

Just use

print "<TABLE>\n";
foreach $item (sort keys %ENV) {
 print "<TR><TD>$f$item</TD><TD>$f$ENV{$item}</TD></TR>\n";
}
print "</TABLE>\n";

to have a look at all your variables, including the header fields the
browser sends you.

M.R.Kanski <M.Kanski@if.pw.edu.pl> wrote in message
news:hVgT2.2531$811.48717@news.tpnet.pl...
> Hi!
>
> I want to know all headers sent from my browser to server. How to do it?
>
> Is it enough just to look in environment variables on the server and then
> compare content of
> $ENV{'HTTP_REFERER'} with header Http-referer? Aren't there any headers
not
> included in these variables, that I can missed?
>
> Regards!
>
> Maciej R. Kanski
>
>




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

Date: Wed, 21 Apr 1999 14:19:19 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: How can I execute non cgi PERL script under NT?
Message-Id: <371dc19d@news.uk.ibm.net>

When you installed Perl correctly, it should be in the path (like
c:\perl\bin\). So you could in a DOS prompt start a perl program - it even
doesn't have to have a pl extention - with :

    perl myprog

This has also the advantage you can use switches, like:
    perl -w myscript.pl

Vincent


Wyzelli <wyzelli@yahoo.com> wrote in message
news:emeT2.13$OA2.5585@vic.nntp.telstra.net...
>
> David Efflandt wrote in message ...
> >On Tue, 20 Apr 1999 15:12:40 -0500, Alejandro Eluchans
> ><alejandro.eluchans@umb.edu> wrote:
> >>I got Perl Builder for NT and it works great.
> >>
> >>Now, I need to run my PERL scripts (under Win NT) independently of any
> >>web server or PERL utility.
> >>Maybe using DOS line command (like UNIX) or maybe double clicking on a
> >>(.exe) icon?
> >>How do I get the PERL interpreter to "compile" my script?
> >
> >I never used NT, but in Win95 is is as simple as associating the '.pl'
> >file extension with perl.exe.  Then you simply double click on the file
in
> >Explorer (the file thing, not MSIE) and perl runs it.  Of course you
> >cannot enter any parameters that way, but you can get input from STDIN.
> >
> >But I gave up on that long ago and run it in Linux instead, where
> >everything works as intended.
> >
> I simply create an icon which points to perl.exe then the script I want.
I
> find it is better to have all the paths described explicitly so you are
not
> depending on system variables which can vary.
>
> ie the command line I use for one (stored in a shortcut) is:
>
> C:\Perl\5.00502\bin\MSWin32-x86-object\perl.exe c:\perl\account.pl
>
> This works fine
>
> Wyzelli
>
>




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

Date: Wed, 21 Apr 1999 15:21:25 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: How to determine if a specified disk drive exists
Message-Id: <371dd028@news.uk.ibm.net>

Here's a small script that does the job.
BUT! In this script I'm doing something that I shouldn't be doing: see line
8. But even if you use the -w switch, it doesn't give an error message...
Basically: if there is an error in reading the directory (or the drive), I
ignore the error and return false, otherwise, return true...

1 $mydrive="h";            #drive letter to test, you could use input from
<STDIN> instead
2 $bool=testdrive($mydrive);    #$bool is true (well: 1) or false (0), so
you can use it from here
3 $text=$bool?"Drive $mydrive exists.":"Drive $mydrive doesn't exist.";
4 print "$text\n";

5 sub testdrive {
6         $drive=shift;
7         $dir="$drive:/";
8         opendir DIR, $dir or return "0";        # in theory you should do
a 'or die...' Perl Guru's: please tell us if this is 'dangerous' or not...
9         return "1";
10         close DIR;
11 }


Vincent



<lingane@my-dejanews.com> wrote in message
news:7fhv39$ihp$1@nnrp1.dejanews.com...
> I need to determine if a disk drive exists.  The ways I have been trying
all
> return errors if it doesn't exist or it doesn't have a disk in it.
>
> I need to know if it is a legitimate drive for the the machine.  I need to
be
> able to do this on 95/98 and NT platforms.
>
> Also, if possible I need to do it without having to add in predefined Perl
> functions.  This script must take up as little space as possible.
>
> Thanks
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Wed, 21 Apr 1999 13:38:23 +0200
From: Eduardo Catarino <empgc@ilusion.inesc.pt>
Subject: html-to-txt
Message-Id: <371DB8AE.A4D6661D@ilusion.inesc.pt>

    Does anyone have some ideas how to build a html-to-txt converter?






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

Date: Wed, 21 Apr 1999 14:12:44 +0200
From: "Vincent Vanbiervliet" <vvb@ibm.net>
Subject: Re: HTTP Error while calling CGI-Script (written in Perl)
Message-Id: <371dc010@news.uk.ibm.net>

If you think the script is the problem, posting the script would sure help!




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

Date: Wed, 21 Apr 1999 12:38:24 GMT
From: rogdh@iname.com (rogDH)
Subject: Is it possible to "reset" the ?? pattern search?
Message-Id: <371ec6bd.34688088@news.earthlink.net>

I have a pattern search of ?GOTO? in a sub-routine.
I open and close a different file each time I go in the sub.
I want re-set the ?? search so that I can find the first GOTO of
each file that I pass to the sub.
Can I reset the ?? to an "initial"state each time I enter the sub?

thank you.
roger



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

Date: Wed, 21 Apr 1999 09:33:32 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: Is it REALLY impossible to install Perl on Windoze???
Message-Id: <MPG.11879d9be33af6db9896b3@news.idt.net>

I think he is talking about the install process, and not the actually 
dist size.  Although, 80MB is large, some installation processes take up 
a _lot_ of temp space and he could be running out of space...

In article <Pine.A41.4.05.9904202305270.14598-100000@unix3.UVic.CA>, 
paladin@uvic.ca says...
> On Wed, 21 Apr 1999 agniora@usa.net wrote:
> 
> > In article <MPG.1186ed807b2b64c2989691@news.supernews.com>,
> >   mjw@bahnhof.se wrote:
> > 
> > hmm... i once had trouble with ActivePerl and later i found out that it runs
> > out of hard disk spaces. it takes something above 100megs it seems. have u
> > checked ur hard disk space?
> 
> You are off by almost an order of magnitude.  I just checked my
> ActiveState install (build 507) and it is ~17-18 megs.  I haven't tried to
> install the newest build yet (515 IIRC) but I can't see it adding 80 megs
> to the install size.
> 
> 


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

Date: Wed, 21 Apr 1999 02:51:04 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: programmer required
Message-Id: <ogsjf7.o45.ln@magna.metronet.com>

David Bilbow (dnb@emmerce.com.au) wrote:
: Can someone please tell me which of the perl groups is the correct place to
: find a perl programmer for long term employment located in Sydney ?


   None of them.


   The correct newsgroup for job postings has 'jobs' in its name.

   There are also listings at The Perl Journal (http://www.tpj.com/tpj/jobs)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 21 Apr 1999 12:06:42 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: David Bilbow <dnb@emmerce.com.au>
Subject: Re: programmer required
Message-Id: <371DBF52.4454AA09@no.spam.technologist.com>

David Bilbow wrote:

> Can someone please tell me which of the perl groups is the correct place to
> find a perl programmer for long term employment located in Sydney ?

aus.jobs where I can currently see 9 jobs so guess nobody really uses it.

uk.jobs.offered where I can currently see 1908 posts so couldn't be bothered
looking in it beacuse os all the jobs that are offered which are a) crap b)
not in the UK c) get rich quick schemes (send us $50 now!) d) MLM (see c) e)
from agencies who spend all day gathering CVs off the net to send to positions
which you are unsuitable for/don't want/ have already been submitted to.  (Me,
bitter?)

Are there any pm groups in Oz?  Have a look at www.pm.org

Or I could do it from home, I'm in Scotland ;-)

Good luck,

Michael

Remove no.spam when replying



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

Date: Wed, 21 Apr 1999 11:23:52 +0200
From: "michel" <michel@netstyle.nl>
Subject: Random number generator
Message-Id: <7fk5df$vfc$1@enterprise.cistron.nl>

Hi all,

How do I give a scalar a random value between 10.000 and 99.000
something like

@random_number=10.000+{RAND(1)*89.000}      ???????

Thanks for helping,

MW




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

Date: Wed, 21 Apr 1999 13:36:09 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Random number generator
Message-Id: <slrn7hrjn7.20v.dragons@dragons.duesouth.net>

On Wed, 21 Apr 1999 11:23:52 +0200, michel <michel@netstyle.nl>
lucked upon a computer, and thus typed in the following:
: Hi all,
: 
: How do I give a scalar a random value between 10.000 and 99.000
: something like
: 
: @random_number=10.000+{RAND(1)*89.000}      ???????

You read the replies to your first posting.
 
: Thanks for helping,

HTH,

: MW

--Matthew


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

Date: Wed, 21 Apr 1999 12:28:45 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Random value for Scalar
Message-Id: <371dc457.4292169@news.skynet.be>

Michael Cameron wrote:

>More like
>
>$RAN_NUM = 10000+(rand(1)*89000);

or even

  $RAN_NUM = 10000 + int(rand 89000);

	Bart.


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

Date: Wed, 21 Apr 1999 12:53:48 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Risk for zombies in Randal's WebTechniques Columns forking code?
Message-Id: <371eca53.5824356@news.skynet.be>

[posted on comp.lang.perl.misc and cc'ed to Randal Schwartz]

Somebody fill me in.

If I understood correctly, on Unix, you get zombie processes if a
program's children live longer than the parent, i.e. something sticks
around even after all program copies have quit.

In Randal's (excellent) WebTechniques columns (URL:
http://www.stonehenge.com/merlyn/WebTechniques/), here's one version of
a trick he's used a few times so far (columns 11, 20, 23 and 24):

	defined(my $pid = fork) or die "Cannot fork: $!";
	exit 0 if $pid;                 # I am the parent
	#child continues here...
	close(STDOUT);

The idea is to close the active CGI script, so the web server sends a
complete HTML response to the browser, while the child continues and
does "some other useful stuff".

The question is, plain and simple: doesn't this generate zombie
processes? If not, why not? If too, is it possible to avoid zombies
without loosing the original functionality?

	Bart.


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

Date: Wed, 21 Apr 1999 14:25:16 +0200
From: "Philip Smeuninx" <philip.smeuninx@be.uunet.net>
Subject: SNMP
Message-Id: <7fkg2t$h5v$1@xenon.inbe.net>

I tried the following :(host, community and oid are definied!),

{
my $session = SNMP::Session->new($host, $community);
my $vars = SNMP::VarList->new($oid);

if ($session->get($vars))  ..........

BUT the IF statement always returns a zero value, when I try for the same
host and oid at the command line with snmpget, I get a valid value back.

Anyone any suggestions ???

Many thanks ,

Philip




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

Date: Wed, 21 Apr 1999 09:56:22 -0500
From: "Jay J" <SpamMeNOT.3pound@iname.com>
Subject: string -> Create SQL Statements?
Message-Id: <zKkT2.488$J21.2836400@rsnws01.mn.mediaone.net>

Given a string: (perl and linux) or "fuzzy logic"

Is there module that'll build the SQL statement?

SELECT FROM mytable WHERE description LIKE ("%perl%" and "%linux%") OR
description LIKE "%fuzzy logic%"

I feel a little silly given the fact there are many open source products
that do boolean processing, but I've failed to grep out the code I need for
a non-brittle routine.

Thanks,

-Jay J




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

Date: Wed, 21 Apr 1999 13:27:43 GMT
From: kamez@my-dejanews.com
Subject: Re: This installation make me nut, please help!
Message-Id: <7fkjob$6c$1@nnrp1.dejanews.com>




I'm experiencing the same problem , trying to install PERL5 on BSDI 3.1 ,
and i can't even get a "make" , cause i get the following error :
------------------------------------------------------------------
`sh  cflags libperl.a doio.o`  doio.c
          CCCMD =  cc -DPERL_CORE -c -fpcc-struct-return -O
doio.c: In function Perl_do_ipcctl:
doio.c:1381: argument #4: incompatible types in argument passing
doio.c:1432: argument #4: incompatible types in argument passing
*** Error code 1

Stop.
-----------------------------------------------------------------
If you have any clue, i'll appreciate it,
Thanks a lot for your help.
Khalid.



In article <7edb9l$jsm$1@news.graphnet.com>,
  "York Pang" <ypang@graphnet.com> wrote:
> I installed Perl5.004 on Freebsd 2.2.8 without any problem using default
> settings before. But, when I try to install either Perl5.004 or Perl5.005 on
> Freebsd 3.1,  I am in trouble.
>
> After running "sh Configure", I can successfully build miniperl, but the
> process always crashes during the building of extensions.  The "make
> minitest" runs just fine.  I always runs into problems with extensions that
> "Always included by default" , such as B, Fcntl, etc.  The error messages
> are, for example:
>
> ...
> B.0(.text+0x87cd):undefined reference to xxx
> /usr/lib/crt1.0: in function '_start'
> /usr/lib/crt2.0(text+0x69):undefined reference to 'Main'
> cc:file path prefix 'shareable' never used
> Error Code1
> Stop
> Error Code 1
>
> I tried playing interactively with the Configure, hint file, and even
> re-build the Freebsd, but without much difference.  I guess that I can turn
> off all the extensions referred to the error messages,  but that way the
> function of Perl maybe problematic.
>
> Does anyone meet this before or successfully install Perl5 on Freebsd 3.1?
> Please help!
>
> Your assistance are very much appreciated.
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 21 Apr 1999 08:27:47 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Unix files in MacPerl
Message-Id: <pudge-2104990827470001@192.168.0.77>

In article <ookookook-2004991629100001@ip186.r6.d.pdx.nwlink.com>,
ookookook@yahoo.com (Ook!) wrote:

# The solution is absofreakinglutely trivial with AppleScript, which you can
# call from MacPerl if you really feel the need to add one meg of overhead-
# this very subject was discussed in alt.comp.lang.applescript not but a
# fornight hence.

Yeah, and it resulted in a rather nasty flamewar.  :)

Anyway, to convert any of CR, LF, or CRLF to local newline, Bart's
solution is fine.  I would even do:

  #!/usr/bin/perl -0012wpi.bak
  # convert to local newline
  s/\015\012?|\012/\n/g;

Only downside to this is that it needs to get the whole file at once if it
has no LFs in it (i.e., is already in Mac format), which could cause
memory problems.  A better solution could be:

  #!/usr/bin/perl -w
  # convert to local newline
  use Fcntl;
  use File::Copy;

  for my $file (@ARGV) {
      local($/, *F, *B);
      sysopen(F, $file, O_RDONLY) or die "Can't open '$file': $!";
      while (1) {
          seek F, -1, 1;
          read F, my($bytes), 2;
          ($/) = ($bytes =~ /^(\015[^\012]|\015\012|\012.)$/s);
          $/ =~ s/[^\015\012]//g if $/;
          last if $/ || eof(F);
      }
      close(F);

      if ($/) {
          my $fileb = "$file.bak";
          rename($file, $fileb) or die "Can't rename '$file': $!";

          sysopen(F, $file, O_WRONLY|O_CREAT) or die "Can't open '$file': $!";
          sysopen(B, $fileb, O_RDONLY) or die "Can't open '$file': $!";
          while (<B>) {
              s|$/|\n|;
              print F;
          }
      }
  }
  __END__

Both solutions only work for \015, \012, and \015\012, though they can be
modified to work for others, obviously.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Wed, 21 Apr 1999 12:39:08 +0100
From: Richard H <rhardicr@hotmail.com>
Subject: Re: use Win32::ODBC causes script to hang in browser
Message-Id: <371DB8DC.2C05C8F@hotmail.com>

Jason Q. wrote:
> 
> Hi
> 
> I'm learning to access an MS Access database using Perl and
> Win32::ODBC.
> 
> The script works fine when I run it from the command prompt. However,
> when I try to run it on Netscape and IE, the script fails to run and I
> get a "Trasferring data from 127.0.0.1" message on the status bar and
> eventually "Document contains no data".
> 
> I have found out that the line
> 
> use Win32:ODBC;
> 
> is the cause. Why don't the browsers recognise this line? 

Your browser should not be having anything to do with use statements?
Its the server which should be interpreting these.

If post the first few lines of your script it would be more use, you are
outputting HTML for example??

Richard H


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

Date: Wed, 21 Apr 1999 02:37:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Wanna post, need programmer help
Message-Id: <4orjf7.o45.ln@magna.metronet.com>

Wyzelli (wyzelli@yahoo.com) wrote:

: Where is the book of rules on NG posting syntax?


   news.announce.newusers


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 21 Apr 1999 13:40:19 GMT
From: jboes@qtm.net
Subject: Want to override 'carp' in my own module
Message-Id: <7fkkg3$r4$1@nnrp1.dejanews.com>

I've written a module, Log.pm, which attempts to log activity with timestamps:


  use Log;
  $Log = new Log("/path/to/my.log");
  $Log->logEntry("Hello, world.");


results in

  1999-04-21 9:01:00.000 Hello, world

in the named log file. So far, so good.


Now what I want to do is to provide a means to manually override Carp::carp--


  use Log;
  carp "Carp #1";        # this would go to STDERR
  Log::carp2log($Log);
  carp "Carp #2";        # this would go to $Log


'Log::carp2log' is a routine that simply adds the $Log object to an internal
list.

  sub carp2Log {
    my $self = shift;
    push @CarpLogs, $self;
  }

Log.pm contains a 'carp' subroutine that looks like this:

  sub carp {
    if (@CarpLogs == 0) {
      Carp::carp @_;
    }
    else {
      foreach (@CarpLogs) {
        $_->logEntry(Carp::shortmess @_);
      }
    }
  }


So the idea is that I can have several Log objects open, and at run-time, turn
on 'carp' output.

One of the things I'm tinkering with is this inside Log.pm:

  @ISA = qw(Exporter Carp);

There's something complex going on between the 'use Carp' and 'use Log'
invocations. My testbed has a main .pl and a .pm other than my Log.pm.
The 'use' pragmas appear to redefine carp in unpredictable ways.

I've got most of the top Perl books, including the Cookbook, Perl Modules,
Effective Perl Programming. Haven't found much in them yet that will move me
along toward understanding this.


--
Jeff Boes  jboes@qtm.net
http://www.qtm.net/~jboes/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 21 Apr 1999 12:43:27 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: Re: Writing to syslog on Linux
Message-Id: <slrn7hri4m.ojg.njc@dmc.uucp>

On Wed, 21 Apr 1999 08:49:51 GMT, Marc Haber wrote:
>njc@dmc.uucp (Neil Cherry) wrote:
>>Writing a message to syslog. It executes, but no errors and no
>>entry. But one interesting thing happened today when I upgraded to
>>Linux 2.2.5. Dmesg report no /dev/log. I think I need a new ksyslog or
>>something under 2.2.5. That still doesn't explain what happens with
>>2.2.1.
>
>Sys::syslog uses TCP/UDP (can't remember which and don't have a UNIX
>system available in this hotel room). So you gotta run your syslogd to
>accept network connections (man syslogd, it's a command line option).
>
>Be sure to firewall that port (513?) to prevent possible
>Denial-Of-Service-Attacks if you run syslogd receiving network
>connections.

Thanks Marc, I have syslogd running and my logs receive entries from
various programs. I'm wondering if it's because I'm running 2.2.x and
may have the wrong syslogd or that I'm running the right one and that
it's changed it's behaviour. I think the problem is really on my box
and not with the Syslog module/package.

-- 
Linux Home Automation           Neil Cherry             ncherry@home.net
http://members.home.net/ncherry                         (Text only)
http://meltingpot.fortunecity.com/lightsey/52           (Graphics GB)
http://www2.cybercities.com/~linuxha/			(Graphics US)


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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