[17414] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4834 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 7 18:10:44 2000

Date: Tue, 7 Nov 2000 15:10:26 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973638626-v9-i4834@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 7 Nov 2000     Volume: 9 Number: 4834

Today's topics:
    Re: Help with Building GD.pm on Linux <gellyfish@gellyfish.com>
    Re: Help! Can't use "next LABEL" in SIG{ALRM} sub nobull@mail.com
    Re: Help! Can't use "next LABEL" in SIG{ALRM} sub <a@b.c>
        HELP nodo70@my-deja.com
    Re: how do I pass params to perlis.dll via url? <elephant@squirrelgroup.com>
        How to return @Array1 and @Array2? fallenang3l@my-deja.com
    Re: How to return @Array1 and @Array2? <jeff@vpservices.com>
    Re: How to return @Array1 and @Array2? <ren.maddox@tivoli.com>
    Re: How to return @Array1 and @Array2? (Jon Ericson)
    Re: How to return @Array1 and @Array2? (Mark-Jason Dominus)
    Re: Looking for idiom for getting value from @ARGV, or  <mra@pobox.com>
    Re: MS SQL & Perl <hartleh1@westat.com>
    Re: MS SQL & Perl <jeff@vpservices.com>
    Re: MS SQL & Perl <RichParker@fssi-ca.com>
    Re: MS SQL & Perl <RichParker@fssi-ca.com>
    Re: MS SQL & Perl (Gwyn Judd)
    Re: MS SQL & Perl <RichParker@fssi-ca.com>
    Re: Multiple fork()s? <jhscrimsher@uswest.net>
    Re: Multiple fork()s? (Ilya Zakharevich)
        Newbie. Grabbing from a serial port <olh@kms.dk>
        OK - I'm stupid. Please help. <geoff@800-800-cruise.com>
    Re: OK - I'm stupid. Please help. <jeff@vpservices.com>
    Re: OK - I'm stupid. Please help. <kstep@pepsdesign.com>
    Re: OK - I'm stupid. Please help. <geoff@800-800-cruise.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 7 Nov 2000 08:11:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help with Building GD.pm on Linux
Message-Id: <8u8dfd$8ut$1@orpheus.gellyfish.com>

On Sun, 5 Nov 2000 11:36:47 -0800 Bill Moseley wrote:
> Attempt number two:
> 
> Any ideas why I can't get GD.pm to build?
> 
> Running Linux 2.2.13 (SuSE 6.3)
> 
> One question is I just built the current version of libgd from Tom's
> site (http://www.boutell.com/gd/.)  and it went without a problem.  But 
> it installed in /usr/local/*, and my Linux box has libgd, libjpeg, 
> libttf installed in /usr/lib and headers in /usr/include.  Could this be 
> a problem?
> 

Yes, get rid of the old gd stuff. If it was originally installed from some
package then use the appropriate package manager to remove  it.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 07 Nov 2000 18:58:10 +0000
From: nobull@mail.com
Subject: Re: Help! Can't use "next LABEL" in SIG{ALRM} sub
Message-Id: <u9vgtzhanx.fsf@wcl-l.bham.ac.uk>

"Kingsley Tart" <a@b.c> writes:

> > Two problems here:
> >
> > 1) You can't goto (or next, last, redo, continue) out of a signal
> >    handler.  The only "approved" Perl way to do the equivalent of a
> >    POSIX/C siglongjmp() is eval{}/die() (see "perldoc perlipc" for
> >    details)
> 
> Hmm, that presents me with a problem.

How so?  Do you have moral objections to a proper exception handling
model?

>       if (socket (TESTSOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp')))
>         {
>           if (connect (TESTSOCK, sockaddr_in($defaultport,
> $HostToTestIPAddr)))
>            {
>              $Connected=1;
>              close (TESTSOCK);
>            }
>         }
> 
> Is the only way of doing this to for a subprocess to do the connection test?

No you can use eval{} die() $SIG{ALRM} and alarm() as documented in
perldoc perlipc/"Signals" like I said above.

BTW: This is a FAQ:

    How do I timeout a slow event?

    Use the alarm() function, probably in conjunction with a signal
    handler, as documented iperlipc/"Signals" and chapter 6 of the
    Camel.  You may instead use the more flexible Sys::AlarmCall module
    available from CPAN.

Better still, in this particular case, stop using the low-level
C-style socket interface and use the standard Perl libraries which do
it all for you.

$Connected=1 if IO::Socket::INET->new(
	PeerAddr => $HostToTestIPAddr,
        PeerPort => $defaultport,
        Timeout => $timeout
);

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 7 Nov 2000 20:24:29 -0000
From: "Kingsley Tart" <a@b.c>
Subject: Re: Help! Can't use "next LABEL" in SIG{ALRM} sub
Message-Id: <ByZN5.83309$hk2.218371@news6-win.server.ntlworld.com>

> BTW: This is a FAQ:

Where can I get this FAQ? If it's perlfunc, there must be a better way than
trying to search for guessed-at keywords in perldoc?

> Better still, in this particular case, stop using the low-level
> C-style socket interface and use the standard Perl libraries which do
> it all for you.
>
> $Connected=1 if IO::Socket::INET->new(
> PeerAddr => $HostToTestIPAddr,
>         PeerPort => $defaultport,
>         Timeout => $timeout
> );

That looks much better, thanks!

Cheers,
Kingsley.




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

Date: Tue, 07 Nov 2000 20:36:17 GMT
From: nodo70@my-deja.com
Subject: HELP
Message-Id: <8u9p41$2bc$1@nnrp1.deja.com>

Anyone can help me to write a simple code that run every 5 minutes?  I
know how to set it up in Unix for cron job but I am using NT I just wan
to to run my program to check the system every 5 mins.  Thanks for your
help.

-nodo


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 8 Nov 2000 09:58:54 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: how do I pass params to perlis.dll via url?
Message-Id: <MPG.14733434e4c23b1098987f@localhost>

  [ posted to comp.lang.perl.misc and CCed to awright@jwac.osis.gov ]

PhyloBhetto wrote ..
>I've a script that (for some reason) won't run under ssl with perl.exe
>so I've remapped the dir to use perlis.dll.  Now the script runs, but
>doesn't get any params I've passed to it!
>
>I used to be able to do something similar to this:
>
>http://blah.com/scriptfile.pl?param1
>
>now, it doesn't recognize "param1"
>
>in my code, I reference "param1" by ARGV[0]
>
>what am I doing wrong?

completely ignoring that you're in a CGI environment .. take a look at 
the CGI.pm module for one of the correct ways to get parameters passed 
to a CGI program .. type the following at a command prompt on your 
server

  perldoc CGI

to learn more about the perldoc utility type

  perldoc perldoc

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 07 Nov 2000 20:19:58 GMT
From: fallenang3l@my-deja.com
Subject: How to return @Array1 and @Array2?
Message-Id: <8u9o54$1hn$1@nnrp1.deja.com>

Original message was posted by someone else at some other forums:

I normally get a subroutine to return an array via:
@Array=&sub_returning_Array();

But
(@Array1,@Array2)=&sub_returning_Arrays();

isn't working. If I'm told that the syntax is wrong, I can look harder
elsewhere...

Muchos Thankos.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 07 Nov 2000 12:56:04 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to return @Array1 and @Array2?
Message-Id: <3A086C64.FEFBFF10@vpservices.com>

fallenang3l@my-deja.com wrote:
> 
> (@Array1,@Array2)=&sub_returning_Arrays();

Use references:

my ($aryref_1,$aryref_2) = &sub_returning_arrays();
print join(':',@$aryref_2); # prints "4:5:6"

sub sub_returning_arrays {
   my @ary1 = (1,2,3);
   my @ary2 = (4,5,6);
   return( \@ary1, \@ary2 );
}


-- 
Jeff


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

Date: 07 Nov 2000 14:37:03 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: How to return @Array1 and @Array2?
Message-Id: <m34s1jr028.fsf@dhcp11-177.support.tivoli.com>

fallenang3l@my-deja.com writes:

> Original message was posted by someone else at some other forums:
> 
> I normally get a subroutine to return an array via:
> @Array=&sub_returning_Array();

Actually, no you don't.  What you have here is a subroutine that
(presumably) returns a list and then you assign that list to @Array.
Lists and array are *not* the same thing.  See the FAQ entry entitled
"What is the difference between a list and an array?" for more
information on that.

> But
> (@Array1,@Array2)=&sub_returning_Arrays();

The problem here is that @Array1 will use up as many elements as
possible leaving none for @Array2.  Presumably you have
sub_returning_Arrays() configured to do something like:

  return @a1, @a2;

But all that really does is return a list containing all of the
elements of @a1 followed by all of the elements of @a2.  This entire
list is subsequently assigned to @Array1 and nothing is left to be
assigned to @Array2.

> isn't working. If I'm told that the syntax is wrong, I can look harder
> elsewhere...

The syntax is technically valid, but isn't particularly useful.  You
probably need to use array references.  Take a look at perlref(1) for
the details.  Use something like:

#!/usr/local/bin/perl -w
use strict;

sub sub_returning_Arrays {
  my @a1 = (1, 2, 3);
  my @a2 = qw(red blue green);
  return \@a1, \@a2;
}

my($arrayRef1, $arrayRef2) = sub_returning_Arrays();

print "@$arrayRef1\n";
print "@$arrayRef2\n";

# and if you really want to copy them into named arrays: (though I
# don't recommend it)
my @array1 = @$arrayRef1;
my @array2 = @$arrayRef2;
__END__

-- 
Ren Maddox
ren@tivoli.com


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

Date: 7 Nov 2000 21:01:04 GMT
From: Jonathan.L.Ericson@jpl.nasa.gov (Jon Ericson)
Subject: Re: How to return @Array1 and @Array2?
Message-Id: <8FE584E3EJonathanLEricsonjpln@137.78.50.25>

fallenang3l@my-deja.com wrote:
>I normally get a subroutine to return an array via:
>@Array=&sub_returning_Array();
>
>But
>(@Array1,@Array2)=&sub_returning_Arrays();
>
>isn't working. If I'm told that the syntax is wrong, I can look harder
>elsewhere...

(Short answer: read perlsub)

You didn't metion what you expected the result to be.  I imagine, that you 
want some elements to show up in @Array1 and other elements to show up in 
@Array2.  Unfortunately, perl flattens arrays into one return list, so 
everything shows up in @Array1.  Perhaps you would do better to return a 
list of array references?  

Jon


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

Date: Tue, 07 Nov 2000 21:54:20 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: How to return @Array1 and @Array2?
Message-Id: <3a087a0c.6ac2$a8@news.op.net>
Keywords: Pennsylvania, orthodontic, registry, wreak


In article <8u9o54$1hn$1@nnrp1.deja.com>,  <fallenang3l@my-deja.com> wrote:
>(@Array1,@Array2)=&sub_returning_Arrays();

I wonder if it's too ill to suggest this:

        sub sub_returning_Arrays {
          ...
          return (scalar @a1, @a1, @a2);
        }

        my ($n, @Array1) = sub_returning_Arrays();
        my @Array2 = splice @Array1, $n;

But I suppose it doesn't scale well to multiple arrays.


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


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

Date: 07 Nov 2000 11:01:24 -0800
From: Mark Atwood <mra@pobox.com>
Subject: Re: Looking for idiom for getting value from @ARGV, or a default
Message-Id: <m34s1jtxmj.fsf@flash.localdomain>

mgjv@tradingpost.com.au (Martien Verbruggen) writes:
> 
> Anyway, it's a non-argument really. The person writing the code to do
> those checks that this whole thread started out with is most likely also
> the one who would mutilate @ARGV unnecessarily. And, again, they would
> get what they ask for.

Especially since it was in a 15 line script to help balance my
checkbook.

But this has been a *facinating* thread to follow.

-- 
Mark Atwood   | The summit of Mount Everest is marine limestone.
mra@pobox.com | 
http://www.pobox.com/~mra


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

Date: Tue, 07 Nov 2000 14:13:31 -0500
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: MS SQL & Perl
Message-Id: <3A08545B.E1CD7A27@westat.com>

Rich Parker wrote:
> 
> Here's what I am having some troubles with:
> 1) The Terminology of 'mSQL' or 'mysql', is either of these a mask 
>    for MS SQL? None of the many docs I have read address this in a
>    way that makes this 'Crystal clear' to me.

No.  MySQL and mSQL are two database systems that are quite distinct 
from Microsoft SQL Server (and from each other but much less so).  

> 2) I am running a plain vanilla WinNT 4.0 server with SQL 7.0 and
>    Perl 5.0. For the life of me my 'my $dbh = DBI->connect($plist,
>    $username, $psw) ...' is not working and I've tried many, many
>    different combinations for the variables. This makes me ponder
>    one other question: Did this stuff load correctly (DBI and/or
>    ODBC)?? The 'perl makefile.pl' worked just fine, but the 'make'
>    or 'nmake' gets an unknown command type of msg. What is the key
>    to these (DBI & ODBC)? Do these belong in certain
>    directories/folders?

I'm not sure what the problem is but if you are using the mysql DBD and
trying to attach to SQL Server, you will probably not get anywhere.  Or
are you using the ODBC DBD?  That should work.  It should look something
like:

my $dbh = DBI->connect("DBI:ODBC:DatabaseName", "$user", "$password") ||
die "Can't connect to database: $DBI::errstr\n\n" ;

Unless you have some pressing need to compile modules on WinNT, you
should just install them with ppm.

If that doesn't help answer your questions, give more specifics.

-- 
Henry Hartley
Westat
Rockville, Maryland, USA


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

Date: Tue, 07 Nov 2000 11:33:06 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: MS SQL & Perl
Message-Id: <3A0858F2.5D65E962@vpservices.com>

Rich Parker wrote:
> 
> 1) The Terminology of 'mSQL' or 'mysql', is either of these a mask for
> MS SQL? 

NO! mSQL, MySQL, and MS SQL are three completely different and unrelated
database management systems.  Nice, huh? (mutter,gripe,grumble,groan)

> 2) I am running a plain vanilla WinNT 4.0 server with SQL 7.0 and Perl
> 5.0. For the life of me my
> 'my $dbh = DBI->connect($plist, $username, $psw) ...' is not working

Without seeing what $plist is, there's not much way to comment.  Also,
you should print out the DBI->errstr if the connect fails.  But first
you need to decide which DBD driver for SQL Server you are going to
use.  AFAIK, that could be ODBC, ADO, Sybase, and possibly others. 
Let's say you go with DBD::ODBC.  Then you need to make sure that $plist
includes the name of a a valid ODBC system DSN setup through your
windows ODBC DSN manager (see windows ODBC docs about that) or a valid
ODBC DSN-less connection (see Tom Lowery's excellent FAQ on that at
http://tlowery.hypermart.net/perl_dbi_dbd_faq.html).

> The 'perl makefile.pl' worked just fine, but the 'make'
> or 'nmake' gets an unknown command type of msg. What is the key to these
> (DBI & ODBC)? Do these belong in certain directories/folders?

Did you compile your own Perl or are you using ActiveState?  If the
latter, just use ppm to install DBI and your DBD and forget about
make/nmake.

-- 
Jeff


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

Date: Tue, 07 Nov 2000 20:26:22 GMT
From: Rich Parker <RichParker@fssi-ca.com>
Subject: Re: MS SQL & Perl
Message-Id: <3A086691.A267F238@fssi-ca.com>

This is a multi-part message in MIME format.
--------------57B6B74BE100CFA61E174739
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Ok,
Hopefully the ATTACHED file made it to this POST:REPLY...

Here it is, what the heck am I doing wrong? Nothing at all displays.... Is
there a way to run this whole thing directly on the SERVER so I can at least
'See' something???

Thanks...
--
Rich Parker
Web Sites:
   Business: http://www.fssi-ca.com
   Personal: http://southcoastdivers.com
E-mail:
   Business: mailto:RichParker@fssi-ca.com
   Personal: mailto:Rich@southcoastdivers.com
Pager:
   http://southcoastdivers.com/pager.shtml


--------------57B6B74BE100CFA61E174739
Content-Type: application/x-perl;
 name="sqltst2.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="sqltst2.pl"

#
#  Connect to SQL Dbase.
# -----------------------------------------------------------------------
# Program Mainline.
# -----------------------------------------------------------------------
package sqltst2;  # Identify this as a SUB PROGRAM.
push(@INC, "C:/Perl/site/lib/DBD");  # Add more dir structure...
use DBI;

html_start();

$date = localtime;
$plist = "DBI:ODBC:LocalServer";
$username = "Bob";
$psw = "chief";

my $dbh = DBI->connect($plist, $username, $psw) || die "No Connect $DBI::errstr\n\n";
print "Made it to here #1 $date...<br>\n";

html_end();

exit 1;
# ----------
# Subroutines.
# ----------
# -----------------------------------------------------------------------
# Put HTML junk on front...
# -----------------------------------------------------------------------
sub html_start
  {
     print "HTTP/1.0 200 OK\n";
     print "Content-type: text/html\n\n";
     print "<HTML>\n";
     print "<HEAD>\n";
     print "<TITLE>DB Test</TITLE></HEAD>\n";
     print "<STYLE>\n";
     print "<!-- Hide from older browsers ----------- \n";
     print "A:link{text-decoration:none}\n";
     print "A:visited{text-decoration:none}\n";
     print "A:active{text-decoration:line-through} \n";
     print "// -- End ---- -->\n";
     print "</STYLE>\n";
     print "<BODY BGCOLOR=\"ffffff\" text=\"0000ff\" vlink=\"ff0000\" link=\"ff0000\" alink=\"FF0000\"> \n";
     print "<CENTER>\n";
     print "<H1>\n";
     print "SQL DB Test<br>\n";
     print "</H1><H3>\n";
  }
# -----------------------------------------------------------------------
# Put HTML junk on end
# -----------------------------------------------------------------------
sub html_end
  {
    print "</H3>\n";
    print "</CENTER>\n";
    print "</BODY></HTML>\n";
  }


--------------57B6B74BE100CFA61E174739--



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

Date: Tue, 07 Nov 2000 21:17:11 GMT
From: Rich Parker <RichParker@fssi-ca.com>
Subject: Re: MS SQL & Perl
Message-Id: <3A087279.F7FB32A8@fssi-ca.com>

Hello again,
What I REALLY think the problem is, is the loading process:
1) I ran the 'PERL MAKEFILE.PL' it seemed to work OK.
2) But since I have a WinNT server, w/o VC++ (Why make my life even worse), how
can I possibly run the 'make' or the 'nmake' without a Unix Shell?

So how did all the rest of you run the 'make' w/o a Unix Shell? Maybe that's
what I really should be asking...???

Rich Parker wrote:

> Ok,
> Hopefully the ATTACHED file made it to this POST:REPLY...
>
> Here it is, what the heck am I doing wrong? Nothing at all displays.... Is
> there a way to run this whole thing directly on the SERVER so I can at least
> 'See' something???
>
> Thanks...
> --
> Rich Parker
> Web Sites:
>    Business: http://www.fssi-ca.com
>    Personal: http://southcoastdivers.com
> E-mail:
>    Business: mailto:RichParker@fssi-ca.com
>    Personal: mailto:Rich@southcoastdivers.com
> Pager:
>    http://southcoastdivers.com/pager.shtml
>
>   ------------------------------------------------------------------------
>                  Name: sqltst2.pl
>    sqltst2.pl    Type: Perl Program (application/x-perl)
>              Encoding: 7bit

--
Rich Parker
Web Sites:
   Business: http://www.fssi-ca.com
   Personal: http://southcoastdivers.com
E-mail:
   Business: mailto:RichParker@fssi-ca.com
   Personal: mailto:Rich@southcoastdivers.com
Pager:
   http://southcoastdivers.com/pager.shtml




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

Date: Tue, 07 Nov 2000 21:48:45 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: MS SQL & Perl
Message-Id: <slrn90gu5r.hbr.tjla@thislove.dyndns.org>

I was shocked! How could Rich Parker <RichParker@fssi-ca.com>
say such a terrible thing:
>This is a multi-part message in MIME format.

You really shouldn't do this. This is a plain text only group.

>Here it is, what the heck am I doing wrong? Nothing at all displays.... Is
>there a way to run this whole thing directly on the SERVER so I can at least
>'See' something???
>
>#  Connect to SQL Dbase.
># -----------------------------------------------------------------------
># Program Mainline.
># -----------------------------------------------------------------------
>package sqltst2;  # Identify this as a SUB PROGRAM.
>push(@INC, "C:/Perl/site/lib/DBD");  # Add more dir structure...
>use DBI;

Well this is wrong for a start. You don't add new directories to @INC
this way. This is because the 'use' directive is executed at compile
time whereas the 'push' directive is executed at run time so by the time
you've done the push it's too late. This should fail with a compilation
error. Are you running this as a CGI script? If so you might want to try
running it from the command line and see the difference.

>html_start();
>
>$date = localtime;
>$plist = "DBI:ODBC:LocalServer";
>$username = "Bob";
>$psw = "chief";
>
>my $dbh = DBI->connect($plist, $username, $psw) || die "No Connect $DBI::errstr\n\n";
>print "Made it to here #1 $date...<br>\n";
>
>html_end();
>
>exit 1;
># ----------
># Subroutines.
># ----------
># -----------------------------------------------------------------------
># Put HTML junk on front...
># -----------------------------------------------------------------------
>sub html_start
>  {
>     print "HTTP/1.0 200 OK\n";

I don't think you need this line by the way. This one the webserver
itself puts in (I think).

>     print "Content-type: text/html\n\n";
>     print "<HTML>\n";

You want to look into using a Here-Document.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Nice guys finish last, but we get to sleep in.
		-- Evan Davis


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

Date: Tue, 07 Nov 2000 22:02:15 GMT
From: Rich Parker <RichParker@fssi-ca.com>
Subject: Re: MS SQL & Perl
Message-Id: <3A087D08.989E81AD@fssi-ca.com>

Gwyn,
Well, thanks for the input, but on the @INC line, that's just one of the things I have
tried, that's all, it didn't give an error and it didn't help, it's just what is 'left
over',  as for the 'HTTP...OK' line, I found I always got the MS-Bill msg about a 'CGI
script is misbehaving...' but when I put that line into the script, the msg went away,
another way I need to please Bill Gates I guess....

But that still leaves my last question unanswered: What about the 'make' after the 'perl
makefile.pl', how did the rest of you get around that w/o having a Unix Shell???
HELP!!

Gwyn Judd wrote:

> I was shocked! How could Rich Parker <RichParker@fssi-ca.com>
> say such a terrible thing:
> >This is a multi-part message in MIME format.
>
> You really shouldn't do this. This is a plain text only group.
>
> >Here it is, what the heck am I doing wrong? Nothing at all displays.... Is
> >there a way to run this whole thing directly on the SERVER so I can at least
> >'See' something???
> >
> >#  Connect to SQL Dbase.
> ># -----------------------------------------------------------------------
> ># Program Mainline.
> ># -----------------------------------------------------------------------
> >package sqltst2;  # Identify this as a SUB PROGRAM.
> >push(@INC, "C:/Perl/site/lib/DBD");  # Add more dir structure...
> >use DBI;
>
> Well this is wrong for a start. You don't add new directories to @INC
> this way. This is because the 'use' directive is executed at compile
> time whereas the 'push' directive is executed at run time so by the time
> you've done the push it's too late. This should fail with a compilation
> error. Are you running this as a CGI script? If so you might want to try
> running it from the command line and see the difference.
>
> >html_start();
> >
> >$date = localtime;
> >$plist = "DBI:ODBC:LocalServer";
> >$username = "Bob";
> >$psw = "chief";
> >
> >my $dbh = DBI->connect($plist, $username, $psw) || die "No Connect $DBI::errstr\n\n";
> >print "Made it to here #1 $date...<br>\n";
> >
> >html_end();
> >
> >exit 1;
> ># ----------
> ># Subroutines.
> ># ----------
> ># -----------------------------------------------------------------------
> ># Put HTML junk on front...
> ># -----------------------------------------------------------------------
> >sub html_start
> >  {
> >     print "HTTP/1.0 200 OK\n";
>
> I don't think you need this line by the way. This one the webserver
> itself puts in (I think).
>
> >     print "Content-type: text/html\n\n";
> >     print "<HTML>\n";
>
> You want to look into using a Here-Document.
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> Nice guys finish last, but we get to sleep in.
>                 -- Evan Davis

--
Rich Parker
Web Sites:
   Business: http://www.fssi-ca.com
   Personal: http://southcoastdivers.com
E-mail:
   Business: mailto:RichParker@fssi-ca.com
   Personal: mailto:Rich@southcoastdivers.com
Pager:
   http://southcoastdivers.com/pager.shtml




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

Date: Tue, 7 Nov 2000 11:39:34 -0800
From: "John S" <jhscrimsher@uswest.net>
Subject: Re: Multiple fork()s?
Message-Id: <7TYN5.1691$b5.144306@news.uswest.net>

I have been looking for something like this for a few days now... I have a
process that currently takes about 12-24 hours to run because it has to
check each computer on our local network (about 12,000 machines).  I tried
to speed up the process by forking out each computer check, but (on
Windows2k) my script bombs and creates a Dr. Watson at 360 forks.

I tried this script as well, and it seem to fail at around 219 (on my
machine), when I bump up the number for $num_children.  The only way that I
can get it to work consistently is to place the wait right after the spawn:
 for (my $i = 0; $i < $num_children; $i++)
 {
 spawn(\&childproc, $i);
    wait;
 }

However that puts me back to waiting for each process to finish before
starting the next, negating the use of fork.

Does anyone have thoughts on ways to fork a set number, wait until those
die, then fork somemore?

Something along the lines of :
 for (my $i = 0; $i < $num_children; $i++)
 {
 spawn(\&childproc, $i);
    wait if (($procCount % 200) == 0);  #I tried this but with same
results - bomb at 219
 }

Thanks in advance for your thoughts,

John

"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn8ufghh.294.mgjv@martien.heliotrope.home...
>




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

Date: 7 Nov 2000 21:13:20 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Multiple fork()s?
Message-Id: <8u9r9g$r4n$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to John S
<jhscrimsher@uswest.net>],
who wrote in article <7TYN5.1691$b5.144306@news.uswest.net>:
> Does anyone have thoughts on ways to fork a set number, wait until those
> die, then fork somemore?
> 
> Something along the lines of :
>  for (my $i = 0; $i < $num_children; $i++)
>  {
>  spawn(\&childproc, $i);
>     wait if (($procCount % 200) == 0);  #I tried this but with same
> results - bomb at 219
>  }

Do not you need

  do { wait for 1..200 } if $procCount % 200 == 0;

?

Ilya


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

Date: Tue, 7 Nov 2000 21:19:31 +0000 (UTC)
From: Ole Bjerregaard <olh@kms.dk>
Subject: Newbie. Grabbing from a serial port
Message-Id: <8u9rl2$ics$1@news.net.uni-c.dk>

Hi

I'm trying to grab a data (ascii) string off an instrument connected to a com port.

I DID manage to install Win32::API + Win32::SerialPort, but I'm kind'a lost on how to get it started.

Would anyone out there have a bit of code they would share with me, to that I can build on 
someone elses foundation?

I do have a QBASIC (!) program that will do it, but it appears that it uses 'all' the ressources, plus 
it can only operate on COMports 1 or 2.

Any input is appreciated.

-Ole



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

Date: Tue, 7 Nov 2000 14:14:45 -0800
From: "GC" <geoff@800-800-cruise.com>
Subject: OK - I'm stupid. Please help.
Message-Id: <A7%N5.31638$Q92.827677@nntp2.onemain.com>

I'm absolutely sure there is a very easy way to do this that I have
missed. Please, be gentle...

    1.    What code do I use in Perl to call an .html file
          when the .pl is on Domain 1 and the .html is on Domain 2?

    2.    What code do I use in Perl to call a dbf (flat-text,
          tab-delimited) when the .pl is on Domain1 and the
          .tab is on Domain 2

Please note: this is an attempt to break-down a previous question from a
week or two ago that from which I have no workable answers. I am hoping
that answers to the above will give me enough to solve the problems I am
facing.

I've checked the FAQ's, searched everywhere but the right where, and am
lost. TIA for your patience and help.

Geoff




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

Date: Tue, 07 Nov 2000 14:28:21 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: OK - I'm stupid. Please help.
Message-Id: <3A088205.66BF443B@vpservices.com>

GC wrote:

I don't believe that *you* are stupid, but your choice of subject line
certainly is.  :-) If you select a subject line that reflects the actual
content of your question then those who may know the answer are more
likely to respond and others who are having similar problems will know
to look at the responses as well.

>     1.    What code do I use in Perl to call an .html file
>           when the .pl is on Domain 1 and the .html is on Domain 2?
> 
>     2.    What code do I use in Perl to call a dbf (flat-text,
>           tab-delimited) when the .pl is on Domain1 and the
>           .tab is on Domain 2

Well, I don't really know what you mean by "Domain 1" and "Domain 2".
I'll assume you are talking about files that are located on two
different computers.

I also don't know what you mean by "call an .html file".  If you mean
that you want to redirect the user to it, then use the CGI.pm module's
redirect() method.  If you mean you want the script to fetch it and then
process it somehow and then display it to the user, then use the LWP
module.

I also don't understand whether you are talking about a "dbf" file
(usually a file in the XBase or dBase format) or a true tab-delimited
file.  Assuming you mean the latter you can either also use the
LWP::Simple module to fetch it, then parse it yourself, or you could use
the DBI and DBD::RAM modules to both fetch and parse it.  If you mean
the former, then you'd have to use some combination of DBI, LWP,
DBI::Proxy, and DBD::XBase.

-- 
Jeff


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

Date: Tue, 7 Nov 2000 17:50:33 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: OK - I'm stupid. Please help.
Message-Id: <8ua0vj$23n$1@slb7.atl.mindspring.net>

Hi Geoff,

I'm not sure that I understand your question, but it sounds like you want to
read a file on a remote server from a script running on your domain.  To do
this, the your server needs to pretend that it's a browser and access the
URL of the remote host.  The LWP::UserAgent class allows you to do just
that.  The process is fairly simple - read the documentation for the
LWP::UserAgent, HTTP::Request and HTTP::Response modules.  These are all
available as part of the LWP bundle.

# begin code

use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new('GET',
'http://some.other.domain.com/file.html');

my $response = $ua->request($request);

 if ($response ->is_success) {
     # Process the html...
 } else {
     print $response ->error_as_HTML;
 }

# end code


I hope that this helps,

Kurt Stephens
kstep@pepsdesign.com


"GC" <geoff@800-800-cruise.com> wrote in message
news:A7%N5.31638$Q92.827677@nntp2.onemain.com...
> I'm absolutely sure there is a very easy way to do this that I have
> missed. Please, be gentle...
>
>     1.    What code do I use in Perl to call an .html file
>           when the .pl is on Domain 1 and the .html is on Domain 2?
>
>     2.    What code do I use in Perl to call a dbf (flat-text,
>           tab-delimited) when the .pl is on Domain1 and the
>           .tab is on Domain 2
>
> Please note: this is an attempt to break-down a previous question from a
> week or two ago that from which I have no workable answers. I am hoping
> that answers to the above will give me enough to solve the problems I am
> facing.
>
> I've checked the FAQ's, searched everywhere but the right where, and am
> lost. TIA for your patience and help.
>
> Geoff
>
>




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

Date: Tue, 7 Nov 2000 14:58:07 -0800
From: "GC" <geoff@800-800-cruise.com>
Subject: Re: OK - I'm stupid. Please help.
Message-Id: <dM%N5.31658$Q92.833071@nntp2.onemain.com>

> I'll assume you are talking about files that are located on two
> different computers.

That is correct

> If you mean you want the script to fetch it and then
> process it somehow and then display it to the user, then use the LWP
> module.

That is correct. I'll try this.

> a true tab-delimited
> file.  Assuming you mean the latter you can either also use the
> LWP::Simple module to fetch it, then parse it yourself, or you could
use
> the DBI and DBD::RAM modules to both fetch and parse it.

Thanks. I'll try that too - and will work on the titling. Frustration
occasionally presents awkwardly. :}

Geoff




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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 4834
**************************************


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