[8704] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2321 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 14 18:07:38 1998

Date: Tue, 14 Apr 98 15:00:26 -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           Tue, 14 Apr 1998     Volume: 8 Number: 2321

Today's topics:
    Re: Apache/ModPerl Question (Jim Turner)
    Re: Bill Gates should be invited to O'Reilly's "Free So (Andreas Borchert)
        Converting GNU chess file to different form <spamfree@yahoo.com>
    Re: Docs for SDBM file (Mark-Jason Dominus)
    Re: formatting localtime output <dcameron@nospam.bcs.org.uk>
    Re: greed <dean@tbone.biol.sc.edu>
    Re: HELP!!! Script to perform website search (Jim Turner)
    Re: Hide or Encrypt perl source code (Chris Adams)
    Re: How to call external C++ libraries in Perl? (advanc <zenin@archive.rhps.org>
    Re: how to post to usenet with a perl cgi... <Matthew.Healy@yale.edu>
    Re: Ideas for installations <mbunks@coincnx.com>
    Re: Need to find web-based e-mail client in Perl! <dean@tbone.biol.sc.edu>
    Re: perl win 32 :  asterisk on command line (Stuart McDow)
        perl5.004 compiling problem (two makefile's????) <jkit@jpmorgan.com>
        problems with crypt <steves@wco.com>
    Re: Project involving Word <root@mail.mcoe.k12.ca.us>
    Re: Recursive Calls in Perl ? <zenin@archive.rhps.org>
    Re: Recursive Calls in Perl ? <dean@tbone.biol.sc.edu>
    Re: sybperl: obtaining return code from stored procedur mpeppler@mbay.net
    Re: trying to use grep to give an exact match <smubit1@gl.umbc.edu>
        unpack/substr of variable length lines <Robert.Lopez@abq.sc.philips.com>
        Weird Truncate Behavior <upsetter@shore.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 14 Apr 1998 20:53:33 GMT
From: turnerj@cliffy.lmtas.lmco.com (Jim Turner)
Subject: Re: Apache/ModPerl Question
Message-Id: <6h0icd$egh2@quest.lmtas.lmco.com>

Tom Mornini (tmornini@netcom.com) wrote:
: Michael J Schout (mschout@gkg.net) wrote:
: 
: : > are otherwise ignored).  Is there any way to cause the server to NOT send
: : > a header to the browser for you so that the browser will be expecting one
: : > (as is the case in normal CGI?)  I have tried both using and not using
: : > CGI.pm.
: : > 
: : > Thanks in advance for any help!!!!!!!!!!!
: : > 
: : > Jim Turner
: : > jim.turner@lmco.com
: 
: : Remove "PerlSendHeader On" from your httpd.conf file, and just use print
: : $q->header() as normal from CGI.pm.  
: 
: I've had the same problem with Perl 5.004_04 and mod_perl 1.10. It sends
: headers regardless of the PerlSendHeader config.
: 
: -- Tom Mornini
: -- InfoMania

	I DID try removing "PerlSendHeader ON", even changing it to
"PerlSendHeader OFF", to no avail.  Printing "$q->header" is unnecessary,
(I think), since it is ALREADY sending a header for me (which I don't want
because it doesn't set the Window-target).  Thanks for the responses, but
it looks like I still am missing something. :-|

Jim Turner
jim.turner@lmco.com



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

Date: 14 Apr 98 20:35:13 GMT
From: borchert@turing.mathematik.uni-ulm.de (Andreas Borchert)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <3533c881.0@news.uni-ulm.de>

On Tue, 14 Apr 1998 09:18:47 -0400, Chris Nandor <pudge@pobox.com> wrote:
> In article <353303ea.0@news.uni-ulm.de>, borchert@mathematik.uni-ulm.de wrote:
> 
> # Software = program code + associated reference documentation.
> 
> If it helps you sleep at night.
> 
> # Sometimes the associated reference documentation is in separate files,
> # sometimes it is even mixed with the program code (see embedded POD for
> # Perl, for example). Independent from this, it is an integral part of
> # software.
> 
> As I said, so is distribution.  Without distribution, software is
> completely useless; therefore, it is an integral part of software. 

Please do not mix things up. Note that

(1) some parts depend on others and may render useless without them,
(2) some objects consists of several components (i.e. without its
    components it is not only useless but you do not have a complete
    object).

These are two different relations. I am trying to emphasize that
reference documentation is an integral part of software in the
sense of (2) and not just in that of (1).

Maybe, you cannot agree with that. But than you may try to explain
where you are going to draw the boundary line. As mentioned before,
documentation is sometimes even mixed up with the program code (like
comments) in one text file. On the other hand, the definition of
documentation should not depend on its locality (whether it is
mixed up with the program code or not).

Returning to free software we should remember that one of the main
goals is to enjoy sharing and the freedom to improve the sources (and
to make them available to the community back again).  How should this
work practically if the program code is freely available while the
associated reference documentation is non-free?  The burden associated
with changes is comparable to cases where one part of the program is
free while the other part is proprietary (something GPL tries to
avoid). The GPL (as I understand it, please correct me otherwise)
allows program code and documentation to be distributed under different
terms (e.g. program code under GPL and documentation non-free) which
results in some form of a loop hole [1] (well, I know even more people
would bash a GPL-variant closing this loophole for restricting their
freedom of restricting freedom on things that have been formerly free ;-).

Andreas.

[1] This loophole can be closed if the documentation is mixed up
    with the program code (like embedded POD, for example). But
    mixing is not always the preferred method.

-- 
Andreas Borchert, Universitaet Ulm, SAI, Helmholtzstr. 18, 89069 Ulm,  Germany
E-Mail: borchert@mathematik.uni-ulm.de
WWW:	http://www.mathematik.uni-ulm.de/sai/borchert/
PGP key available via ``finger borchert@laborix.mathematik.uni-ulm.de''


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

Date: Tue, 14 Apr 1998 17:17:31 -0400
From: Dave Bushong <spamfree@yahoo.com>
Subject: Converting GNU chess file to different form
Message-Id: <3533D26B.4BC63A2F@yahoo.com>

I wrote a perl script that converts a saved gnuchess game file into
somewhat standard game notation, i.e.

1.  c2c4 ... e7e5
2.  b1c3 ... b8c6
3.  g1f3 ... f8c5

and so on.  The input file looks like:

[bunch of stuff to ignore, then:]

 
move  score depth  nodes  time flags capture color
c2c4     0     0       0     24     0  0xf9cb36ba 0x8cfb676f -1          
e7e5    33     6   10319      2     0  0xa092b7d8 0xae69794b 18          
b1c3     0     0       0      9     0  0x32a3e411 0xda7a2d4 44          
b8c6     8     9 1295182    159     0  0xd885e75b 0xfb0d0270 -1          
g1f3     0     0       0      8     0  0x72f5f9cc 0xe984dafa -1          
f8c5     6     8  863154    106     0  0x66807b20 0x33ad4b47 -1          

and so on, until the end of the game.  There can be an even or odd
number of lines, depending on whether or not it's white's turn or
black's turn.

Here's my script:

# ...
 
# first ignore some preliminary info that gnuchess uses:
 
while(<>) {
        last if /^move\s+/;
}
 

# now the following lines are one move per line, in column one:
 
for($move=2;<>;) {
        die unless /^(\w\d\w\d)\s+/;
        $notation = $1; $line = ($move++)>>1;
 
        print "$line. $notation ... " if $move & 1;
        print "$notation\n" unless $move & 1;
}

###### end of sample code

The part that deals with even or odd lines, and the "move counter"
(versus line counter) is kind of clunky.  What would be a more elegant
way to do this?  It works as is (which is what I wanted), but I'm
curious - how would you have done it?

Reply by email, or follow up here, or both.

Thanks,
Dave

--
Yes, that's really my address


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

Date: 14 Apr 1998 16:17:15 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Docs for SDBM file
Message-Id: <6h0g8b$2pt$1@monet.op.net>


In article <6gv7sk$9q4$1@nnrp1.dejanews.com>,
 <richard.lavey@axa-investmentmanagers.com> wrote:
>I have the latest Win32 Perl and noticed that a DBMS is included (SDBM_File).

Uh-uh.  SDBM_File is *not* a DBMS.

>from this it appears that the file can only be keyed on
>numeric values. Is this true ?

No; they can be keyed by any strings.

>If anyone could point me to a source of info I'd be grateful. 

The documentation is poor, but even if it were good I have a feeling
it wouldn't address things at the level you want.  Maybe this will be
helpful:

SDBM (and the other DBMs) implement persistent hash variables.
Semantically, they are just like Perl's %hash variables, except that
the data you store in them is saved to the disk, so that it persists
after the program has exited, can be read back by a later invocation
of the program, and can be shared between programs.  Also, values
associated with the keys must be strings, and there is an upper limit
on the length of the key and value strings.  In other ways, access to
a DBM file is like access to a hash.

In particular, note that although it can be used to store Data, it is
not a Data Base, cannot be used for Data Base Management, and is not a
Data Base Management System.

You can look up values by key; that's all.  If you want to (say) find
all the items whose `state' column is `Ohio' and whose `volume' column
is larger then 22, guess what, you lose---because DBM files don't have
columns.



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

Date: 14 Apr 1998 21:12:24 GMT
From: "Duncan Cameron" <dcameron@nospam.bcs.org.uk>
Subject: Re: formatting localtime output
Message-Id: <01bd67e9$e0bf0d60$502d63c3@dns.btinternet.com>

[Copy cc'd to poster]

Lee
One neat way of formatting month and day is the following:

$month = ('01'..'12')[$month - 1];
$day = ('01'..'31')[$day - 1];

but be aware that Perl is creating temporary lists of (I think) 12 and 31
elements respectively.  

HTH



Lee Falkenhagen <falkenl@hotmail.com> wrote in article
<01bd672c$25e18300$915c5093@lfalkenhagen.dhs.state.tx.us>...
[snip]
> if you just return localtime, it truncates the leading zero for the month
> and date.
> Is there anyway to put it in there besides doing a "if less than 10, add
> '0' to string" routine?



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

Date: 14 Apr 1998 17:09:53 -0400
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: greed
Message-Id: <87btu4m7oe.fsf@tbone.biol.sc.edu>

sstark@informix.com (Scott Stark) writes:
> Hi, I have a sort of beginner perl question about greediness. I'm trying to get 
>...
> instance, in this case the string 'UNIX'. My code looks like this:
> 
> 	elsif ($line =~ /JHicon\[(.*)\]JH/) {
>                 $gifname=$1;
> 	}
> 
> But for some reason it grabs everything between the first bracket and the last 
> one, so $gifname becomes 'UNIX]JH some more text some more text JHicon[DOS'.

Try:

#!/usr/local/bin/perl -w
use strict;
my($s) = 'JHicon[UNIX]JH some more text some more text JHicon[DOS]JH some more text etc.';
print   "Maximal: ";
print $1 if ($s =~ /JHicon\[(.*)\]JH/);
print "\nMinimal: ";
print $1 if ($s =~ /JHicon\[(.*?)\]JH/);
print "\n";

> BTW, I've looked through both of the Schwartz books and found them so poorly 
> indexed I couldn't find anything useful about greediness.

Some Perl books were written before minimal matching was added to
Perl, so they won't refer to "greediness" (since all pattern matching
was greedy in those days).  The 2nd edition of "Programming Perl" has
references to greedy matching in the index.

If you're interested in regular expressions, you should definitely get
the definitive treatment: Friedl's "Mastering Regular Expressions"
from O'Reilly & Associates (http://www.oreilly.com).  You'll learn
more than you (thought) you ever wanted to know.

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: 14 Apr 1998 20:25:59 GMT
From: turnerj@cliffy.lmtas.lmco.com (Jim Turner)
Subject: Re: HELP!!! Script to perform website search
Message-Id: <6h0gon$egh1@quest.lmtas.lmco.com>

kmyers@syneractive.com wrote:
: Can anyone tell me where I can find a script which when given a keyword and
: domain (ex. usatoday.com) returns all links to pages which contain the
: keyword?
: 
: Thanks.
: 
: -----== Posted via Deja News, The Leader in Internet Discussion ==-----
: http://www.dejanews.com/   Now offering spam-free web-based newsreading

Try using something like the following:

-------------------------------------------------------------------------
#!/usr/local/bin/perl
use LWP::Simple;

$data = 
LWP::Simple::get("http://search.yahoo.com/bin/search?p=${ARGV[0]}&a=n&chk=on);
-------------------------------------------------------------------------

	You can then examine the text in "$data" for the links. $data
contains the 1st page of links returned (in this case by Yahoo(R)).
NOTE:  You will need the "LWP" library.

	Hope this helps,


	Jim Turner
jim.turner@lmco.com



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

Date: 14 Apr 1998 20:26:49 GMT
From: cadams@ro.com (Chris Adams)
Subject: Re: Hide or Encrypt perl source code
Message-Id: <6h0gq9$d3d$1@news.ro.com>

According to Tom Christiansen  <tchrist@mox.perl.com>:
>I can't see any danger with 755.  It's 777 that has naughtiness.  Being
>able to read something is no danger.  In fact, it enhances security by
>avoiding the oxymoronic security-through-obscurity myth.

Well, there are some scripts that it would be nice to not have world
readble.  For example: our modem login system logs access to a MySQL
database.  I want users to be able to check their usage but not anyone
else's usage.  The database requires a username and password to connect,
but then I have to put them in the perl script that checks usage.  How
can I keep them from the users if the script is world-readble?  The only
safe way I can see is to make the usage checker a setuid perl script
that is only readable by user.  Then your security is as good as the
restrictions your OS and suidperl put on setuid scripts.
-- 
Chris Adams - cadams@ro.com
System Administrator - Renaissance Internet Services
I don't speak for anybody but myself - that's enough trouble.


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

Date: 14 Apr 1998 20:59:43 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: How to call external C++ libraries in Perl? (advanced)
Message-Id: <892588006.231155@thrush.omix.com>

Jun Sun <jsun@geoworks.com> wrote:
: 2. I understand the corresponding Perl extion module can be either
: statically linked or dynamically loaded.

	Yes.

: What about the original C/C++ library.

	This must be linked to the module, but need not be statically
	linked.

: I assume it must be linked to the perl interpretor image as well.

	Not needed if the module is dynamically loaded.  That's the point
	of dynamically loaded modules.

: 3.  If the assumption in 2 is correct, is it possible for me to compile
: the C/C++ library
: into a DLL/shared library and let it be invoked in Perl through a
: dynamic loaded Perl module?

	Yes.

: The whole purpose here is to keep the
: current perl interpretor not changed
: while I can add a extension module which calls a C library.

	You're in luck.  This is the whole purpose of dynamically loaded
	perl modules. :-)

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Tue, 14 Apr 1998 17:29:26 -0400
From: "Matthew D. Healy, Ph.D." <Matthew.Healy@yale.edu>
Subject: Re: how to post to usenet with a perl cgi...
Message-Id: <6h0kfg$5h9$1@news.ycc.yale.edu>


auctionmaster@auctionaddict.com wrote in message
<6h0bji$qqg$1@nnrp1.dejanews.com>...
>does anyone know of any scripts that will post to usenet via cgi written in
>perl?


Please explain why -- OTHER THAN SPAMMING -- you wish to do this.

I fervently hope nobody here will be foolish enough to answer this

unless a convincing answer is forthcoming!






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

Date: Tue, 14 Apr 1998 15:43:19 -0500
From: Mark Bunkowske <mbunks@coincnx.com>
Subject: Re: Ideas for installations
Message-Id: <3533CA67.E1E42446@coincnx.com>



Grinch wrote:

> Abigail wrote in message <6gug2p$5mh$1@client3.news.psi.net>...
>
> >Mark Bunkowske (mbunks@coincnx.com) wrote on MDCLXXXVI September MCMXCIII
> >in <URL: news:35327256.74B7514A@coincnx.com>:
>
> >++ Im not really looking for code, I just need a plan of action where I can
> >++ start and feedback to make sure Im going in the right direction..
> >
> >
> >You mention CGI 4 times, but you don't mention perl once.  There is
> >*NOTHING* in the post that even vaguely smells like a perl subject.
>

ok...Perl (hope that helps)

> >
> >Why are you posting this here?
>

I thought that a CGI/Perl group (Perl IS a CGI language) would be able to at
least offer an additional idea or two about a CGI/Perl method of doing this.  I
know I didn't necessarily want any code to accomplish this.  Just because Im not
asking how to parse strings in Perl doesnt mean its not a Perl question.

Im sure you havent looked (I have) for a more relevent group to post this in but
there isnt a group named "comp.copy-protection.www.cgi" or anything close.
This group is more heavily traveled than the
"comp.infosystems.www.authoring.cgi" group and it takes about the same amount of
time to offer an opinion of the topic I asked about as it does to flame me for
posting to the wrong group.

The term "misc" normally means something like "anything that is not covered by
something already listed" so I thought that I would give this group a try.

Its not like this has *NOTHING* to do with Perl.  The algorithm will eventually
be done in Perl code (I also asked if something was possible in the language
since I am not yet that familiar with it). Since Perl is probably the most
common CGI language I felt that there wouldnt be TOO much problem with posting
it here. I guess I was wrong.

> Mark your calendars... I agree with Abigail on this one. Although, I still
> don't like the currently popular trend of telling people to look somewhere
> else for answers, without giving them any guidance concerning where to look.
> It kind of seems like a waste of one's time to spend it posting such a
> non-response. Well, anyway, it's your time not mine, so whatever...
>
> If you're not looking for code, you won't get much help from a
> language-specific newsgroup. You may have better luck in the
> "comp.infosystems.www.authoring.cgi" group. If you're willing to live with a
> Windows-only solution, you may want to look into the documentation on
> Microsoft's web site concerning Active Channels.
>
> HTH!
>
> -grinch
>
> ----
> "Of course coffee doesn't make the world go around. It
> just makes it go faster." - me
>
> Sherm Pendley
> grinch@whoville.com
> http://www.whoville.com

  Thanks for pointing me to a semi-proper newsgroup for this question. Of the 7
people that emailed me for posting to the wrong group, Grinch is the only one
who gave me something remotely useful.

Mark



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

Date: 14 Apr 1998 16:12:10 -0400
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
To: Elmira Alimova <ea187@columbia.edu>,rap@endymion.com
Subject: Re: Need to find web-based e-mail client in Perl!
Message-Id: <87emz0macl.fsf@tbone.biol.sc.edu>

Elmira Alimova <ea187@columbia.edu> writes:
> Hello! My school is installing web kiosks for the students. Idea is to
> enable them to get mail also. If anyone knows of perl script that will
> work as a web-based e-mail client,let me know. Help is greatly
> appreciated. 

As others have pointed out, there's the Mailman program available from
Endymion.  I tried that and found it useful, but a bit buggy (and I
wanted to modify some features).  

If you're interested, my version can be fetched from:

http://zebra.biol.sc.edu/mailman/mailman.txt
http://zebra.biol.sc.edu/mailman/mailman.ini

Make sure to get both parts.  The first part is the script itself
(which you'll probably want to have as "index.cgi" in a mailman
directory on your server), and the second is the "mailman.ini" file
which sets up all sorts of aspects of how the program runs.  In its
present form, the program has relict defaults for fields that are
defined in the "mailman.ini" file.  The defaults within the program
are unlikely to work (I've changed some of the assumptions the code
makes about their content).  The program file should be changed to
reflect the new code and .ini file.  In my copious free time...

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: 14 Apr 1998 20:20:53 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: perl win 32 :  asterisk on command line
Message-Id: <6h0gf5$lue$1@ns1.arlut.utexas.edu>

daclay@NOSPAMzip.com.au (Excession) writes:
>
> ..., for fork() I'd use spawn() ...

If my understanding of spawn() is correct, it is not nearly the same
as fork(). As I understand it, spawn() is used to create a new,
*different* process, similar to a fork(), followed by the child
immediately calling exec().

How would one use spawn() to create an exact clone of the parent,
which is what fork() does? I think that there's a misconception that
the only reason to call fork() is so that the child can call exec(). A
child process can do anything it wants, including calling
exec(). Forking a child to do a specific task obviates the need for
threads, and is probably faster than thread-based execution anyway. At
any rate, if there is a way to use spawn() to get a clone of the
parent, I haven't seen it.

If there is, someone please clue me in.

--
Stuart McDow                                     Applied Research Laboratories
smcdow@arlut.utexas.edu                      The University of Texas at Austin
  "It is obvious that about 750,000 people ago, Austin was a wonderful City."


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

Date: Tue, 14 Apr 1998 16:37:08 -0400
From: jkit <jkit@jpmorgan.com>
Subject: perl5.004 compiling problem (two makefile's????)
Message-Id: <3533C8F4.F6045356@jpmorgan.com>

During compiling I get the following messages.  Why?

make: Warning: Both 'makefile' and 'Makefile' exist

Why is there two?  Which one does make use?

Thanks in advance.

John



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

Date: Tue, 14 Apr 1998 13:54:20 -0700
From: Steven Smith <steves@wco.com>
Subject: problems with crypt
Message-Id: <3533CCFC.BDBF27D2@wco.com>

I seem to be getting the same output from crypt for differing clear text
input.  What's wrong here?
  DB<14> print crypt('testing124', 'Cd')
CdnHbyg.zu42Q
  DB<15>  print crypt('testing126', 'Cd')
CdnHbyg.zu42Q
  DB<16> print crypt('testing125', 'Cd')
CdnHbyg.zu42Q
  DB<17> print crypt('testing127', 'Cd')
CdnHbyg.zu42Q
  DB<18> print crypt('testing128', 'Cd')
CdnHbyg.zu42Q

I must be doing something foolish, but don't see what it is!

Thanks
Steve Smith
DSC Corp.
Petaluma, CA



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

Date: Tue, 14 Apr 1998 13:27:14 -0700
From: Mcoe NT <root@mail.mcoe.k12.ca.us>
Subject: Re: Project involving Word
Message-Id: <3533C6A2.29796C1@mail.mcoe.k12.ca.us>

Thank you Frank for this information. I will look into this. Can I get
OLE at CPAN?

Frank wrote:

> Mcoe NT <root@mail.mcoe.k12.ca.us> writes:
>
> >
> > Hello group,
> >
> > I have a project where i need to parse a scanned doc and insert the
> > whatever ( I say "whatever" because I am not sure what they are) to
> turn
> > this doc into a word template file as a word form. This way my
> client
> > can scan docs in, turn them into word forms, fill them in and print
> them
> > or whatever.  Does any one know of any modules that will allow me to
>
> > control word in this way.
> >
> > Thanks. joseph.
> >
> Hello Joseph!
>
> OLE::Storage is a module, which might be of interest. As far as I
> understand it allows _read_ access to Word docs. You meant this text
> system right?
>
> I would advise to stay away as far as possible from any
> semi-documented format. Use some known thing (richtext ?) and import
> it into your application.
>
> regards
>         Frank





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

Date: 14 Apr 1998 21:04:12 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Recursive Calls in Perl ?
Message-Id: <892588274.824022@thrush.omix.com>

Grace Cheng <gcheng@corp.sgi.com> wrote:
: Is it possible to do 'recursion' in Perl ?
: The manul says the "Subroutines may be called recursively"
: but I couldn't seem to get it to work.

	Run top.  Then run this script:

	#!/usr/local/bin/perl
	sub bomb {
	    while (1) {
	        fork() && bomb();
	    }
	}

	If you're system load jumps through the roof, recursion works.
	I mention to run top first because, well, after you start the
	above script you may not be able to start anything else for a
	while. :-)

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 14 Apr 1998 17:17:50 -0400
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: Recursive Calls in Perl ?
Message-Id: <87af9om7b5.fsf@tbone.biol.sc.edu>

Grace Cheng <gcheng@corp.sgi.com> writes:
> Hi,
> 
> Is it possible to do 'recursion' in Perl ?
> 
> The manul says the "Subroutines may be called recursively"
> but I couldn't seem to get it to work. 
> 
> Thanks!

#!/usr/local/bin/perl -w
use strict;
recurse(0);
sub recurse {
    my($level) = shift;
    print " " x $level, "Level $level entered\n";
    recurse($level + 1) if ($level < 50);
    print " " x $level, "Level $level departing\n";
}

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: Tue, 14 Apr 1998 16:23:34 -0600
From: mpeppler@mbay.net
Subject: Re: sybperl: obtaining return code from stored procedure
Message-Id: <6h0k4m$6lg$1@nnrp1.dejanews.com>

In article <6h0f1p$vht$1@nnrp1.dejanews.com>,
  donat@wwa.com wrote:
>
> Rather than use output parameters, I would prefer to make use of the
returned
> values for Sybase stored procedures.  I have attempted this using the
> dbresults and
> dbretstatus, to no avail.  Is there a way to accomplish this?

Sure.

Assuming the sproc has a
	return @rc
statement, then you do

$dbh->dbcmd("exec the_sproc \@p1=foo, \@p2=bar");
$dbh->dbsqlexec;
while($dbh->dbresults != NO_MORE_RESULTS) {
    if($dbh->DBROWS) { # this result has rows, so process them
	while(@dat = $dbh->dbnextrow) {
		...
	}
    }
    if($dbh->dbhasretstat) {
        $rc = $dbh->dbretstatus;
    }
}

You should also check out the dbretdata() calls to access OUTPUT
parameters of sprocs.

Michael

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 14 Apr 1998 16:45:42 -0400
From: Stephen Mubita <smubit1@gl.umbc.edu>
Subject: Re: trying to use grep to give an exact match
Message-Id: <Pine.SGI.3.96.980414164226.14897B-100000@tapestud.gl.umbc.edu>

On Mon, 13 Apr 1998, Michael Shavel wrote:

=>  I'm trying to use grep to give me an exact match on a string.. not to match
=> if the string is contained in another string. Example.. I would like this 
=> to give me back "cat" but it gives me back both "cat" and "tomcat"
=> 
=> Is there an option to grep I can use for an exact match?
=> 
=> Is there a perl pod someone could point me to for this answer please?
=> 
=> 
=> $c = "cat";
=> 
=> @string=("cat", "dog", "alligator", "tomcat");
=> 
=> @cats = grep(/$c/o, @string);
=> 
=> print "@cats\n";

$c = "cat";
@string=("cat", "dog", "alligator", "tomcat");
foreach $thingy (@string)
{
   $thingy =~ m/^cat$/ and push @cats, $thingy;
}
print "@cats\n";





--
Stephen Mubita       "All Scripture is God-breathed and is useful for
smubit1@umbc.edu      teaching, correcting, rebuking, and training in 
                      righteousness, so that the man of God may be 
                      thoroughly equipped for every good work." 
                                                  2 Timothy 3 : 16 - 17
-----------------------------------------------------------------------
        UCS is not responsible for any opinions contained here      



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

Date: 14 Apr 1998 14:40:11 -0600
From: Robert Lopez <Robert.Lopez@abq.sc.philips.com>
Subject: unpack/substr of variable length lines
Message-Id: <jc6d8ek6st0.fsf@abqn07.ato.sca.philips.com>


I am converting some data where the data consists of different
kinds of records, where each line begins with a record type indicator.
Every type of record is column oriented, data occures in fixed columns.

Some of the records have optional fields after mandatory fields.

I have been constructing little trials using unpack and substr to
parse the lines. Both seem to me to have similar functionality is
their ability to tolerating reading beyond the end of a line within a
present field and their inability to tolerate reading any new field
beyond the last actual field. By this I mean if the last field was
defined as 50 colunns and only the leftmost 2 are actually used they
handle it.  If there is any attempt to read beyond the last actually
present field they do not handle it. 

So I consider that I have two options:

1) Always measure the length of the line and so long as the length
of the line is not exceeded, keeping parsing off fields. As I am
still trying to think out how I might do this; it seems very cpu-
expensive and time-expensive.

2) Always measure the length of the line and pad the line with space.
This seems less expensive but wasting memory.

I am wondering if there is some other (possibly better) alternative
that I should consider.

-- 
Robert Lopez                    <Robert.Lopez@abq.sc.philips.com>



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

Date: 14 Apr 1998 20:34:29 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Weird Truncate Behavior
Message-Id: <6h0h8l$n1m@fridge.shore.net>


Banging My Head On The Wall dept:

Has anyone seen this? I have a script, based on one of Randal's
WebTechniques scripts (the not-a-file-counter script) that's supposed to
open a file, lock it and write some data out. The way this is implemented,
of course, is to open the file in read/append mode, truncate it once it's
locked and then write out all the data and close the file.


I've been trying to figure out why truncate was returning an error... I
spent about a half an hour on it and finally, because I couldn't think of
anything else to try, I changed the name of my filehandle literal from
HANDLE to OUT. And it worked!

What the heck? Is there any known reason why truncate would fail on the
statement
	truncate (HANDLE, 0)

but succeed on the statement
	truncate (OUT, 0)

assuming that all the other instances of the filehandle name were changed
also?

Just wondering,

--Art

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

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

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