[6681] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 306 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 15 14:17:25 1997

Date: Tue, 15 Apr 97 11:00:38 -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, 15 Apr 1997     Volume: 8 Number: 306

Today's topics:
     Re: [Q] Converting a string to lower case (Tad McClellan)
     [Q] How to capitilize beginning of words amas@lhr-sys.dhl.com
     Re: [Q] How to capitilize beginning of words <tchrist@mox.perl.com>
     Re: [Q] Returning an array of hashes (David Alan Black)
     Re: Beginner - Time constaints <dorman@s3i.com.anti-spam>
     blocking server example? (Jeff Stampes)
     CGI::Carp qw(fatalsToBrowser) and DBI ... <thalabi@incyedge.com>
     Executing a perl script in solaris 2.5 (wayne t. watson)
     Fatal Unsigned/Signed Arithmetic Problem <emagnuss@mcd.intel.com>
     Re: formatting large numbers <tchrist@mox.perl.com>
     Re: formatting large numbers (RHS Linux User)
     Re: Grabbing links from html pages? (Andy Wardley)
     Help for Perl on WIN32 <jspencer@netcomuk.co.uk>
     Re: Kudos to Tom Christiansen and problems with OO <nmljn@wombat.netsinc.com>
     locking and DBM files <otisg@panther.middlebury.edu>
     Re: Need  a math program <seay@absyss.fr>
     Re: Oraperl (Timothy Hall)
     Perl on Alpha NT <Bill.Bailey@biznetz.com>
     Precedence and operators <gdegamo@netsinc.com>
     question: How does one substitute into something other  (Terrence M. Brannon)
     question: How does one substitute into something other  (Terrence M. Brannon)
     Re: removing first 2 characters from scalar value. <danboo@ixl.com>
     Re: Reply to Ousterhout's reply (was Re: Ousterhout and <fbonnet@irisa.fr>
     Re: SLEEP (.5) ??? (Scott)
     Re: sorting a *file* (yeah, I know, it's a mainframe co (Tad McClellan)
     Re: sorting a *file* (yeah, I know, it's a mainframe co <chapman@techctr.buddcompany.com>
     Re: Unix and ease of use  (WAS: Who makes more ...) (Jettero Heller)
     Why doesn't until(<FILE> =~ /^\D/) {   work? (H. Todd Chapman)
     Win 32: tie/sdbm problems. (Massimo Morelli)
     Win32 :: ODBC <acgator@erols.com>
     Win32::ODBC errors <acgator@erols.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 15 Apr 1997 06:17:57 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: [Q] Converting a string to lower case
Message-Id: <55ovi5.pq.ln@localhost>

amas@lhr-sys.dhl.com wrote:

: Subject: [Q] Converting a string to lower case
                                      ^^^^^^^^^^

: Coming from AWK I feel a bit lost without certain of my favourite
  ^^^^^^^^^^^^^^^

They got man pages for that awk thingie?


We got 'em for perl.

They are included with the perl distribution!

grep -i 'lower case' *.pod       finds two lines. One of them says:


perlop.pod:    $ARGV[1] =~ tr/A-Z/a-z/; # canonicalize to lower case
(text taken verbatim from _your own_ Subject)             ^^^^^^^^^^

Then you would go read about tr///, and have the answer in what?
About 60 seconds? Or post to c.l.p.m and wait a day (86,400 seconds)
for someone else to read the docs for you?


[
  Also look into the awk-to-perl translator (a2p). Then you can
  write your familiar awk construct, and see it translated 
  (not always idiomatically though) to perl for you.
]


: function calls. One of these is the toLower() and toUpper() calls.


$_ = lc($_);        # another way


: I am still new to this regexp stuff, so could someone show me how
                         ^^^^^^^^^^^^

Neither of those are regex stuff. They are faster that the equivalent
regex [  s/([A-Z])/\L$1/g;  ]

Besides those three ways, there is a fourth, using string interpolation:

$_ = "\L$_";


Besides those four ways, there are... well, more ways ;-)


: to do this. A bit more detail might help: specifically I would like
: to take a string that contains any sort of character and only change
: the case of the alpabetic characters and leave the rest alone.


: Thanks for any help


Uh huh.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 15 Apr 1997 11:01:40 -0600
From: amas@lhr-sys.dhl.com
Subject: [Q] How to capitilize beginning of words
Message-Id: <861119811.23628@dejanews.com>

I have looked in O'Reilly's Learning Perl book, but can't seem to
find a solution to this problem.  I have a string of words that are
all in caps and I would like to convert it to lower case and then
capitilize the beginning of each word. I know how to do the first
part:
   $myString =~ tr/A-Z/a-z/;

Though I am not too sure how to do the second part. Also since
it is for a web server, a solution that does not take too long to
execute would be appreciated, though I am ready to accept anything.

Thanks

Andre

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


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

Date: 15 Apr 1997 16:59:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: [Q] How to capitilize beginning of words
Message-Id: <5j0c6f$73g$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    amas@lhr-sys.dhl.com writes:
:I have looked in O'Reilly's Learning Perl book, but can't seem to
:find a solution to this problem.  I have a string of words that are
:all in caps and I would like to convert it to lower case and then
:capitilize the beginning of each word. I know how to do the first
:part:
:   $myString =~ tr/A-Z/a-z/;
:
:Though I am not too sure how to do the second part. Also since
:it is for a web server, a solution that does not take too long to
:execute would be appreciated, though I am ready to accept anything.

You have asked a question or talked about an issue that's specifically
addressed in the Perl Frequently Asked Questions list.  If you haven't
done so yet, could you please read it through and see whether it doesn't
help shed some light on the topic.  If it is no longer in your local
news spool, you may get the FAQ from

    http://www.perl.com/perl/faq/

Here's just the list of questions:

PART 0:
    Where to get this document
    How to contribute to this document
    What will happen if you mail your Perl programming 
        problems to the authors
    Credits
    Author and Copyright Information
    Non-commercial Reproduction
    Commercial Reproduction
    Disclaimer
    Changes

PART 1:
    What is Perl?
    Who supports Perl?  Who develops it?  Why is it free?
    Which version of Perl should I use?
    What are perl4 and perl5?
    How stable is Perl?
    Is Perl difficult to learn?
    How does Perl compare with other languages like Java, 
        Python, REXX, Scheme, or Tcl?
    Can I do [task] in Perl?
    When shouldn't I program in Perl?
    What's the difference between "perl" and "Perl"?
    Is it a Perl program or a Perl script?
    What is a JAPH?
    Where can I get a list of Larry Wall witticisms?
    How can I convince my sysadmin/supervisor/employees to 
        use version (5/5.004/Perl instead of some other language)?

PART 2:
    What machines support Perl?  Where do I get it?
    How can I get a binary version of Perl?
    I copied the Perl binary from one machine to another, 
        but scripts don't work.
    I grabbed the sources and tried to compile but gdbm/dynamic 
        loading/malloc/linking/... failed.  How do I make it work?
    What modules and extensions are available for Perl?  
        What is CPAN?  What does CPAN/src/... mean?
    Is there an ISO or ANSI certified version of Perl?
    Where can I get information on Perl?
    What are the Perl newsgroups on USENET?  Where do I 
        post questions?
    Where should I post source code?
    Perl Books
    Perl in Magazines
    Perl on the Net: FTP and WWW Access
    What mailing lists are there for perl?
    Archives of comp.lang.perl.misc
    Perl Training
    Where can I buy a commercial version of Perl?
    Where do I send bug reports?
    What is perl.com?  perl.org?  The Perl Institute?
    How do I learn about object-oriented Perl programming?

PART 3:
    How do I do (anything)?
    How can I use Perl interactively?
    Is there a Perl shell?
    How do I debug my Perl programs?
    How do I profile my Perl programs?
    How do I cross-reference my Perl programs?
    Is there a pretty-printer (formatter) for Perl?
    Is there a ctags for Perl?
    Where can I get Perl macros for vi?
    Where can I get perl-mode for emacs?
    How can I use curses with Perl?
    How can I use X or Tk with Perl?
    How can I generate simple menus without using CGI or Tk?
    Can I dynamically load C routines into Perl?
    What is undump?
    How can I make my Perl program run faster?
    How can I make my Perl program take less memory?
    Is it unsafe to return a pointer to local data?
    How can I free an array or hash so my program shrinks?
    How can I make my CGI script more efficient?
    How can I hide the source for my Perl program?
    How can I compile my Perl program into byte-code or C?
    How can I get '#!perl' to work on [MSDOS,NT,...]?
    Can I write useful perl programs on the command line?
    Why don't perl one-liners work on my DOS/Mac/VMS system?
    Where can I learn about CGI or Web programming in Perl?
    Where can I learn about object-oriented Perl programming?
    Where can I learn about linking C with Perl? [h2xs, xsubpp]
    I've read perlembed, perlguts, etc., but I can't embed perl 
        in my C program, what am I doing wrong?
    When I tried to run my script, I got this message. What 
        does it mean?
    What's MakeMaker?

PART 4:
    Why isn't my octal data interpreted correctly?
    Does perl have a round function?  What about ceil() 
        and floor()?  Trig functions?
    How do I convert bits into ints?
    How do I multiply matrices?
    How do I perform an operation on a series of integers?
    How can I output Roman numerals?
    Why aren't my random numbers random?
    How do I find the week-of-the-year/day-of-the-year?
    How can I compare two date strings?
    How can I take a string and turn it into epoch seconds?
    How can I find the Julian Day?
    Does Perl have a year 2000 problem?
    How do I validate input?
    How do I unescape a string?
    How do I remove consecutive pairs of characters?
    How do I expand function calls in a string?
    How do I find matching/nesting anything?
    How do I reverse a string?
    How do I expand tabs in a string?
    How do I reformat a paragraph?
    How can I access/change the first N letters of a string?
    How do I change the Nth occurrence of something?
    How can I count the number of occurrences of a substring 
        within a string?
--> How do I capitalize all the words on one line?
    How can I split a [character] delimited string except 
        when inside [character]? (Comma-separated files)
    How do I strip blank space from the beginning/end of a string?
    How do I extract selected columns from a string?
    How do I find the soundex value of a string?
    How can I expand variables in text strings?
    What's wrong with always quoting "$vars"?
    Why don't my <<HERE documents work?
    What is the difference between $array[1] and @array[1]?
    How can I extract just the unique elements of an array?
    How can I tell whether an array contains a certain element?
    How do I compute the difference of two arrays?  How do 
        I compute the intersection of two arrays?
    How do I find the first array element for which a condition 
        is true?
    How do I handle linked lists?
    How do I handle circular lists?
    How do I shuffle an array randomly?
    How do I process/modify each element of an array?
    How do I select a random element from an array?
    How do I permute N elements of a list?
    How do I sort an array by (anything)?
    How do I manipulate arrays of bits?
    Why does defined() return true on empty arrays and hashes?
    How do I process an entire hash?
    What happens if I add or remove keys from a hash while 
        iterating over it?
    How do I look up a hash element by value?
    How can I know how many entries are in a hash?
    How do I sort a hash (optionally by value instead of key)?
    How can I always keep my hash sorted?
    What's the difference between "delete" and "undef" with hashes?
    Why don't my tied hashes make the defined/exists distinction?
    How do I reset an each() operation part-way through?
    How can I get the unique keys from two hashes?
    How can I store a multidimensional array in a DBM file?
    How can I make my hash remember the order I put elements into it?
    Why does passing a subroutine an undefined element in a hash 
        create it?
    How can I make the Perl equivalent of a C structure/C++ 
        class/hash or array of hashes or arrays?
    How can I use a reference as a hash key?
    How do I handle binary data correctly?
    How do I determine whether a scalar is a 
        number/whole/integer/float?
    How do I keep persistent data across program calls?
    How do I print out or copy a recursive data structure?
    How do I define methods for every class/object?
    How do I verify a credit card checksum?

PART 5:
    How do I flush/unbuffer a filehandle?  Why must I do this?
    How do I change one line in a file/delete a line in 
        a file/insert a line in the middle of a file/append to 
        the beginning of a file?
    How do I count the number of lines in a file?
    How do I make a temporary file name?
    How can I manipulate fixed-record-length files?
    How can I make a filehandle local to a subroutine?  How do I 
        pass filehandles between subroutines?  How do I make 
        an array of filehandles?
    How can I set up a footer format to be used with write()?
    How can I write() into a string?
    How can I output my numbers with commas added?
    How can I translate tildes (~) in a filename?
    How come when I open the file read-write it wipes it out?
    Why do I sometimes get an "Argument list too long" when I use <*>?
    Is there a leak/bug in glob()?
    How can I open a file with a leading "E<gt>" or trailing blanks?
    How can I reliably rename a file?
    How can I lock a file?
    What can't I just open(FH, ">file.lock")?
    I still don't get locking.  I just want to increment the number 
        in the file.  How can I do this?
    How do I randomly update a binary file?
    How do I get a file's timestamp in perl?
    How do I set a file's timestamp in perl?
    How do I print to more than one file at once?
    How can I read in a file by paragraphs?
    How can I read a single character from a file?  From the keyboard?
    How can I tell if there's a character waiting on a filehandle?
    How do I open a file without blocking?
    How do I create a file only if it doesn't exist?
    How do I do a C<tail -f> in perl?
    How do I dup() a filehandle in Perl?
    How do I close a file descriptor by number?
    Why can't I use "C:\temp\foo" in DOS paths?  What 
        doesn't `C:\temp\foo.exe` work?
    Why doesn't glob("*.*") get all the files?
    Why does Perl let me delete read-only files?  Why 
        does C<-i> clobber protected files?  Isn't this 
        a bug in Perl?
    How do I select a random line from a file?

PART 6:
    How can I hope to use regular expressions without 
        creating illegible and unmaintainable code?  
    I'm having trouble matching over more than one 
        line.  What's wrong?
    How can I pull out lines between two patterns that 
        are themselves on different lines?
    I put a regular expression into $/ but it didn't 
        work. What's wrong?
    How do I substitute case insensitively on the LHS, but 
        preserving case on the RHS?
    How can I make C<\w> match accented characters?
    How can I match a locale-smart version of C</[a-zA-Z]/>?
    How can I quote a variable to use in a regexp?  
    What is C</o> really for?
    How do I use a regular expression to strip C style 
        comments from a file?
    Can I use Perl regular expressions to match balanced text?
    What does it mean that regexps are greedy?  How can I 
        get around it?
    How do I process each word on each line?
    How can I print out a word-frequency or line-frequency summary?
    How can I do approximate matching?
    How do I efficiently match many regular expressions at once?
    Why don't word-boundary searches with C<\b> work for me?
    Why does using $&, $`, or $' slow my program down?
    What good is C<\G> in a regular expression?
    Are Perl regexps DFAs or NFAs?  Are they POSIX compliant?
    What's wrong with using grep or map in a void context?
    How can I match strings with multi-byte characters?

PART 7:
    Can I get a BNF/yacc/RE for the Perl language?
    What are all these $@%* punctuation signs, and how do I 
        know when to use them?
    Do I always/never have to quote my strings or use semicolons 
        and commas?
    How do I skip some return values?
    How do I temporarily block warnings?
    What's an extension?
    Why do Perl operators have different precedence than C operators?
    How do I declare/create a structure?
    How do I create a module?
    How do I create a class?
    How can I tell if a variable is tainted?
    What's a closure?
    How can I pass/return a {Function, FileHandle, Array, Hash, 
        Method, Regexp}?
    How do I create a static variable?
    What's the difference between dynamic and lexical (static) 
        scoping?  Between local() and my()?
    How can I access a dynamic variable while a similarly 
        named lexical is in scope?
    What's the difference between deep and shallow binding?
    Why doesn't "local($foo) = <FILE>;" work right?
    How do I redefine a built-in function, operator, or method?
    What's the difference between calling a function 
        as &foo and foo()?
    How do I create a switch or case statement?
    How can I catch accesses to undefined variables/functions/methods?
    Why can't a method included in this same file be found?
    How can I find out my current package?

PART 8:
    How do I find out which operating system I'm running under?
    How come exec() doesn't return?
    How do I do fancy stuff with the keyboard/screen/mouse?
    How do I ask the user for a password?
    How do I read and write the serial port?
    How do I decode encrypted password files?
    How do I start a process in the background?
    How do I trap control characters/signals?
    How do I modify the shadow password file on a Unix system?
    How do I set the time and date?
    How can I sleep() or alarm() for under a second?
    How can I measure time under a second?
    How can I do an atexit() or setjmp()/longjmp()? (Exception  
        handling)
    Why doesn't my sockets program work under System V (Solaris)? 
        What does the error message "Protocol not supported" mean?
    How can I call my system's unique C functions from Perl?
    Where do I get the include files to do ioctl() or syscall()?
    Why do setuid perl scripts complain about kernel problems?
    How can I open a pipe both to and from a command?
    How can I capture STDERR from an external command?
    Why doesn't open() return an error when a pipe open fails?
    What's wrong with using backticks in a void context?
    How can I call backticks without shell processing?
    Why can't my script read from STDIN after I 
        gave it EOF (^D on Unix, ^Z on MSDOS)?
    How can I convert my shell script to perl?
    Can I use perl to run a telnet or ftp session?
    How can I write expect in Perl?
    Is there a way to hide perl's command line from 
        programs such as "ps"?
    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?
    How do I close a process's filehandle without waiting for 
        it to complete?
    How do I fork a daemon process?
    How do I make my program run with sh and csh?
    How do I keep my own module/library directory?
    How do I find out if I'm running interactively or not?
    How do I timeout a slow event?
    How do I set CPU limits?
    How do I avoid zombies on a Unix system?
    How do I use an SQL database?
    How do I make a system() exit on control-C?
    How do I open a file without blocking?
    How do I install a CPAN module?

PART 9:
    My CGI script runs from the command line but not the 
        browser.  Can you help me fix it?
    How do I remove HTML from a string?
    How do I extract URLs?
    How do I download a file from the user's machine?  How 
        do I open a file on another machine?
    How do I make a pop-up menu in HTML?
    How do I fetch an HTML file?
    how do I decode or create those %-encodings on the web?
    How do I redirect to another page?
    How do I put a password on my web pages?
    How do I edit my .htpasswd and .htgroup files with Perl?
    How do I parse an email header?
    How do I decode a CGI form?
    How do I check a valid email address?
    How do I decode a MIME/BASE64 string?
    How do I return the user's email address?
    How do I send/read mail?
    How do I find out my hostname/domainname/IP address?
    How do I fetch a news article or the active newsgroups?
    How do I fetch/put an FTP file?
    How can I do RPC in Perl?

-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    If I allowed "next $label" then I'd also have to allow "goto $label",
    and I don't think you really want that...  :-) [now works in perl5!]
            --Larry Wall in <1991Mar11.230002.27271@jpl-devvax.jpl.nasa.gov>


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

Date: 15 Apr 1997 17:05:10 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: [Q] Returning an array of hashes
Message-Id: <5j0cg6$fik@pirate.shu.edu>

Vegard Bakke <vegardb@knoll.hibu.no> writes:

>I'm having problem with an array of hashes.
>This example illustrates my problem.
>Can someone tell me what's wrong?


>-------------------------------
>#!/opt/local/bin/perl -w

>use strict;
>use diagnostics;

>sub Func ()
>{
>   my(@A, %H, $I);

>   for($I=0; $I < 5; $I++) {
>      $H{'pos'} = $I;
>      $H{'neg'} = -$I;
>      $A[$I] = \%H;
>      print "Func: $I $A[$I]->{'pos'}\n";
>   }

>   return @A;
>}

>my(@Ar, $I);

>@Ar = Func();
>for ($I=0; $I <= $#Ar; $I++) {
>   print "main: $I $Ar[$I]->{'neg'}\n";
>}

>Running the script:
>$ ./test.pl 
>Func: 0 0
>Func: 1 1
>Func: 2 2
>Func: 3 3
>Func: 4 4
>main: 0 -4
>main: 1 -4
>main: 2 -4
>main: 3 -4
>main: 4 -4


>Why is every tuppel in the array @Ar equal to the
>last tuppel of @A? It gets the number of tupples right.

Well... each time through the loop in the function, you
store a reference to %H in @Ar.  However, this is probably
not what you want, since you then end up with an array
whose five elements are all references to the same hash.

That hash, in turn, has precisely one key-value pair, namely:
'pos' => 4 (at least, that's how it is at the end of the
loop).  Whoops, it has two, but to test your code I
pared it down to one.  Same idea.

So the loop in the main code gets the 'pos' value (4) from
*the same hash* five times.  And that value, having been
set in turn to 0, 1, 2, 3, 4, is 4 when the function exits.


David Black
dblack@icarus.shu.edu


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

Date: 15 Apr 1997 11:59:46 -0400
From: Clark Dorman <dorman@s3i.com.anti-spam>
Subject: Re: Beginner - Time constaints
Message-Id: <dk9m4cm4t.fsf@s3i.com>


This post is directed not specifically at Russ, but at perl users in
general.  I am having serious difficulties with signals (kill, stop,
cont) between processes, and I'm trying to understand.  If you have
any help you can give, please do so.  If there is a working script
that does this, please send it to me.  

Russ Allbery <rra@stanford.edu> writes:
> Mark Turner <turnerm@cs.man.ac.uk> writes:
> 
> > I am writing a Perl program which halfway through executes a C program,
> > I would like to put some kind of time constraint on this C program so
> > the it carn't get stuck in a continous loop.
> 
> > What I need to say in Perl it execute this C program and if it hasn't
> > completed within 3 seconds stop it running.
> 
> Something along the lines of the following (UNTESTED) should work:
> 
> my $pid = fork;
> if (not defined $pid) { die "couldn't fork: $!" }
> if ($pid) {
>     # In parent.
>     sleep 3;
>     kill $pid;
> } else {
>     # In child.
>     exec 'c-program';
>     # NOT REACHED
> }

Unfortunately, on my system this does not work (SparcStation 2,
Solaris, SunOS 5.4, csh, Perl 5.003).  What happens is that the kill
signal goes out, but something goes wrong and the exec'ed program does
not die.  Also, the program becomes an orphaned process when the
parent dies.  Here's my program (the sleeps are so I can do so ps's
and figure out what's going on):

----------------------------------------------------------------------
#!/home/dorman/bin/perl
my $pid = fork;
if (not defined $pid) { die "couldn't fork: $!" }
if ($pid) {
   # In parent.
   print " Child pid is ($pid) \n";
   sleep 30;
   kill $pid or die "arghhhh ($!)";
   sleep 10;
} else {
   # In child.
   sleep 20;
   print "In child, launching \n";
   exec 'time_waster';
}
----------------------------------------------------------------------

Initially, after launching it (it's called kil.pl, the c-program is
time_waster) I have the following (sorry about the line length, I need
the PPID):

grant:testdir (11:23am) 159% ps -gl
 F   UID   PID  PPID CP PRI NI   SZ  RSS    WCHAN S TT        TIME COMMAND
 8    22  3157  2391 14  58 20 1768 1200 modlinka S pts/8     0:00 /home/dorman/bin/perl kil.pl

So far so good.  After  20 secs, I get the child:

 F   UID   PID  PPID CP PRI NI   SZ  RSS    WCHAN S TT        TIME COMMAND
 8    22  3157  2391 14  58 20 1768 1200 modlinka S pts/8     0:00 /home/dorman/bin/perl kil.pl
 8    22  3158  3157  1  58 20 1768  504 modlinka S pts/8     0:00 /home/dorman/bin/perl kil.pl

After ten more seconds, I get the following:

 F   UID   PID  PPID CP PRI NI   SZ  RSS    WCHAN S TT        TIME COMMAND
 8    22  3157  2391 14  58 20 1768 1200 modlinka S pts/8     0:00 /home/dorman/bin/perl kil.pl
 8    22  3158  3157 80   0 20  572  220          O pts/8     0:09 time_waster

After the kill goes out, I get:

arghhhh (Interrupted system call) at kil.pl line 9.

And then:

 F   UID   PID  PPID CP PRI NI   SZ  RSS    WCHAN S TT        TIME COMMAND
 8    22  3158     1 80   0 20  572  220          O pts/8     0:12 time_waster

Instead of:

kill $pid

you can use 

system ("kill $pid");

And that works.  This indicates to me that either something is wrong
with the way that perl doing signals or something is wrong with the C
library (possible, it's a sun, remember; I'm using POSIX, btw), or you
can do things with system calls that don't work from inside the
program.

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

For various reasons, in my own case (I've been working on this for a
while), I dont want to do an "exec" in the child.  I want to do a
system("time_waster") or an open(FOO, "time_waster |").  This is even
worse.  

#!/home/dorman/bin/perl
my $pid = fork;
if (not defined $pid) { die "couldn't fork: $!" }
if ($pid) {
   # In parent.
   print " Child pid is ($pid) in parent \n";
   sleep 8;
   print " Killing child from parent\n";
   system("kill $pid");
} else {
   # In child.
   print " Exec'ing in child\n";
   system("time_waster");
}

This is using system kill because of the above.  However, this kills
the perl child quite nicely, but the process called "time_waster" goes
on it's merry way.  Yes, if I really wanted to, I could, in the
parent, go through the list of processes running on the cpu, find the
c-program child of the child, and kill it too (haven't tried that,
would it work?).  However, in the particular case that I'm interested
in, the thing that I'm doing system on is not a simple c-program, but
rather a csh script (hey, it's not my fault!  I didn't write the damn
thing, I just _have_ to use it).  And that csh script itself is
launching children.  Ugh.  So, do I really have to go through the
process list, find the children, find the chidren of the children (and
their children), etc.  ?  What I want to do is what happens when I hit
Cntl-C at the keyboard or kill -9 job_id: The child and all of it's
children and everything under it dies.  But it doesn't do that.

(Actually, not to complicate things any further, but what I really
want to do is to send it a STOP signal, and then later send it a CONT
signal to restart it, based on the system load.  But let's worry about
that later.)

In case I'm not being clear:  Help!!  I'm confused and frustrated!  

--
Clark


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

Date: 15 Apr 1997 16:41:49 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: blocking server example?
Message-Id: <5j0b4d$i3m$1@neocad.com>

I'm probably being a bonehead, but I'll let someone point it out
and entertain the rest of you.

I'm working on a testcase server, as a way to avoid needing a locking
mechanism that would need to be ported to 6 different platforms.
I have basic client/server functionality working, but am having 
problems getting the server to only process one request at a time and
queue up the remaining requests and prcess them in order.

Does anyone have a good basic example of a blocking server like this
that will only fork off one request at a time? 

Thanks,

Jeff 

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


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

Date: Tue, 15 Apr 1997 15:50:30 GMT
From: Tarif Halabi <thalabi@incyedge.com>
Subject: CGI::Carp qw(fatalsToBrowser) and DBI ...
Message-Id: <3353A3C6.1AC7@incyedge.com>

Hi,

Whenever I include 'use CGI::Carp qw(fatalsToBrowser);' in my
code that uses DBI/DBD-mSQL I get the following error when my script
exits:

<H1>Software error:</H1>
<CODE>Can't locate DBI object method "DESTROY" via package
"DBD::mSQL::dr" during global destruction.
</CODE>

Has anyone seen this before?

My environment is the following:

Solaris 2.5.1
Perl 5.003
CGI 2.29
DBI 0.73
DBD-mSQL 0.63

Regards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tarif Halabi	   Email: thalabi@incyedge.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Tue, 15 Apr 1997 16:45:12 GMT
From: wayne@netcom.com (wayne t. watson)
Subject: Executing a perl script in solaris 2.5
Message-Id: <wayneE8ouJD.4p1@netcom.com>

I am trying to execute a perl script on solaris 2.5, but
it gives me errors immediately.  perl seems to be in
/usr/dist/exe.  Here's the snippet of code:

#!/usr/dist/exe/perl5
#!/usr/bin/perl

@lines = `du @ARGV`;

It dies immeidately on encountering @lines. Any ideas?

-- 
    Wayne T. Watson  |                              |     /  *              
   The Software Hill |  Consulting in C, UNIX, C++  |    /              .    *
   Mountain View, CA |  Motif, X-Windows, Graphics  |   //            *
    (415) 969-4233   |    Statistics, Science,      |  o         *      .
   wayne@netcom.com  |  Space Sciences, Astronomy   |              .     * 

NOTE: As of late 3/97 Comet Hale-Bopp is easily visible 
      in the morning sky around 4:30am low in the NE,
      or in the evening around 7:30pm in the NW.


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

Date: Tue, 15 Apr 1997 09:26:30 -0700
From: Melissa Magnusson <emagnuss@mcd.intel.com>
Subject: Fatal Unsigned/Signed Arithmetic Problem
Message-Id: <3353AC36.41C6@mcd.intel.com>

# I am porting a large Perl program from version 4 to version 5.  I have
# found a Fatal arithmetic problem.  It appears that Perl4 is using
# unsigned integers, and Perl5 is using signed integers.  In perl5,
# whenever bit 31 is set, 'signed' interpretation results, whereas
# perl4 assumes unsigned.  The code requires unsigned integers up to
# 0xFFFFFFFF (2^32 - 1).  

# Is this a reported bug, with a known work around?

# Are there any ways in Perl5 to force a unsigned/signed
#  context when dealing with large integers?

# Here are some results of various experiments showing different
#   results.

# This has been seen on Sun, HP, and AIX platforms
# Perl4 rev: 4.0.1.8  Patch level: 36
# Perl5 rev: 5.003 with EMBED

&printResult(0x80000000);
#Perl4 X 80000000 2147483647
#Perl5 X 80000000 -2147483648

&printResult(0x80 << 24);
#Perl4 X 80000000 -2147483648
#Perl5 X 80000000 -2147483648


&printResult(0x80 * 0x1000000);
#Perl4 X 80000000 2147483647
#Perl5 X 80000000 -2147483648

######################
$y = "80";

&printResult(hex($y) << 24);
#Perl4 X 80000000 2147483647
#Perl5 X 80000000 -2147483648

&printResult(hex($y) * 0x1000000);
#Perl4 X 80000000 2147483647
#Perl5 X 80000000 -2147483648

sub printResult {
printf ("$] X %x %d\n", $_[0], $_[0]);
};


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

Date: 15 Apr 1997 15:48:22 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: formatting large numbers
Message-Id: <5j0806$1ul$5@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, przec@westminster.ac.uk (David Waters) writes:
:If I have a price say over 999 , e.g.
:1000.87 or 1345.65 or 5467.00 how do I format so - 
:1,000.87 1,345.65 and 5,467.00 .

    http://www.perl.com/perl/faq/

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."
	--Larry Wall in <1994Jul21.173737.16853@netlabs.com>


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

Date: 15 Apr 1997 11:51:33 -0400
From: mike@localhost.localdomain (RHS Linux User)
Subject: Re: formatting large numbers
Message-Id: <5j0865$246@localhost.localdomain>

In article <5j05tv$b3s@badger.wmin.ac.uk>,
David Waters <przec@westminster.ac.uk> wrote:

>If I have a price say over 999 , e.g.
>1000.87 or 1345.65 or 5467.00 how do I format so - 
>1,000.87 1,345.65 and 5,467.00 .

In The Gory Details section of the 2nd edition of programming Perl (page
74 in the first printing of the second edition) there's an example:

  # put commas in the right places in an integer
  1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/;

and in the debugger...

  DB<1> $num = '1345.65'

  DB<2> 1 while $num =~ s/(\d)(\d\d\d)(?!\d)/$1,$2/

  DB<3> X num
$num = '1,345.65'

note that (?!\d) is a perl 5 feature, and that you can use this without
ill effect on real numbers with 2 digits after the .

Hope this helps,

Mike


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


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

Date: 15 Apr 1997 17:27:56 +0100
From: abw@peritas.com (Andy Wardley)
Subject: Re: Grabbing links from html pages?
Message-Id: <5j0aac$c9m@aoxomoxoa.peritas.com>

<David_D._Jones@hud.gov> wrote:
>I want to be get every link from an HTML document.  Actually what I really
>want is everything between the <A HREF> and </A> tags.  I can get this to
>work if there is only one link per line,  but I'm not sure how to do this
>if there is more than one link per line or it the link spans more then
>one line.   Any suggestions?


$/ = ''; # read a paragraph at a time

while (<>) {
	print "$1\n" while (/<a href=.*?>(.*?)<\/a>/sig);
}


The regexp flags are:
  s = treat entire input as a single line
  i = ignore case
  g = global (match all instances)



You might want to check out the FAQ for answers to this and much, much 
more.


A

-- 
Andy Wardley <abw@peritas.com>  **NEW** http://www.peritas.com/~abw 
A responsible and professional individual who has no need for silly 
comments, inane banter or bizarre "in-jokes" in his signature file.  


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

Date: 15 Apr 1997 15:41:35 GMT
From: "Sidney Snodgrass" <jspencer@netcomuk.co.uk>
Subject: Help for Perl on WIN32
Message-Id: <01bc49b3$4b8f7e00$6502a713@fce04438.jubilee.ford.com>

Does anyone know of an on-line tutorial for Perl using WIN32, all the
tutorials I have seen so far are for Perl using UNIX.



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

Date: 15 Apr 1997 12:23:23 -0400
From: nelson <nmljn@wombat.netsinc.com>
Subject: Re: Kudos to Tom Christiansen and problems with OO
Message-Id: <w103essp85g.fsf@wombat.netsinc.com>

Andrew J Braithwaite <abraithw@fordx.xcom> writes:
> Tom Christiansen wrote:
> > In comp.lang.perl.misc, will@Starbase.NeoSoft.COM (Will Morse) writes:
> > :I just thought I'd mention that Tom is also an outstanding pianist.
> > Not as good a pianist as Larry is a violinist.
> You could both start a band. You just need a name ... Perl Jam perhaps ? :-)

Badoom CHING.

{Andrew hauled away by long cane amidst volley of rotten vegetables}

BTW, are we talking jazz {piano,violin}, classical, country...?

Any other jazz pianist Perl types out there besides myself?

Cheers,
Laird

--
<laird.nelson@netsinc.com> perl FAQ: http://www.perl.com/perl/faq Perl manual:
http://www.perl.com/CPAN/doc/manual/html/frames.html. If CGI/web appears in
your comp.lang.perl.* post, see news:comp.infosystems.www.authoring.cgi. CGI
stands for Common Gateway *Interface*, not Language or Program or Script.
Consolidated perl reference page: http://www.amherst.edu/~ljnelson/perl.html


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

Date: 15 Apr 1997 17:23:04 GMT
From: "Otis Gospodnetic" <otisg@panther.middlebury.edu>
Subject: locking and DBM files
Message-Id: <01bc49c1$0c35cee0$add1e98c@ns.middlebury.edu>
Keywords: locking dbm files

Hi,

I was wondering if anyone knows what happens when a process tries to access
(read or write to) DBM files that
are already opened by another process.
In other words, when you have something like:

dbmopen(....)

# what happens here - are the files locked by this process or can other
processes access the files?

dbmclose(...)


- I am trying to use DBM files for simple Web advertizement click-through
tracking, and I'm wondering if DBM files are a good way to go if the Web
site has a lot of traffic (and presumably lots of people are clicking on ad
banners at the same time).

Thanks,

Otis


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

Date: Tue, 15 Apr 1997 18:56:40 +0100
From: Douglas Seay <seay@absyss.fr>
To: netwatch@ix.netcom.com
Subject: Re: Need  a math program
Message-Id: <3353C158.3358@absyss.fr>

netwatch@ix.netcom.com wrote:
> 
> I need a perl program that will add.sub, multi, amd div. numbers.
> It must have 3 levels of difficulty. Level 1 use numbers from 1 to 5,
> level 2  use numbers from 1 to 20, and level 3 use numbers from 1 to
> 50.
> I also need a perl program that can be use as a address book. It must
> have name and phone number fields
> Thank you.

It looks like someone doesn't want to do his homework.

Perl can do all the basic math stuff, plus there are modules for doing
more complicated things.  Look around a bit, you'll find it.  As for the
second question, look up simple ideas like "associative array" and then
"list of hashes" or perhaps DB files.  It is all in the Camel.

- doug


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

Date: 15 Apr 1997 15:31:07 GMT
From: thall@lexis-nexis.com (Timothy Hall)
Subject: Re: Oraperl
Message-Id: <5j06vr$8jt@mailgate.lexis-nexis.com>

James A Hunter (UG4) (jah@cs.stir.ac.uk) wrote:
: Just a short note about oraperl and probably something simple to someone who has
: done alot of programming in the area.

: The problem is that I have written a search program to search my database and all
: it seems to do is bring back the first result found, even though their is other
: matches after the one it has found.  See below my program:

: #!/usr/local/bin/oraperl
: require "cgi-lib.pl";

: # reads the information typed in via the web
: &ReadParse(*input);

: # print correct information to start runnung the program
: # on the Web
: print &PrintHeader;
: print &HtmlTop ("Link Search\n");


: $ora_debug = shift if $ARGV[0] =~ /^-#/;
: $lda = &ora_login('t:ora:cs', '', '');

: $csr = &ora_open($lda, 'SELECT address FROM jah.search WHERE look=:1');

: while(<STDIN>)
: {
:   &ora_bind($csr, $input{'search'});
:   if (($address) = &ora_fetch($csr))
:   {
:     print "The link for this search is :-  ";
:     print "<A HREF=\"$address\">";
:     print "$address</A>";
:   }
:   else
:   {
:     print "No data on that, sorry!<BR>";
:   }
: }
: &ora_close($scr);
: &ora_logoff($lda);
: print &HtmlBottom;

: exit 0;

: Thank you to anyone who can help.

: James Hunter 

: jah@cs.stir.ac.uk

--
It's been a while, but I think orafetch returns one line at a time, or an
array. Try that approach, and see if you get everything. If not, free advice
is worth the price. 3;o)
                                    -Tim 

~^-~^~~^-_~^~~^~_-~^~-_-~^_--~~|~~  un-"SPAM" to DROP TIM A LINE
~  hallta@erinet.SPAM.com  ~   ? ~  All opinions are mine
 ~      ~   ~        ~    }<`3$j~   Not my employer's.
~      ~   ~ }<`p;          '    ~  Please excuse any facts
  ()perl      '  <@)c-shell \|/     I may have carelessly
VVV#####VVV#########/ \#########VV  inserted into my opinion.
Unsolicited Commercial E-mail is in violation of USC 47-5(II).


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

Date: 15 Apr 97 15:04:40 GMT
From: "Bill Bailey" <Bill.Bailey@biznetz.com>
Subject: Perl on Alpha NT
Message-Id: <01bc49af$8c6401c0$adcc48c7@office3.thetriad.com>


We are using the BLAT ("sendmail"-like) utility and the Formmail.pl script
available from Matt's Script Archive to create email response forms for the
web.  This is working well on an Intel box running NT, but on a DEC Alpha
box, the exact same script and configuration does not work.  BLAT used from
the command line WILL send the file via SMTP correctly, but the same
command line excuted from Perl as a "system" command doesn't work.  Is this
due to the Alpha box handling something differently in that version of
Perl?  Does anyone know of a workaround?

----------------------------------------------------------------------------
---------------------
Bill Bailey, Sr. System Engineer, BizNetz -- www.TheTriad.com
"In a perfect world, the whole Internet would be this cool!"


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

Date: Tue, 15 Apr 1997 12:06:33 -0400
From: Godfrey Degamo <gdegamo@netsinc.com>
Subject: Precedence and operators
Message-Id: <3353A789.59A@netsinc.com>

Hello.  I've been reading the O'Reilly's Perl5 book.  I'm having a hard
time understanding the example given in Chapter 2 (The Gory Details, the
end of the Operators section):

unlink "alpha", "beta", "gamma"
       or gripe(), next LINE;

With the C-style operators that would have to be written like this:

unlink ("alpha", "beta", "gamma")
        || (gripe(), next LINE);


My question(s) is:

for the second example, what if we remove the parenthesis, will Perl see
it as:

unlink "alpha", "beta", ("gamma" || gripe()), next LINE;

If not, what would it be?


Also, since List operators take precedence over the 'or' operator, why
in the
first example (the 'or' one) that everything after unlink is not given
as arguments
to unlink?  Why should the list to unlink end after gamma, and begin
before gripe()
?

Thanks.

-Godfrey Degamo,
 gdegamo@netsinc.com


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

Date: 15 Apr 1997 10:10:13 -0700
From: brannon@bufo.usc.edu (Terrence M. Brannon)
Subject: question: How does one substitute into something other $_? (SORRY!)
Message-Id: <ysiz208c43gx.fsf@bufo.usc.edu>


Found a mirror for the FAQ. Sorry.



-- 
o============o  Sending  unsolicited commercial e-mail (UCE) to this address
 Legal Notice   is indication of your consent to pay me $120/hour for 1 hour
o============o  minimum for professional proofreading & technical assessment.
terrence brannon * brannon@kappa.usc.edu * http://rana.usc.edu:8376/~brannon


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

Date: 15 Apr 1997 10:04:01 -0700
From: brannon@bufo.usc.edu (Terrence M. Brannon)
Subject: question: How does one substitute into something other $_?
Message-Id: <ysiz4td843r5.fsf@bufo.usc.edu>


Every example I have seen in \\(learning\\|programming\\) perl uses $_
for the substiution examples. Hence I have no idea how to do
substitution in other variables.

Also, http://www.perl.org/perl/nmanual/pod/perlfaq.html will not
respond.


-- 
o============o  Sending  unsolicited commercial e-mail (UCE) to this address
 Legal Notice   is indication of your consent to pay me $120/hour for 1 hour
o============o  minimum for professional proofreading & technical assessment.
terrence brannon * brannon@kappa.usc.edu * http://rana.usc.edu:8376/~brannon


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

Date: Tue, 15 Apr 1997 11:10:36 -0400
From: Dan Boorstein <danboo@ixl.com>
To: jmscott@ainet.com
Subject: Re: removing first 2 characters from scalar value.
Message-Id: <33539A6C.BD0765FE@ixl.com>

Joseph M. Scott wrote:
> 
> To the point : is/what there an easy way to remove the first 2
> characters from a scalar value ( in this case it's just a file name )?
> I've dug through the Camel book, but I didn't find anything that would
> accomplish this.  If I over looked please feel free to list a page
> number ( and I will have to seek the forgiveness of Larry, Tom, and
> Randal :-) ).
> 
>         -=joseph
>                 jmscott@ainet.com=-


I would suggest looking up the 'substr' function on page 227
of the new Camel. 

Dan Boorstein
danboo@ixl.com


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

Date: Tue, 15 Apr 1997 17:35:01 +0200
From: Frederic BONNET <fbonnet@irisa.fr>
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <3353A025.52BB@irisa.fr>

Hi,

Bill House wrote:
> Actually, since I'm not in sales and my employer doesn't sell a Lisp
> programming tool, I guess my only "barrow" is that I hate to see good
> technology (and techniques) go under utilized.

Actually, I hate to see bad tecchnology (and techniques) go over
utilized. (HHOS!) 
I think about DOS, Windows, Intel x86, and so on (all this is of course
IMHO).

CU, Fred
-- 
Frederic BONNET		                                fbonnet@irisa.fr
 Ingenieur Ecole des Mines de Nantes/Ecole des Mines de Nantes Engineer
        IRISA Rennes, France - Projet Solidor/Solidor Project
------------------------------------------------------------------------
  Tcl: can't leave     | "Il ne faut jamais remettre au lendemain ce
$env(HOME) without it! | qu'on peut faire le surlendemain" (Oscar WILDE)


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

Date: Tue, 15 Apr 1997 16:33:07 GMT
From: seligman@netcom.com (Scott)
Subject: Re: SLEEP (.5) ???
Message-Id: <seligmanE8otz7.3pD@netcom.com>

In article <fl_aggie-ya02408000R1504970933220001@news.fsu.edu>,
I R A Aggie <fl_aggie@hotmail.com> wrote:
> Seems to be two selects. You needed to read a bit further... :)

Doh!

How right your are.  Thanks much for pointing this out.

-- 
-- Scott Seligman                    will hack perl for computer parts
-- email: seligman@netcom.com


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

Date: Tue, 15 Apr 1997 06:39:24 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: sorting a *file* (yeah, I know, it's a mainframe concept)
Message-Id: <cdpvi5.7s.ln@localhost>

Michael (dbambw@panther.gsu.edu) wrote:
: Hi all,

: I am in the process of re-writing some of our COBOL programs in
: perl.  In one of these, I need to sort a file of records.  Each
: rec might have 10 or 12 fields in it, the fist three being a 5 digit
: workorder number, followed by a last name then a first name.

: The records come in in workorder number, and I need to sort them to
: an outfile in lastname/firstname sort order.

: All the sorting methods in perl seem to be set up to handle associative
: arrays (ie ONE key field, ONE data field). I don't see how a *record*
             ^^^^^^^^^^^^   ^^^^^^^^^^^^^^

But each of those "ones" can itself contain more than one "real" field.

Can't give an exact answer cause you haven't told us enough about
how to identify the fields in your format.


-------------
1) with hash: 

Put the part you want to sort on in the key, put the entire record
to be sorted in the value. Sort the keys, and you'll have sorted values.


$db{'McClellan:Tad'} = '12345 12345 12345 McClellan Tad ...';

Then write a sort routine that splits the key, and sorts accordingly.

-------------
2) with array: 

Write a sort routine to extract the fields to sort on, and sort
accordingly (UNTESTED):


sub by_lastfirst {  # very slow on large lists
   my($lastA, $firstA) = (split /\s+/, $a)[3,4]; # get the two fields
   my($lastB, $firstB) = (split /\s+/, $b)[3,4];

   $lastA cmp $lastB || $firstA cmp $firstB;
}

@sorted = sort by_lastfirst @db;



: (in the mainframe meaning) could be set up as an assoc array, but I


: can't figure out how to *sort a file* (again in the mainframe concept).
                                                      ^^^^^^^^^^^^^^^^^

This is just plain old programming. 

Nothing unique to mainframes in it...


: So how 'bout it, any other ex-COBOLers out there?:-)

Not me.   ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 15 Apr 1997 13:32:32 -0400
From: Harold Todd Chapman <chapman@techctr.buddcompany.com>
To: Michael <dbambw@panther.gsu.edu>
Subject: Re: sorting a *file* (yeah, I know, it's a mainframe concept)
Message-Id: <3353BBB0.41C6@techctr.buddcompany.com>

http://www.perl.com/perl/everything_to_know/sort.html

Have fun!


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

Date: 15 Apr 1997 15:24:23 GMT
From: heller@nacs.net (Jettero Heller)
Subject: Re: Unix and ease of use  (WAS: Who makes more ...)
Message-Id: <5j06j7$hoh@tracy.nacs.net>

Tim Behrendsen (tim@a-sis.com) wrote:
: I don't accept excuses for my employees, I don't accept excuses
: for myself, and I don't accept them for Larry Wall.  There is no
: excuse for code without comments.  Period.

Oh yes there is. If the code is written for the author only (as is
the case with perl) then he/she *does not* need to comment didly!
Don't try to push *your* personal coding beliefs on other people.
If you can't accept other peoples coding styles, then don't look at
their code! Larry Wall, Brian Kernighan, or myself *DO NOT* answer
to you in regards to our code, so basically we don't care what you
want us to do!

** Heller

-- 
                 http://www.nacs.net/~heller/funny
Can you imagine having an implant so the government can track you anywhere
you go? It's coming and we're bringing it to you, AT&T.
OK, not AT&T but: http://www.acsp.uic.edu/TechNews/9605002.htm



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

Date: 15 Apr 1997 13:18:11 -0400
From: htchapma@vela.acs.oakland.edu (H. Todd Chapman)
Subject: Why doesn't until(<FILE> =~ /^\D/) {   work?
Message-Id: <5j0d8j$gao@saturn.acs.oakland.edu>

I wanted to use the following:

until(<FILE> =~ /^\D/) {        
	($node, $x, $y, $z) = split;
        if (exists $nodes_hash{$node}) {
                $nodes_hash{$node} = join ' ', $x, $y, $z;
        }
}

but htat didn't work, so I tried:

until(<FILE> =~ /^\D/) {        
        ($node, $x, $y, $z) = split;
        if (exists $nodes_hash{$node}) {
                $nodes_hash{$node} = join ' ', $x, $y, $z;
        }
}


which also failed so I tried:

while(<FILE>) {
        if (/^\D/) {last;}
        ($node, $x, $y, $z) = split;
        if (exists $nodes_hash{$node}) {
                $nodes_hash{$node} = join ' ', $x, $y, $z;
        }
}

Which works, as I expected. Why do the other two methods not woek?

Thanks. <htchapma@oakland.edu>



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

Date: Tue, 15 Apr 1997 17:14:37 GMT
From: Massimo.Morelli@comune.bologna.it (Massimo Morelli)
Subject: Win 32: tie/sdbm problems.
Message-Id: <3353b4a7.38806444@news.comune.bologna.it>

It seems I have problems with tie/sdbm (I tried also dbmopen).
I have windows 95.
Perl version:
------------------------------------------------------------------
Perl for Win32 Build 304 - Built 10:41:07 Mar 22 1997

This is perl, version 5.003_07
------------------------------------------------------------------

My program (purged):
------------------------------------------------------------------
use strict;
require 'AnyDBM_File.pm';
sub O_CREAT { 0x0100 }
sub O_BINARY { 0x8000 }
sub O_RDWR { 0x0002 }

my $str = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
my (%sez, %db, $i, $key);
tie(%sez, 'SDBM_File', "FILE1", O_RDWR | O_CREAT | O_BINARY, 0660) 
	or die "cannot tie $!";

foreach $i (1..700){
   $sez{$i} = $str;
}
untie %sez;
#-----------------------------------------------
# simulating other program ....

tie(%db, 'SDBM_File', "FILE1" , O_RDWR | O_CREAT | O_BINARY, 0660) or
die "cannot tie $!";
foreach $key (sort{$a <=> $b} keys %db) {
    print "K: $key; V: $db{$key}\n";
}
untie %db;

------------------------------------------------------------------
The output (yes, I used -w):
------------------------------------------------------------------
S: 10; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 11; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 12; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 13; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 14; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
[cut]
S: 519; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 529; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 590; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 606; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 607; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 608; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 609; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 617; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 618; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 619; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 628; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 629; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
S: 639; V: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
------------------------------------------------------------------
There are holes everywhere! Where are the keys from 639 to 700?
------------------------------------------------------------------
Thanks in advance for any help.

Massimo Morelli


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

Date: Tue, 15 Apr 1997 13:06:33 -0400
From: ErnieCee <acgator@erols.com>
Subject: Win32 :: ODBC
Message-Id: <3353B599.4146@erols.com>


Does anyone know of a place where I can get example scripts of Perl code
using the Win32:ODBC extension with SQLnet?  Or does anyone have any
they could send directly to me?  I am using Perl for Win32 and need to
connect to an Oracle database and call stored procedures within the Perl
script, and am looking for examples to get me going in the right
direction.  Any help would be greatly appreciated.

acgator@erols.com


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

Date: Tue, 15 Apr 1997 13:10:54 -0400
From: ErnieCee <acgator@erols.com>
Subject: Win32::ODBC errors
Message-Id: <3353B69E.6D99@erols.com>


I have been trying to run the test.pl script that is included in with
the Win32::ODBC extension.  My directory structure is a little different
than what is indicated in the readme file, but I put the applicable
files in the correct directories.  When I run the script it crashes at
the first statement that is use Win32::ODBC;, and I get an error message
that says "Exception: Parse Error".  If anyone has any thoughts as to
what the problem could be, please post a message or send me a message
directly. Thanks!

aron_ceely@notes.pw.com or acgator@erols.com


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

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

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