[7732] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1357 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 22 01:10:23 1997

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

Perl-Users Digest           Fri, 21 Nov 1997     Volume: 8 Number: 1357

Today's topics:
     Any Perl-compatible database available <u2537@shurflo.com>
     Re: Error when closing database connection <billc@tibinc.com>
     Re: Error when closing database connection (Robert G. Ferrell)
     Good Perl book (KARABOTSOS george)
     Re: Good Perl book twod@not.valid
     I buy used computers Arizona <jeff777@netzone.com>
     Re: is it possible to reference a sub-array? <zenin@best.com>
     Learning Perl(Unix) by O'Reilly in exchange for Learnin (Pearl Fox)
     Need a perl/NT consultant <madison@U.Arizona.EDU>
     New to Perl calbij@ix.netcom.com
     Re: New to Perl (Tad McClellan)
     Re: Perl and Sybase (Martin Moessel)
     Perl and Windows 95 File Sizes <john@nospam.com>
     perl development package ? (David W. Crawford)
     Re: perl development package ? (Mike Heins)
     Perl script making CPU idle time 0. <yogesh@ncs.com.sg>
     Perl/UNIX question <akontari@ix.netcom.com>
     Re: Perl/UNIX question twod@not.valid
     removing lines from a file?? (Burt Lewis)
     serial port access in NT (mtp)
     Re: simple pipe question (Eric Bohlman)
     Re: simple pipe question (Jason Gloudon)
     Re: Statistics for comp.lang.perl.misc (Andrew M. Langmead)
     string comparison question... <tjbiuso@redrose.net>
     Re: string comparison question... (Robert G. Ferrell)
     Re: string comparison question... (Jason Gloudon)
     System runs as sub-process... <bboone@lexmark.com>
     Re: undef and blessed thingies (Charles DeRykus)
     Waiting for multiple background processes to Finish (William Wei Liong Young)
     Re: Waiting for multiple background processes to Finish (William Wei Liong Young)
     xs and mortality <ken@bitsko.slc.ut.us>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 21 Nov 1997 14:57:50 -0800
From: Thomas Beardshear <u2537@shurflo.com>
Subject: Any Perl-compatible database available
Message-Id: <347611EE.7D39CC2F@shurflo.com>

Does ANYONE know of a Linux database compatible with Perl, CGI.pm and
Apache.

I want to query data from a database from a browser and I can't find
anyone or any support for the database I'm using.

I'm trying to find ANY database engine that will output database queried
data to a browser via a Perl CCI script successfully.


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

Date: Fri, 21 Nov 1997 20:19:35 -0500
From: Bill Cowan <billc@tibinc.com>
To: Martin <techno@pedal.se>
Subject: Re: Error when closing database connection
Message-Id: <34763327.416FC95D@tibinc.com>

Martin wrote:
> ...
> At the end of the script
> I tried to call the close( ) function but received strange errors.
> The lines of inportance are:
> 
> use win32::ODBC;
> $DSN = "budwin";
> $db = new Win32::ODBC($DSN);
> $db->Sql("SELECT .........");
> $db->close();
      ^^^
This may be a typo, but the method name has a capital "C" such as 

	$db->Close();
 
> 
> When calling "close()" perl returns:
> Goto undefined subroutine &autoloader::AUTOLOAD at [path]ODBC.pm line
> 861.
> 

-- Bill


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

Date: 22 Nov 1997 03:40:12 GMT
From: robertf@geminet.com (Robert G. Ferrell)
Subject: Re: Error when closing database connection
Message-Id: <655k6s$bbq@clarknet.clark.net>

> Can I remove this line without
> risking to leave open connections to the SQL-server?

Try using 

$db->disconnect


Robert G. Ferrell
US Geological Survey



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

Date: 21 Nov 1997 23:26:14 -0500
From: karabot@plato.cs.concordia.ca (KARABOTSOS george)
Subject: Good Perl book
Message-Id: <weghg95a715.fsf@plato.cs.concordia.ca>

Hello,

I will be shoping for a Perl book soon, so any suggestions are
welcome.

Thank you.
-- 
-----------------------------------------------------
		  George Karabotsos
             Computer Science Department
                 Concordia University
                  Montreal PQ Canada
-----------------------------------------------------


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

Date: 22 Nov 1997 05:20:22 GMT
From: twod@not.valid
Subject: Re: Good Perl book
Message-Id: <655q2m$cvo$2@vnetnews.value.net>

KARABOTSOS george (karabot@plato.cs.concordia.ca) wrote:
: I will be shoping for a Perl book soon, so any suggestions are
: welcome.

IMHO head straight for one or moe of the ORA books - www.ora.com/publishing/
perl/ products.htm. One of the 'learning' (Win32 or ... well, Unix :) 
followed by 'Programming PERL 2nd Ed'.

There are a number of other books, of dubious repute - Learn Perl in 21 days,
etc - but most JAPHs will recommend the ORA books as the defacto standard.

Happy reading

IAP
--
You have mistakenly entered section 26 of disinformation superhighway 9.
Monitored by Main F[ao]rce Patrol. Fatalities this year = 57. Leave now.
I am using anti-spam measures, please replace 'not.valid' with 'value.net'


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

Date: Fri, 21 Nov 1997 16:36:34 -0700
From: Jeff Piurek <jeff777@netzone.com>
Subject: I buy used computers Arizona
Message-Id: <34761B02.7691A1C6@netzone.com>

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

I buy and sell used computers.  If you have an old 486 or better laying
around and want turn it into cash.  Please E-mail me at
jeff777@netzone.com

                  Thanx                Jeff


--------------8D69E412D3A465915477B9D3
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Jeff Piurek
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Jeff Piurek
n:              Piurek;Jeff
email;internet: jeff777@netzone.com
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------8D69E412D3A465915477B9D3--



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

Date: 22 Nov 1997 00:25:57 GMT
From: Zenin <zenin@best.com>
Subject: Re: is it possible to reference a sub-array?
Message-Id: <880158503.654610@thrush.omix.com>

Kevin Eson <keson@uswest.com> wrote:
: Re-read what Tom had said.
	And my example code.
	
: Yes it is a pass by reference, 
	No, it's not.  It passes "A" reference, but it is NOT pass "BY"
	reference.  

: but it is
: actually a reference to an anonymous array that was created by the
: outer set of braces [ ].
	Correct.  The reason this still is not pass BY reference is because
	the values put into those braces are copys of the original and there
	is no way to modify the original from within the function.  eg, Pass
	by value.

: Personally I'm not sure what benefits you
: gain from this example.  A true pass by reference in this case
: would be:
:      function(\@ARGV);

	Or, if you look at the two posts of code I've shown in this thread
	already, you can see that one CAN pass a SLICE of an array by
	reference as such:

	function ( \( @ARGV[2..#$ARGV] ) );

	If there are 4 elements in the array, this would be identical to
	saying:

	function ( \$ARGV[2], \$ARGV[3] );

	The advantage of the first is of course that you can dynamically set
	your array slice limites, and it's shorter to type, but the effect
	is the same.

: However since it looks like the intent was to pass a subset of the
: original array to be used in "function" I would use the pass by
: value.

	This isn't what they wanted to do.

:  If "function" needed to change the original array I would
: pass a reference to the entire array and then let "function" split
: out the subset needed.

	This is, but they wanted to dynamically deside how much and what
	parts of the array to modify.

	In short:
		YES!  You CAN pass an array SLICE BY REFERENCE
		YES!  It does actually pass by reference the elements of the
		      array so you can modify them.
		NO!   You don't really want to do this without a really good
		      reason.  It's probably going to bite you in the ass if
		      you're not really careful.

-- 
-Zenin
 zenin@best.com


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

Date: Fri, 21 Nov 1997 22:29:43 GMT
From: fox@securenet.net (Pearl Fox)
Subject: Learning Perl(Unix) by O'Reilly in exchange for Learning Perl on Win32 Systems
Message-Id: <654mee$11v$1@news.securenet.net>

I had purchased the book Learning Perl by O'Reilly & Associates, Inc.
only to discover that I needed Learning Perl on Win32 Systems.

Does anyone wish to trade books with me?

Thanks Pearl
Pearl S. Fox,
Montreal (Que.)
http://www.securenet.net/members/fox/index.html



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

Date: Fri, 21 Nov 1997 16:11:09 -0700
From: Curt Madison <madison@U.Arizona.EDU>
Subject: Need a perl/NT consultant
Message-Id: <Pine.A41.3.96.971121160627.36666A-100000@aruba.u.arizona.edu>

Help!
	An application we wrote in Perl running on a unix box now needs to
run on NT.  Is anyone interested in helping us make the transformation?
Immediate gratification.  We expect it may take about a week of work in
conjunction with the application author.  Work to begin immediately.
Contact Curt Madison 907-543-6168 or madison@u.arizona.edu



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

Date: Fri, 21 Nov 1997 19:12:41 -0500
From: calbij@ix.netcom.com
Subject: New to Perl
Message-Id: <34762379.2010@ix.netcom.com>

I am new to perl and would like to know if there is a way that I can set
unix enviornment variables and have them stay set in the users shell
when the perl script ends. I have tried setting the %ENV but this only
seems to last for the life of the script. Any help would be appricated.


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

Date: Fri, 21 Nov 1997 18:40:52 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: New to Perl
Message-Id: <km9556.vp3.ln@localhost>

calbij@ix.netcom.com wrote:
: I am new to perl 


Then let me give you the most helpful of all possible perl advice:

The perl distribution is shipped with hundreds of pages of 
documentation. This documentation can answer most perl-related
questions (and even some OS-related questions, such as yours)

It is free.

If you have a proper perl distribution, then you already have it.

It is more up-to-date than any book can be.

It is specific to the very version of perl that you have installed.

It has been examined by hundreds of people, mistakes there are
found and corrected quickly. Usenet answers are nowhere near
as reliable as the docs that you already have (and Usenet is
much slower as well)


Of course, you do not get any of those benefits if you don't
use the docs   ;-)



: and would like to know if there is a way that I can set
: unix enviornment variables and have them stay set in the users shell
       ^^^^^^^^^^^

If you can spell it correctly, then you can do a word search
for it in the above mentioned docs  ;-)


: when the perl script ends. 


No.


: I have tried setting the %ENV but this only
: seems to last for the life of the script. 

As it should be. I wouldn't want programs that I run to be
changing my environment...


: Any help would be appricated.


See this Frequently Asked Question in the above mentioned docs:

   "I {changed directory, modified my environment} in a perl script.  
    How come the change disappeared when I exited the script?  
    How do I get my changes to be visible?"


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


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

Date: 21 Nov 1997 23:56:27 GMT
From: martin.moessel.no.spam@beasys.com (Martin Moessel)
Subject: Re: Perl and Sybase
Message-Id: <65573b$kft@svlinweb.beasys.com>

In article <3475CC8A.2107@fprsdev3.fmr.com>, Rick Meldrum <rjk@fprsdev3.fmr.com> writes:
==Greg Stanfield wrote:
==> I am trying to connect to a Sybase database from a Perl script.  I have
==> the isql statement ready to go, but cannot figure out the right/best way
==> to connect to the database to pass the isql statement. 
==
==[.....]
==
==I have had relatively good luck with variations of...
==
==$cmds = "$my_password\n exec $myproc $params\n go\n exit\n";
==system "isql -Umy_id<<EOF\n$cmds";

Use sybperl instead. It makes access to SQL Server much easier and you
get the result sets as is, not pumped through isql's formatting routines.
Sybperl is available from CPAN and
	http://www.mbay.net/~mpeppler

Martin
BEA Systems, JOLT Development




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

Date: 20 Nov 1997 21:16:46 GMT
From: "John" <john@nospam.com>
Subject: Perl and Windows 95 File Sizes
Message-Id: <01bcf5f9$a5dcbce0$0a47b1cc@tower>



I was curious, with stat() I can get the size of a file very easily in the
Perl for Win32s, but I cannot figure out a way to get the size of a
directory structure similar to this

- John
	+sudirectory1
	+subdirectory2

I do a stat() on the C:\JOHN and it only tells me how big john is 0, not
how big C:\JOHN and C:\JOHN\SUBDIRECTORY1 as well as C:\JOHN\SUBDIRECTORY2
is.  Anyone know a simple way to do this?  Any help would be appreciated.



- John

Please if you are going to write to me directly,
write to me @shadow.net, not the nospam. :)


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

Date: 21 Nov 1997 22:18:00 -0500
From: dc@panix.com (David W. Crawford)
Subject: perl development package ?
Message-Id: <xz3btzd39cn.fsf@panix3.panix.com>


It occurs to me that there could be a better development 
environment for perl than edlin and just turning on the -w switch
and running.

For example, if you have a program snippet like

	print SPIF "Pass $pass is $cmd_line[$i] \n";

and you run it and receive a warning

Use of uninitialized value at fooboo.pl line 74, <SCAN> chunk 63210.
Use of uninitialized value at fooboo.pl line 94, <SCAN> chunk 63710.

it would be more useful to be told which of

	$pass
	$i
	$cmd_line[$i]

are unititialized.

Another useful tool would give a listing of all variables used
sorted by type (@,$) then by name.

Another tool would tell me the line numbers of lines in which the last 
non-space non-comment character is not a semicolon.

These tools are easy to build.  I could build them myself with perl.
What I am hoping is somebody as collected a suite
of such tools, and this suite does things I neglected to think of.

perl for perl ?
perl.pm ?

David W. Crawford    <dc@panix.com>
Los Gatos, CA        <david@ricochet.net>





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

Date: 22 Nov 1997 05:05:38 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: perl development package ?
Message-Id: <655p72$8ie$1@vixen.cso.uiuc.edu>

David W. Crawford (dc@panix.com) wrote:
: 
: It occurs to me that there could be a better development 
: environment for perl than edlin and just turning on the -w switch
: and running.
: 
: For example, if you have a program snippet like
: 
: 	print SPIF "Pass $pass is $cmd_line[$i] \n";
: 
: and you run it and receive a warning
: 
: Use of uninitialized value at fooboo.pl line 74, <SCAN> chunk 63210.
: Use of uninitialized value at fooboo.pl line 94, <SCAN> chunk 63710.
: 
: it would be more useful to be told which of
: 
: 	$pass
: 	$i
: 	$cmd_line[$i]
: 
: are unititialized.

This is an FAQ, harder than you might think, and (I hear) there is
possibly a solution coming in 5.005.  But as you get better at 
reading stuff you can figure it out yourself pretty easily.

: 
: Another useful tool would give a listing of all variables used
: sorted by type (@,$) then by name.

I don't worry -- I keep my subroutines small, most of my variables
lexical, and go 'use strict' all the way.  Not a problem unless you
write monolithic code.

: 
: Another tool would tell me the line numbers of lines in which the last 
: non-space non-comment character is not a semicolon.

???? If you do lots of print "this\n"; print "that\n"; -- which is
the only reason I can think of for needing this -- you might check
out here documents.

: 
: These tools are easy to build.  I could build them myself with perl.
: What I am hoping is somebody as collected a suite
: of such tools, and this suite does things I neglected to think of.
: 
: perl for perl ?
: perl.pm ?

Did you ever try the Perl debugger?

I think that if you

	1. use strict
	2. use lexical variables
	3. keep your routines small
	4. use -w

all of these things go away. That is why you don't see tools like
this for Perl. 

Regards,
Mike Heins


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

Date: Sat, 22 Nov 1997 10:22:17 +0800
From: Yogesh Sosale Gundurao <yogesh@ncs.com.sg>
Subject: Perl script making CPU idle time 0.
Message-Id: <347641D8.A537D945@ncs.com.sg>

Hi,

I am using a perl script which is run as a cron job on a solaris 2.5.1
box. The script pulls out trouble tickets from a problem management
database and mails out information pertaining to people.

Unfortunateley I need to execute a unix executable file to get specific
information like Ticket No., Assignee etc. This would involve running
this executable about 10 times using grave accent like `$aprioridir/hook
return Assignee from ProbId = $ProbId` for each trouble ticket no. There
would on an average about 20 tickets to escalate every hour.

Now this script runs for about 8 minutes every hour and during this time
I notice that the CPU utilization is 100%. And other processes just
crawl.

Any tips on how to minimize the execution time and reduce cpu usage.

Thanks



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

Date: Fri, 21 Nov 1997 22:10:42 -0500
From: Angelo Kontarinis <akontari@ix.netcom.com>
Subject: Perl/UNIX question
Message-Id: <34764D32.2F319280@ix.netcom.com>

Hi..I am new to CGI/PERL and UNIX.  I am installing a WWWboard script on
a server and I am supposed to chmod a directory.  I have no problem
chmoding a file, but how doe you go about chmoding a directory?  Thanks
so much in advance.

if you could email me that would be great!





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

Date: 22 Nov 1997 05:25:41 GMT
From: twod@not.valid
Subject: Re: Perl/UNIX question
Message-Id: <655qcl$cvo$3@vnetnews.value.net>

Angelo Kontarinis (akontari@ix.netcom.com) wrote:
: Hi..I am new to CGI/PERL and UNIX.  I am installing a WWWboard script on
: a server and I am supposed to chmod a directory.  I have no problem
: chmoding a file, but how doe you go about chmoding a directory?  Thanks
: so much in advance.

man chmod

The chmod command applies to directories and files equally. Understanding the
rwx permissions as they relate to files and directories is another matter,
and is best discussed in a newsgroup that is particular to your OS.

: if you could email me that would be great!

FOAD

IAP
--
You have mistakenly entered section 26 of disinformation superhighway 9.
Monitored by Main F[ao]rce Patrol. Fatalities this year = 57. Leave now.
I am using anti-spam measures, please replace 'not.valid' with 'value.net'


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

Date: 22 Nov 1997 05:01:02 GMT
From: burt@ici.net (Burt Lewis)
Subject: removing lines from a file??
Message-Id: <655oue$fg$1@bashir.ici.net>

Hi,

I need to remove the lines that end with a - and keep the rest.

Not having much luck with this and would appreciate any help/

Thanks!

Burt lewis

This is part of my file:

fosters.GIF - Fri Nov 21 23:19:44 EST 1997 - abcde
fosters - Fri Nov 21 23:19:47 EST 1997 - 
fosters - Fri Nov 21 23:19:49 EST 1997 - xyz 
whist - Fri Nov 21 23:22:16 EST 1997 -  
whist - Fri Nov 21 23:24:47 EST 1997 - rewt
whist - Fri Nov 21 23:31:19 EST 1997 - 
 

Results needed:
fosters.GIF - Fri Nov 21 23:19:44 EST 1997 - abcde
fosters - Fri Nov 21 23:19:49 EST 1997 - xyz
whist - Fri Nov 21 23:24:47 EST 1997 - rewt 



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

Date: Fri, 21 Nov 1997 17:43:05 -0600
From: mpullen@midwest.net (mtp)
Subject: serial port access in NT
Message-Id: <MPG.edfd88387ae1698989680@news.midwest.net>

I am trying to access the serial port on an NT 4.0 workstation.  I have 
read the FAQ and have had no luck.  I seem to just be reading back 
garbage and part of the source code??????  Following is a code section 
that I have tested.  Any ideas??

open (PORT, "+>com2") or die "Error:  $!";
binmode PORT;
print PORT  "AT\n";
while (<PORT>) {
    print;
}
close PORT;


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

Date: Sat, 22 Nov 1997 03:40:13 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: simple pipe question
Message-Id: <ebohlmanEK13J1.90D@netcom.com>

Joel Bremson (staffjb@wenet.net) wrote:
: I'm trying to 'write' a file to a pipe to a mail process. 

: The body of the msg this code outputs is only a ".".
: I want it print the format and then send it.

:         open (MAIL, "| mail -s \"WENET Website Services Agreement\"
: $email") || die "could not open mail pipe $!";
:         $~ = "web_agreement";

This sets the current format for STDOUT.

:         write web_agreement;

This tries to write the current format to the filehandle called 
web_agreement.

:         print MAIL "\.\n";
: 	close MAIL;

: How can I do this?

I *think* you want something like:

select MAIL;
$~ = web_agreement;
select STDOUT;
write MAIL;


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

Date: 22 Nov 1997 05:40:44 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: simple pipe question
Message-Id: <655r8s$mdr$1@daily.bbnplanet.com>

Joel Bremson (staffjb@wenet.net) wrote:
: I'm trying to 'write' a file to a pipe to a mail process. 

: The body of the msg this code outputs is only a ".".
: I want it print the format and then send it.

:         open (MAIL, "| mail -s \"WENET Website Services Agreement\"
: $email") || die "could not open mail pipe $!";

You need to do this
  select MAIL;

before you do this
:         $~ = "web_agreement";

:         write web_agreement;

This should be write MAIL.

:         print MAIL "\.\n";
: 	close MAIL;

man perlvar, perlfunc.

Jason Gloudon


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

Date: Fri, 21 Nov 1997 22:47:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <EK0pz3.KF2@world.std.com>

keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis) writes:

>Or use a technique that is frequently found in the much-spammed binary
>groups; prefix the subject with a fixed string, say "FAQ:".  Then it
>becomes a trivial matter for those who wish to to set up a kill filter
>to zap all those FAQ answers.

There are two problems with that approach:

1. You kill the FAQ answers, but not their originating questions. In
that case I wouldn't see the answers and may waste time answering
them. (I want to kill both the RTFM and the FAQ posts.)

2. The newsreader I use threads on subject lines, not on References
headers. Every once in a while, I make an attempt to use trn, but
unfortunately my brain is wired to "nn"s key sequences and its view of
Usenet. Since the RTFM post has a different subject header than the
original, my threads are screwed up.

Its not that your idea is a bad one, and if there was a growing
momentum to flag posts this way, I'd certainly do my part, but since
I'm dreaming this dream, I get to make my own rules.
-- 
Andrew Langmead


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

Date: Fri, 21 Nov 1997 15:17:53 -0500
From: MrPc <tjbiuso@redrose.net>
Subject: string comparison question...
Message-Id: <3475EC71.98F942E2@redrose.net>

<HTML>
would <I>$hereisastring eq "" </I>work to check if a string is null?</HTML>



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

Date: 22 Nov 1997 03:36:12 GMT
From: robertf@geminet.com (Robert G. Ferrell)
Subject: Re: string comparison question...
Message-Id: <655jvc$bbq@clarknet.clark.net>

In article <3475EC71.98F942E2@redrose.net>, tjbiuso@redrose.net says...

>would $hereisastring eq "" work to check if a string is null?
>

Yes, but you could also say 

[code] if ($hereisastring)

or

if ($hereisastring) {
[code]
}

or even

unless (!$hereisastring) [code]

and so on.

Perl gives you a lot of options.

Hope this helps.

Robert G. Ferrell
US Geological Survey



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

Date: 22 Nov 1997 05:29:29 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: string comparison question...
Message-Id: <655qjp$l9d$1@daily.bbnplanet.com>

Robert G. Ferrell (robertf@geminet.com) wrote:
: In article <3475EC71.98F942E2@redrose.net>, tjbiuso@redrose.net says...

: >would $hereisastring eq "" work to check if a string is null?
: >

: Yes, but you could also say 

: [code] if ($hereisastring)

No. If $hereisastring == '0'. $hereisastring is false.
You have to say if hereastring eq "".

Jason Gloudon


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

Date: Fri, 21 Nov 1997 22:13:23 -0500
From: "Billy Boone" <bboone@lexmark.com>
Subject: System runs as sub-process...
Message-Id: <34764de9.0@usenet.lexmark.com>

Is there a way in perl to run multiple commands in one process environment?

The reason I am asking is because we would like to run the batch files
provided with most compilers to set up the environment (include, lib, etc)
for compiling and then run nmake.

However if you attempt to run (for Visual C++ 4.2):
system("vcvars32 x86");
system("nmake /nologo /f test.mak");

You do not get the desired effect.  I am attempting to create
programmatically what a person would do from a command prompt.

I can create a batch file for this but I would also like to perform some
error checking on the actual compilation and return success or failure.

If you could email me as well as post to the group I would be most
appreciative.

Billy




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

Date: Sat, 22 Nov 1997 02:33:57 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: undef and blessed thingies
Message-Id: <EK10GM.6DJ@bcstec.ca.boeing.com>

In article <34746928.392759AB@mystech.com>,
Mark S. Reibert <reibert@mystech.com> wrote:
 > Question regarding Perl classes whose underlying data type is a hash or an
 > array:
 > 
 > Does undef'ing the hash or array (or assigning to it an empty list) "break"
 > or "dissolve" the blessedness of the thingy?
 > 
 > For example, given a constructor defined as
 > 
 > sub new
 > {
 >   my $type = shift;
 >   my $class = ref($type) || $type;
 >   my $this = {};
 >   bless $this, $class;
 >   return $this;
 > }
 > 
 > Do the following methods "break" the bless so that further use of the
 > object is not allowed?
 > 
 > sub ClearA
 > {
 >   my $this = shift;
 >   undef %$this;
 > }
 > 
 > sub ClearB
 > {
 >   my $this = shift;
 >   %$this = ();
 > }
 > 
 > By the way, initial tests indicate that neither of the Clear methods causes
 > a problem. I think the real question is if undef removes an entry from
 > whatever namespace the bless is adding to. Any thought are appreciated.
 > 

I believe a blessing lasts until the Maker's program exits :)

Your Clear methods simply trash the hash in the house of the 
"blessed" thingy. The "blessed thingy" still stands.  


Shouldst thou changeth the routine thusly though...  

  sub ClearA { undef $_[0] } 


Verily, close your doors to such wickedness, for you shake 
the foundation of the blessed thingy and the house falls.



Ducking,

--
Charles DeRykus


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

Date: 21 Nov 1997 23:38:16 GMT
From: i0l1@ugrad.cs.ubc.ca (William Wei Liong Young)
Subject: Waiting for multiple background processes to Finish
Message-Id: <655618$oj4$1@nnrp.cs.ubc.ca>

Hello,

as the subject says, I want to spawn a bunch of background processes (in
a loop) and then wait for them to finish.  I've been reading FAQ's, tutorials,
books...and I think i went info overload...and am probably overlooking
a simple use of fork, exec.   I've managed to do what I want in a shell
script:

csh---

set count = 0
while( $count < 10 )
  command &
  @ count ++
end
wait

and i have even been able to do it in NT Perl with the Win32::Process
module:

win32----

use Win32::Process;
$count = 0;
while( $count < 10 )
{
   Win32::Process::Create( $ProcessObj[ $count ],
		           "command location...",
		 	   "command",
			   0, # no inheritance
			   DETACHED_PROCESS,
			   "." );
  $ProcessObj[ $count ]->SetPriorityClass( NORMAL_PRIORITY_CLASS );
}
Win32::Process::WaitForMultipleObjects( \@ProcessObj, 1, INFINITE );


I just can't seem to get it right for unix PERL.  Just a clarification, 
I want all the processes to be running at the same time and then wait for
them to finish...not run one process, wait for it too finish, run another
one..etc.  I also know that if i really had to, I could do a:
@psResult = system( "ps -e |grep command");
@pids = #parse the psResult for pids
waitpid @pids;   # NOTE: not sure if waitpid takes array argument

but that would be kinda ugly and not too portable.

any tips would be great,
thanks,
Will


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

Date: 21 Nov 1997 23:49:50 GMT
From: i0l1@ugrad.cs.ubc.ca (William Wei Liong Young)
Subject: Re: Waiting for multiple background processes to Finish
Message-Id: <6556mu$olk$1@nnrp.cs.ubc.ca>

Hah...wouldn't you know it.  3 seconds after i post my message,
i figure out how to do it myself.  for those who care (probably 
no-one...but i like to hear myself type :) this is what i was originaly
doing (which would not work):

#start 10 instances of command running in background
for( $i = 0 ; $i < 10 ; $i++ )
{
	unless( fork ) {
	   exec( "command &" );
	}
}

# wait for all 10 commands to finish
for( $i = 0 ; $i < 10 ; $i++ )
{
	wait;
}

my problem was in the exec( "command &" ) call...since it was exec
I didn't need that dang '&' sign...stupid me.

but i have a new query...is there any better way to wait for all
the processes besides putting the 'wait' in a loop?

thanks again,
will

	



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

Date: 21 Nov 1997 18:23:36 -0600
From: Ken MacLeod <ken@bitsko.slc.ut.us>
Subject: xs and mortality
Message-Id: <m3wwi1zshi.fsf@biff.bitsko.slc.ut.us>

Perl 5.003, RedHat Linux 4.2

I have a xsub that create's tons and tons of objects, some temporary
and some part of the objects that get returned.  All my temps just
happen to be using arrays and hashes, so I use `av_undef' and
`hv_undef' to free the arrays and hashes.

I'm still leaking memory somewhere and I don't know if it's my
interface or the library I am calling.  Is there a way to check how
much memory is taken by Perl objects that I can check over time?  Any
other suggestions?

Thanks,

-- 
  Ken MacLeod
  ken@bitsko.slc.ut.us


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

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

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