[6852] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 477 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 14 19:07:32 1997

Date: Wed, 14 May 97 16:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 14 May 1997     Volume: 8 Number: 477

Today's topics:
     Re: [++] Re: Question: regexp reduction? (Bill Totten)
     Re: Basic debugging <Jan.Krynicky@st.ms.mff.cuni.cz>
     Re: CGI Environment vars <mfry@his.com>
     Re: CGI Environment vars (Mads Toftum)
     Re: CGI Environment vars <sibsib@hotmail.com>
     Compiling error with version 5.003 <william.oliver@trw.com>
     Compiling Perl 5.003 (Jonas J. Schlein)
     Re: control-M makes for very long $_ (Jeff Stampes)
     Cursor positioning (Matthew Burnham)
     Re: dbf database files and perl <pdenman@ims.ltd.uk>
     exporting new() and a question about local (Justin C Lloyd)
     Re: Finding a pattern in a file (Abigail)
     Re: Help with sorting Hashes (Lists of Hashes) <deven@fuse.net>
     Re: HELP: Continously Perl script !! <rootbeer@teleport.com>
     Re: inclu-OR in regex (Ilya Zakharevich)
     Re: Lists question <tkeitt@santafe.edu>
     Re: Looking for book recommendation for Learning PERL.. <johnc@interactive.ibm.com>
     perl debugger problem with object destructors? <sde@netcom.ca>
     Re: perl debugger problem with object destructors? (Ilya Zakharevich)
     perldb and Xemacs version 19.14 <gary@www.rdss.com>
     Re: PerlScript Objects (David D Webb)
     Re: PerlScript Objects (David D Webb)
     Please...Be easy on me!! <dartec@shadow1.mfg.sgi.com>
     Re: Please...Be easy on me!! <dean@tbone.biol.sc.edu>
     Q: Missing library when Installing Oraperl <Chris.van.Arum@cmg.nl>
     Re: Randal Schwartz (Tung-chiang Yang)
     Re: Regex problem - removing trailing form input <djohnson@uu.net>
     setuid & setgid scripts executed via cgi/internet <chrisre@medianet.com>
     Re: splitting text <nnyxcu@ny.ubs.com>
     suggestion for the last element position $# <jong@mrc-lmb.cam.ac.uk>
     Re: sybperl problem <sde@netcom.ca>
     Re: Week numbers (Steffen Beyer)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 11 May 1997 03:56:31 -0400
From: biell@copland.udel.edu (Bill Totten)
Subject: Re: [++] Re: Question: regexp reduction?
Message-Id: <5l3u3f$r1l$1@copland.udel.edu>

In article <862845991.6613@dejanews.com>,
Ying Chen <yingchen@fir.fbc.com> wrote:
>As I browse the FAQ again... I came upon what perl regexp is suppose
>to be more like NFA - (therefore the back-refencing features)
>I suppose - to keep this simple - we can stick to DFA - but I suppose
>using perl-backreferencing features the regexp can be reduced furthur?


  Non-deterministic Finite Automata(NFA), Deterministic Finite Automata(DFA),
same difference. NFA's and DFA's are inter-compilable. Any ed derivative
Regular Expresion(RE) system is going to convert the RE to a NFA, then to
a DFA, then interpret/generate code for it in the native language,
*in theory*. Even code which looks like it goes straight from RE to DFA
will probably have some of this hidden in the background. The algorithm
for compiling a NFA to a DFA is very simple and fast. However, I have
never actually looked at the code for the perl RE module.

  I may be wrong, but:
You may want to look into Automata Theory and the Theory of Regular Languages
in general more closely. It is a fairly small area. Most of the work was
done by Stephen Kleene (Possibly most known for Kleene's Recursion Theorm(KRT)
which proves the computablity of self reference for affective programming
systems) during a summer internship. It is interesting and small; so, why
not learn more about it if you have the time.

  I am normally against off-topic posts and usually go straight to the author
with them; however, I feel that all perl programers should learn more about
the theory of regular languages or at least RE's.

  Interesting note: The class of all regular languages is concidered small,
yet it is infinite in size.
-- 
Totten, William David (Bill)         Computer and Information Science Major
totten@pobox.com                   University of Delaware (Newark, DE; USA)
http://pobox.com/~totten/               Friends don't let friends use emacs


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

Date: Wed, 14 May 1997 20:51:08 -0700
From: Jan Krynicky <Jan.Krynicky@st.ms.mff.cuni.cz>
To: mfry@his.com
Subject: Re: Basic debugging
Message-Id: <337A882C.77D2@st.ms.mff.cuni.cz>

Michael Fry wrote:
> 
> I've got maybe 5 days of Perl under my belt, so bear with me if this is
> completely idiotic...
> 
> I've been trying to run a fairly simple script (below) on an NCSA Web
> server. The script compiles successfully from the command line, showing
> me the HTML output from the print statements. The browser, on the other
> hand, gives me a '500 server error' and the ever ambiguous 'Error:
> HTTPd: malformed header from script ...dearfry.pl'
> 
> What's happening that makes the script good only from the command line?
> Does that 'malformed header' error message usually mean something more
> specific?
> 
> And is there a specific error, syntactical or otherwise, that the 'error
> log' refers to when it says (cryptically) 'errno is 2' ???
> 
> Thanks very much.
> 
> Michael Fry
> 
> #!/usr/local/bin/perl
> require 'cgi-lib.pl';
> &ReadParse(*in);
> 
> $count=0;
> #use the count function to name the variables and
> #then assign them to the 'entries' array
> while ($count<5) {
>         $ffield="firstname" . ($count+1);
>         $lfield="lastname" . ($count+1);
>         $gfield="gender" . ($count+1);
> 
>         $entries[$count]="$in{$ffield}::$in{$lfield}::$in{$gfield}";
>         ++$count;
> }
> 
> print "Content-type: text/html\n\n";
> print <<EOF;
> 
> <sniped>
>

Put the 
	print "Content-type: text/html\n\n";
to the very beginning of the script. 

There is probably an error message printed before the header
which confuses the server.

Hi, Jenda


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

Date: Wed, 14 May 1997 09:38:20 -0400
From: Michael Fry <mfry@his.com>
Subject: Re: CGI Environment vars
Message-Id: <3379C04C.704D@his.com>

> Can some1 pls give me a pointer to a list of environment variables
> used in CGI? Thanks.


http://hoohoo.ncsa.uiuc.edu/cgi/env.html gives a list, as would any
decent CGI book, like O'Reilly's 'CGI Programming.'

mf


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

Date: Wed, 14 May 1997 07:39:34 GMT
From: mads@toftum.dk (Mads Toftum)
Subject: Re: CGI Environment vars
Message-Id: <337966f8.65811201@news.inet.tele.dk>

On Tue, 13 May 1997 22:36:13 -0700, The Nightshadow
<nightshadow@thevortex.com.nospam> wrote:

>Can some1 pls give me a pointer to a list of environment variables
>used in CGI? Thanks.

Try this small CGI-script:

------cut-----
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
  while (($key,$value) = each %ENV) {
                print "$key = $value<BR>\n";
}
------cut-----


//
Mads Toftum



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

Date: Wed, 14 May 1997 14:51:22 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: CGI Environment vars
Message-Id: <337A09AA.E986FEC7@hotmail.com>

The Nightshadow wrote:
> Can some1 pls give me a pointer to a list of environment variables
> used in CGI? Thanks.

You can try <http://www.web100.com/~sib/cgi/cgitest.cgi> for a 
list of defined environment variables.

This simple script works by iterating over the keys of the 
%ENV hash.

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: Wed, 14 May 1997 17:33:34 -0700
From: Tommy Oliver <william.oliver@trw.com>
Subject: Compiling error with version 5.003
Message-Id: <337A59DE.177D@trw.com>

When I run the make after running the sh Configure part of the Perl
installatiion. I get the following error messgage.  Which seems to be a
library I am failing to link in but I am unable to find the functions
do_spawn and do_aspawn in any file. I am linking in the following
libraries :
libnsl.a
libm.a
libdl.a 
libdbm.a
libsocket.a

And I get the following message :

Undefined                       first referenced
 symbol                             in file
do_aspawn                           libperl.a(pp_sys.o)
do_spawn                            libperl.a(pp_sys.o)
ld: fatal: Symbol referencing errors. No output written to miniperl
make: *** [miniperl] Error 1

Thanks for any help you can give
Tommy


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

Date: 14 May 1997 18:32:02 -0400
From: schlein@umbc.edu (Jonas J. Schlein)
Subject: Compiling Perl 5.003
Message-Id: <5ldeh2$4po@umbc9.umbc.edu>

I was able to compile Perl 5.003 under SunOS 4.1.3 using the native cc
compiler such that it passed all the tests.  Under Solaris 2.5.1
using gcc 2.7 it passed all but 2 minor tests with something like a
97% or 98% success which I can live with.

However, I can't get the darn thing to compile under DG/UX at all.
The configure program in the PERL package had hints for this OS, but
that did not help the build process run to completion.  I have
tried this under both DG/UX 5.4.2 using gcc 2.2.2 and DG/UX 5.4R3.10
using gcc 2.5.8.

If anyone has gotten Perl 5 to compile at all under DG/UX and/or
gotten it to pass all the tests under Solaris 2.5.1 please enlighten me.
Mr. Schwartz was ragging on me via E-Mail ;-) to stop using Perl 4
which he claims is "old" and "buggy".  However, this version happens to
come pre-packaged with the DG/UX operating system and Perl 5 refuses to
compile.

Thanks in advance!
-- 
"If it wasn't for C, we would be using BASI, PASAL, and OBOL."

Jonas J. Schlein  (schlein@gl.umbc.edu)


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

Date: 14 May 1997 19:48:46 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: control-M makes for very long $_
Message-Id: <5ld4uu$al0$1@neocad.com>

: Tom Lewis-Flood wrote:
: > and nothing comes out, but when I change the file with the commandline,
: >         perl -p -i -e 's#^M#\n#g' filename.txt
: > it outputs the file properly.
: > 
: > 3. I've tried things like,
: >     s#\cM#\n#g;
: >     while  (<FILEHANDLE>) {
: >         print;
: >     }
: > but it doesn't seem to change a thing.
: > 
: > I could really use a hand. Thanks.

Try binmode(FILEHANDLE) after the open.  I don't see your original post
on my server anywhere, but if you're having this problem because you're
reading from a PC, this may help you out.



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


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

Date: Wed, 14 May 1997 18:28:41 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Cursor positioning
Message-Id: <3381e6a6.2807061@194.72.192.4>

Is there any way to position the cursor in perl?

I was thinking of writing a 'IDE' in perl for perl - one that could run
a program and find out the line of an error and 'highlight' the line,
etc.



-- 
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.virtual-pc.com/mindweb/


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

Date: Wed, 14 May 1997 13:48:21 +0100
From: "Paul Denman" <pdenman@ims.ltd.uk>
Subject: Re: dbf database files and perl
Message-Id: <01bc6064$d59466c0$9d02a8c0@192.168.2.1.ims.ltd.uk>

Sorry,

I should have said that our web server is on a Unix box.
I've been recommended the XBase perl module by someone, which is fine for
reading dbf files, but won't let me write to them.
Also, I've been told to point out that we are using 'CDX' indexes.

Regards,

Paul.



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

Date: 14 May 1997 18:17:27 GMT
From: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: exporting new() and a question about local
Message-Id: <5lcvjn$ig2$1@news.fsu.edu>


Should the new() function in a module be exported?  I couldn't find any
examples of such a thing, but I couldn't find anything to the contrary.  I
have

@EXPORT = qw(new, display);

Also, I have a global hash named %pwfile.  However, 'use strict' requires it
to be package-qualified, so I put

%ROSTERS::pwfile = ();

and then I use the variable in two subs in the package, BEGIN and another.  At
that point, my program stopped working right.  IT still ran but did not give
the correct output.  I discovered that if I made that if I put

local %ROSTERS::pwfile = ();

it worked fine.  I have read a lot on local and my, so I think I understand
them pretty well, but I can't figure out why I need to make it local.

JcL

-- 
Justin C. Lloyd ______________________________________________________________
Graduate Teaching Assistant                phone: 904/644-0559
Department of Computer Science             email: lloyd@cs.fsu.edu
Florida State University                   www:   http://www.cs.fsu.edu/~lloyd

                               P + L = :)


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

Date: Wed, 14 May 1997 18:38:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Finding a pattern in a file
Message-Id: <EA6p3v.B4K@nonexistent.com>

On 14 May 1997 05:07:53 GMT, Chipmunk wrote in comp.lang.perl.misc
URL: news:5lbhb9$3ie$1@dartvax.dartmouth.edu:
++ In article <JD-1105972330580001@fwk103102.res-hall.nwu.edu>
++ JD@anon.com (*) writes:
++ 
++ > Hello - you seemed comfortable with Perl so I was wondering if you could
++ > answer a question of mine.  I have a field in a form where one could type
++ > a copyright symbol or a registered symbol ( ascii:  %A )  I have a
++ > function called fix that translates most annoying sequences HOWEVER the
++ > sequence used in HTML for the registerd symbol is &reg; and the perl
++ > script translates %A as blank spaces.  Any idea why? - thanx - piggy
++ 
++ Quite a delay between this message appearing in my In Box and it
++ appearing in the newsgroup...
++ 
++ I'm not familiar with the representation %A for the registered symbol.
++ But if that is, as you say, a valid representation, there's probably a
++ bug in the fix function.  Could you provide us with the code for it?

There is no registration symbol in either ASCII nor ISO 8859-1.



Abigail


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

Date: Mon, 12 May 1997 20:08:46 -0500
From: "Deven T. Corzine" <deven@fuse.net>
To: John Cokos <jcokos@ccs.net>
Subject: Re: Help with sorting Hashes (Lists of Hashes)
Message-Id: <3377BF1E.26E8@fuse.net>

John Cokos wrote:
> 
> I hope someone can help me out.  I've got a sample bit of data and
> code at the bottom of this request for you to look at....
> 
> I cannot figure out how to sort a "List of Hashes".
> 
> Consider the following text file (Beneath the #####):
> The code below reads the file and assigns each line to an element in a
> hash.
> Now, I want to be able to sort the whole thing by "msg_date" and "from".
> and output a list of the "msg_num" and "subject" in the sorted order.
> 
> HELP PLEASE, I've read everything I can get my hands on to find the
> answers
> and I've had no luck at all....
> 
> Thanks,
> 
> John Cokos
> 
> Text Sample
> ########################################################################
> 
> ==START==
> Fred
> 1
> John
> 05/01/1997
> How are you
> Just a quick note to see how you're doing...
> ==END==
> ==START==
> ....another entry like above
> ==END==
> 
> The "code"
> ########################################################33
>   $recnum=-1;
>   $linenum=0;
>   open (HDR,"$messages");
>     @AllLines=<HDR>;
>   close (HDR);
>   $numlines=@AllLines;
>   for($xc = 0;$xc < $numlines;$xc++){
>         $AllLines[$xc] =~ s/\cM//g;
>         $AllLines[$xc] =~ s/\n//g;
>   }
> 
>   for($xc = 0;$xc < $numlines;$xc++){
> 
>      $t="";     # Initialize everything
>      $n="";
>      $f="";
>      $d="";
>      $s="";
>      $m="";
> 
>      if ($AllLines[$linenum++] =~ /==START==/){
>         $recnum++;
>         $t = $AllLines[$linenum++];
>         $n = $AllLines[$linenum++];
>         $f = $AllLines[$linenum++];
>         $d = $AllLines[$linenum++];
>         $s = $AllLines[$linenum++];
>         do {
>           $m = $m . $AllLines[$linenum++] . "\n";
>         } until ($m =~ /==END==/);
> 
>         $unsorted[$recnum]{"to"}=$t;
>         $unsorted[$recnum]{"msg_num"}=$n;
>         $unsorted[$recnum]{"from"}=$f;
>         $unsorted[$recnum]{"msg_date"}=$d;
>         $unsorted[$recnum]{"subject"}=$s;
>         $unsorted[$recnum]{"text"}=$m;
> 
>      }

You seem to be thinking in C.  Try something a little more perl-like. 
Here is a re-write, with your sorting and print as you requested.  Note
that the sorting depends on the MM/DD/YYYY exact date format (with
leading zeroes) to work correctly.  This code will also ignore any lines
outside of a "==START==".."==END==" sequence, and still handle message
boundaries if a message was incomplete.

Good luck, let me know if there's anything in this code you can't
follow.

Deven

------------------------------------------------------------------------------
open IN,"<$messages" or die "$messages: $!\n";
while (<IN>) {
   tr/\r\n//d;
   if ($_ eq "==START==") {
      push @msgs,{};
      @fields = qw(to msg_num from msg_date subject text);
      next;
   }
   if ($_ eq "==END==") {
      ($field,@fields) = ();
      next;
   }
   $field = shift @fields if @fields;
   next unless $field;
   $msgs[-1]{$field} .= $_;
   $msgs[-1]{$field} .= "\n" unless @fields;
}
close IN;
 
@msgs = sort {
   substr($a->{msg_date},6,4) cmp substr($b->{msg_date},6,4) ||
   substr($a->{msg_date},0,5) cmp substr($b->{msg_date},0,5) ||
   $a->{from} cmp $b->{from} ||
   $a->{msg_num} cmp $b->{msg_num};
} @msgs;
 
foreach $msg (@msgs) {
   print "$msg->{msg_num}\t$msg->{subject}\n";
}
------------------------------------------------------------------------------


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

Date: Mon, 12 May 1997 08:23:45 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "T. de Konink" <konink@telebyte.nl>
Subject: Re: HELP: Continously Perl script !!
Message-Id: <Pine.GSO.3.96.970512081811.2793E-100000@kelly.teleport.com>

On Sun, 11 May 1997, T. de Konink wrote:

> I've made an script (chatbox) that accepts socket calls from a browser,
> via ports 2500 - 2513. This script runs continuously, 

> The problem is that the script runs fine, except it doesn't respond
> after a while of use (+/-5 hours). I've the feeling that the script
> grows in memory use. 

That can happen. :-)  Which version of Perl are you using? Many memory
leaks have been plugged in recent versions. Have you tried using ps to see
what the memory use is like, every half hour or so?

> For tasks like sending back information
> (HTML) to the user, I fork childs to do this.

Are you reaping the child processes properly? There's no chance that
they're hanging around, is there? If just one process fails to die every
ten minutes or so, that could cause this problem. 

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 14 May 1997 18:58:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: inclu-OR in regex
Message-Id: <5ld200$p49$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Eli the Bearded 
<usenet-tag@qz.little-neck.ny.us>],
who wrote in article <5lcr2h$u7e$1@news.netusa.net>:
> alex <alex.t.silverstein@bender.com> wrote:
> > I want to match the letters a b and c in a string at least once
> > but in any order. The part I don't get is how to say "in any order"

In fact the question taken in LITERALLY is answered by
	/[abc]/;
but I do not think it is what the author was intending... ;-)

Ilya


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

Date: Wed, 14 May 1997 10:20:03 -0600
From: "Timothy H. Keitt" <tkeitt@santafe.edu>
Subject: Re: Lists question
Message-Id: <3379E633.7B80@santafe.edu>

Try perl's built-in grep function.

T.

Triantafyllos Marakis wrote:
> 
> I am trying to write a function that will delete a number of words from
> a given string
>


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

Date: Wed, 14 May 1997 13:27:46 -0600
From: John Call <johnc@interactive.ibm.com>
Subject: Re: Looking for book recommendation for Learning PERL...
Message-Id: <337A1231.376B@interactive.ibm.com>

The book I like to use the most for learning areas of Perl I am not
familiar with is PERL 5 Interactive Course by the Waite Group (authored
by Orwant). This book covers almost everything and is really written in
a style that would be good for beginners.

Another book I found that I have seen but do not own (I used a friends a
little) is PERL 5 How-to: The definitive perl programming problem solver
(Waite Group by Mike Glover, Aidan Humphreys, Ed Weiss).

Either would probably suit you fine. What to avoid as a beginner is a
pure reference book like the Camel. It is an excellent book for more
in-depth looks at Perl but I think it is a little rough for a pure
beginner.

Always make sure to read the book in the store and make sure you like
the examples and understand the approach the author is taking in
teaching you.

Good Luck,

John


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

Date: Wed, 14 May 1997 14:51:48 -0400
From: "T. Kim Nguyen" <sde@netcom.ca>
Subject: perl debugger problem with object destructors?
Message-Id: <337A09C4.536B@netcom.ca>

There appears to be a problem with the Perl debugger which causes a
DESTROY method to be called out of order.  In the sample code below, two
printed messages appear in different orders, depending on whether the
Perl debugger was used or not (ie. run in one case with "perl" and in
the other with "perl -d").

Is it known that the Perl debugger has problems with objects or problems
in general?  Have I run into one of those limitations?  Or am I doing
something truly bogus in my code?  Any help is appreciated.

	Kim

DETAILS FOLLOW.
===========================================

The code calls the constructor for a class called 'Fcs' and
prints the instance to stdout.

Here, Main.pl is run without the Perl debugger and works correctly:

    [208]> perl Main.pl

    fcs instance is 'Fcs=HASH(0xa4ef0)'
    Fcs::DESTROY was called


Note how the Fcs instance is of the correct type, and is destroyed
afterwards.



Here, the same Main.pl is run using the Perl debugger:


    [209]> perl -d Main.pl
    Stack dump during die enabled outside of evals.

    Loading DB routines from perl5db.pl patch level 0.94
    Emacs support available.

    Enter h or `h h' for help.

    main::(Main.pl:6):	$_dbg = new Dbg;
      DB<1> c
    Fcs::DESTROY was called
    fcs instance is 'DbgStackObject=HASH(0x177af0)'


The Fcs destructor is called before its constructor has
finished running, and the Fcs instance is of the wrong type.


Here is the code for Main.pl:

====================Main.pl start====================
package main;
use Fcs;
use Dbg;
$_dbg = new Dbg;
$fcs = new Fcs;
print "fcs instance is '$fcs'\n";
====================Main.pl end====================


Here is the code for Fcs.pm.  It contains only a constructor and
destructor.  Both methods put onto their stack a DbgStackObject whose
only function is to maintain a call stack (to print out debugging
messages).  

====================Fcs.pm start====================
package Fcs;
use Dbg;
$_dbg = new Dbg;
sub new {
    my $_dbg_obj = $_dbg->enter("Fcs::new");
    my $type = shift;
    my $self = bless {}, $type;
    return $self;
}				# new
sub DESTROY {
    my $_dbg_obj = $_dbg->enter("Fcs::DESTROY");
    print "Fcs::DESTROY was called\n";
}				# DESTROY
1;
====================Fcs.pm end====================

Here is the code for Dbg.  Its purpose is to act as a holder for a
global call stack that is used to print out debugging messages.

====================Dbg.pm start====================
package Dbg;
use DbgStackObject;
$_dbg = new Dbg;
sub new {
    my $type = shift;
    if ($_dbg eq "") {
	$_dbg = bless {}, $type;
    }
    return $_dbg;
}
sub enter {
    my $self = shift;
    my $fname = shift;
    $self->_push ($fname);
    return DbgStackObject->new($self);
}
sub _pop {
    pop @_dbg_stack;
}
sub _push {
    my $self = shift;
    my $fname = shift;
    push @_dbg_stack, $fname;
}
1;
====================Dbg.pm end====================

Here is the code for DbgStackObject.  The constructor holds onto the
instance of its caller object ("parent"), and the destructor tells the
parent to pop the top element of its call stack.

====================DbgStackObject start====================
package DbgStackObject;
sub new {
    my $type = shift;
    my $parent = shift;
    my $self = bless {}, $type;
    $self->{_dbg} = $parent;
    return $self;
}
sub DESTROY {
    my $self = shift;
    my $parent = $self->{_dbg};
    my $throwaway = $parent->_pop ();
}
1;
====================DbgStackObject end====================

--
T. Kim Nguyen              k.nguyen@ieee.org
416 982 5119 (TD Bank) / 416 418 9654 (cell)
     Design Intervention Systems Corp.


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

Date: 14 May 1997 19:22:51 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perl debugger problem with object destructors?
Message-Id: <5ld3eb$rc9$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to T. Kim Nguyen
<sde@netcom.ca>],
who wrote in article <337A09C4.536B@netcom.ca>:
> There appears to be a problem with the Perl debugger which causes a
> DESTROY method to be called out of order.  In the sample code below, two
> printed messages appear in different orders, depending on whether the
> Perl debugger was used or not (ie. run in one case with "perl" and in
> the other with "perl -d").
> 
> Is it known that the Perl debugger has problems with objects or problems
> in general?  Have I run into one of those limitations?  Or am I doing
> something truly bogus in my code?  Any help is appreciated.

a) First of all, you use a _very_ old debugger.  _Some_ debugger _was_
keeping retvalues from subroutines in between calls.

b) Newer perl gives:

->perl Main.pl
fcs instance is 'Fcs=HASH(0xc8ec8)'

->env PERLDB_OPTS=N perl -d Main.pl
fcs instance is 'Fcs=HASH(0x1ae934)'
Fcs::DESTROY was called

so the order is indeed different, but note that it is different from
what _you_ describe too.

The bug is somewhere else.

Ilya


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

Date: Wed, 14 May 1997 14:57:04 -0400
From: Gary Ebert <gary@www.rdss.com>
Subject: perldb and Xemacs version 19.14
Message-Id: <337A0B00.7956@www.rdss.com>

Hello all:

I am using perl 5.002 and Xemacs 19.14 on an HP s800 runninx HPUX 9.0
For quite some time now when I run the perldb from xemacs I get two
errors that say something like:
can not find Term/ReadLine/Gnu.pm in @INC
and
can not find Term/ReadLine/Perl.pm in @INC

I looked at ReadLine.pm 
I think the problem is that Perl.pm does not exist and xemacs should be
looking for Term::ReadLine::Perl

Does that sound right??
If Yes then how do I fix it??

If No does anybody know what the problem is and how to fix it????

BTW sorry about the cross-posting but I think that this topic justifies
it if you disagree I guess you will let me know!!!

	Thanks in advance for your help,
		Gary
-- 
Gary Ebert				Operations Adminstrator
Voice:	(301) 428-2115			Mobile Datacom Corporation
Fax:	(301) 428-1004			19540 Amaranth Drive
Pager:	(800) 490-7478			Germantown, MD  20875-2126


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

Date: Wed, 14 May 1997 20:05:39 GMT
From: dwebb@eng.umd.edu (David D Webb)
Subject: Re: PerlScript Objects
Message-Id: <5ld5gr$9rh@clarknet.clark.net>

I figured it out : the syntax is :
$ObjCmd->{ActiveConnection} = $ObjConn;

I still can't get a Session variable to set.

In article <1997May9.133903.283@alison.sbc.edu>, jcoleman@alison.sbc.edu 
wrote:
>Does anyone know the proper syntax to use when accessing ASP objects with
>PerlScript?  If so, can you point me to a webpage where this information is
>kept?  Or atleast post it here for everyone else?
>
>Thanks,
>
>John Coleman
>jcoleman@sbc.edu


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

Date: Wed, 14 May 1997 19:09:54 GMT
From: dwebb@eng.umd.edu (David D Webb)
Subject: Re: PerlScript Objects
Message-Id: <5ld28c$9rh@clarknet.clark.net>

The proper syntax can be found on www.activeware.com sample pages.
As far as setting a property such as:

$ObjCmd->ActiveConnection = $ObjConn;

(which by the way, doesn't work)
I don't have a fucking clue. I need to figure this out so I can actually use 
the command object.  There must be a way to do it, and I'm really
getting annoyed by the fact that I can't figure it out!!!!

-Dave


In article <1997May9.133903.283@alison.sbc.edu>, jcoleman@alison.sbc.edu 
wrote:
>Does anyone know the proper syntax to use when accessing ASP objects with
>PerlScript?  If so, can you point me to a webpage where this information is
>kept?  Or atleast post it here for everyone else?
>
>Thanks,
>
>John Coleman
>jcoleman@sbc.edu


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

Date: Wed, 14 May 1997 11:16:46 -0700
From: Daren Eason <dartec@shadow1.mfg.sgi.com>
Subject: Please...Be easy on me!!
Message-Id: <337A018E.41C6@shadow1.mfg.sgi.com>

I know this is probably the most annoying ?? on the net...But can anyone
tell me where I can get a "Working" version of perl5 for DOS ??

Please respond via email


dartec@shadow1.mfg.sgi.com 

Thanks , 

Daren Eason


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

Date: 14 May 1997 16:14:00 -0400
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
To: Daren Eason <dartec@shadow1.mfg.sgi.com>
Subject: Re: Please...Be easy on me!!
Message-Id: <m17mh16cc7.fsf@nauplius.psc.sc.edu>

Daren Eason <dartec@shadow1.mfg.sgi.com> writes:
> I know this is probably the most annoying ?? on the net...But can anyone
> tell me where I can get a "Working" version of perl5 for DOS ??
> 
> Please respond via email
[done]

[This is repost of a "recipe" I posted some time ago.  The details may
have changed, but I think the basics are still true.]

I recently went through the exercise of hunting for a DOS/Win Perl,
needing to write a Perl program that would run on Unix, DOS 5, and
Windows 95/NT, and be distributable (along with Perl) with a minimum
of fuss.  

I settled on Ilya Zakharevich's OS/2 port of Perl.  Yup.  It will run
on DOS and Windows systems.  It's a very full Perl port that is
aggressively maintained and kept up to date.

You'll need to tinker slightly.  Following is an outline of a recipe
that worked for me.

Grab the port from CPAN.  Start at <URL:http://www.perl.com/perl> and
look for "Software", then "Alien Ports", then "CPAN/ports", and follow
links until you get to OS/2 ports, and then the "ilyaz" directory.
Once there, look for the most recent version in a directory that looks
something like "5.003.05" (of course, that number will change as
versions get updated).  Within that is a set of zip files.  Get these
files:

                perl_aou.zip
                perl_mlb.zip
                perl_pod.zip
                perl_ste.zip
                perl_utl.zip
                plREADME.zip

Make sure you have a decent unzip utility on DOS/Win.  One that works
is Info-Zip's, which you can grab from the "arcers" directory of the
MSDOS section of the Simtel archives at oak.oakland.edu
(<URL:http://oak.oakland.edu/pub/simtelnet/msdos/arcers/unz520x.exe>).
That file will unzip into multiple files, including a good DOS unzip
program.  The reason you need a good one is that you need to unzip
into a tree, and you need to properly truncate long filenames -- that
unzipper seems to do the job properly.

OK, now that you've got the code and an unzipper, do the following to
create a Perl hierarchy (the following manipulation gets done from a
DOS window, if you're under Windows):

        cd \
        mkdir perl
        mkdir perl\bin
        mkdir perl\lib
        mkdir perl\lib\pod

Now unpack the zip files into appropriate directories.  To do that,
change directories to the target directory first, then from there,
unzip the archive files as follows:

        perl
                plREADME.zip
        perl\bin
                perl_aou.zip
                perl_utl.zip
        perl\lib
                perl_mlb.zip
                perl_ste.zip
        perl\lib\pod
                perl_pod.zip

Put the following in your autoexec.bat (carefully noting the slash
directions in the text that follows):

        set path=...your...existing...path...;c:\perl\bin
        set perllib_prefix=f:/perllib c:/perl

(I assume your perl destination is drive "c:", otherwise modify the
"c:"s above appropriately, but don't change the "f:").

===== Note: The following is from Ilya Zakharevich: =====
 As I mentioned it in another post today, unless you install sh.exe
 from sh_dos.zip, and set PERL_SH_DIR according to the docs, you are
 not going to have backticks and pipes working.
=========================================================

Now, based on addresses in Ilya's documentation, go out and grab the
latest versions of the "emxrt" package and the "rsx" package.  Unzip
them under a temporary directory.  Copy the following files to
c:\perl\bin:

        from the emx package:
                emx.exe      [VCPI DOS extender for DOS]
                emxfpemu     [coprocessor emulator for 386sx machines]
                emxbind.exe  [emx executable load-format twiddling program]
                emxl.exe     [emx stub loader module]
        from the rsx package:
                rsx.exe      [DPMI DOS extender for Windows]

Now drop out into DOS if you're running under Windows (not a DOS
shell: if you're in Windows, kill Windows and drop to plain DOS).

Go to the c:\perl\bin directory and use emxbind to extract the a.out
module from perl_.exe, something like:

        emx emxbind.exe -x perl_.exe perl.out

Use emxbind to bind the a.out module with the emxl.exe stub:

        emx emxbind.exe emxl.exe perl.out perl.exe

Assuming that worked, you can now delete the following files:

        emxbind.exe
        emxl.exe
        perl.out
        perl_.exe
        perl5_00.exe

If you're really twitchy about a startup warning message under
Windows, you can use a hex editor or other binary editor to edit the
file "rsx.exe" so that it will not complain about the emx version
you're using.  In the file "rsx.exe", search for the string
"emx_version".  You'll find the emx version number in reverse,
something like: "emx_version=b9.0" (which really refers to emx version
number 0.9b).  Change the version number/letter to fit the emxrt
version you downloaded (in my case, recently, I changed "b9.0" to
"c9.0", which defines me as really twitchy I suppose).  Save the new
rsx.exe (must be in the filename "rsx.exe").  Then the runtime warning
about emx versions will shut up.

Reboot your machine to let the c:\autoexec.bat changes take effect.


What have you achieved by this?  The OS/2 version will run using
either the emx.exe DOS extender (using the VCPI protocol, suitable for
"naked" DOS) or the rsx.exe extender (using the DPMI protocol,
compatible with Windows 3.x, 95 (and NT?)).  The rigamarole with
emxbind pulled out the core executable and rebound it with a stub
loader that will automatically and transparently find and use the
emx.exe extender in plain DOS, and the rsx.exe extender under Windows
(as long as they're in a directory on the PATH).  Setting the
emxlib_prefix variable properly sets Perl's @INC list of where to
search for Perl libraries.

The "utility" programs in \perl\bin are set up as OS/2 "cmd" files.
You'll need to trim off the top few lines that get them to execute
under the OS/2 command interpreter.  There are magical incantations
you can do to turn them into automatically executing DOS batch files
(which I don't know), or you can create a batch file for each of them
(in the same directory) that looks something like the following (for
an example "utility.cmd" file):

@perl -S utility.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9

in the file "\perl\bin\utility.bat".


And that's that!

-Dean
-- 
N. Dean Pentcheff   <pentcheff@acm.org>   WWW: http://tbone.biol.sc.edu/~dean/
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-3936)
PGP ID=768/22A1A015 Keyprint=2D 53 87 53 72 4A F2 83  A0 BF CB C0 D1 0E 76 C0 
Get PGP keys and information with the command: "finger dean@tbone.biol.sc.edu"


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

Date: Wed, 14 May 1997 12:07:31 GMT
From: "Chris van Arum" <Chris.van.Arum@cmg.nl>
Subject: Q: Missing library when Installing Oraperl
Message-Id: <01bc6052$f38fbec0$55a44fc1@chrisva>


I have problems installing ORAPERL on my system.

When building ORAPERL the following elements remain unresolved :
lnulserc
lihcurrlangid
sltbev
lihlmod
lmemlcomp
lihcrenv
lihlinfo
liclas
licbas
liwalpx
lmsrip
lmsrgbf
lmsrtrm
lihcsn
ligncc
lmemup
lircpu
lircop
limopen
limpuc
limcpcx
limfwdx
limr2w
limc2wx
lnmren
lnmnur
sslsig
lmfepwe
lmfehtl
ligcnv
lihci2h
lihmupr
lmfegks
lmfeecb
limnceq
limspax
lnmscn
limdigx

The problem seems to me that I am missing a library.
Can someone please tell me which library I am missing ?
Or has someone another suggestion what I am doing wrong ?

Thank you for your Help.

	Chris


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

Date: Wed, 14 May 1997 22:13:39 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Randal Schwartz
Message-Id: <tcyangEA6z2r.EHt@netcom.com>

Hmmm, it seems the analogy from "Intel Inside" is not a good idea.
I apologize for what I did to Randal.

==================================
Paddy Spencer (paddy.spencer@parallax.co.uk) wrote:

: : He wanted to put the label "Randal Inside" on his script :)
:                               ^^^^^^^^^^^^^
: Given that Randal has

: at the end of his post, I'm not sure he'll approve of the concept...

--
Tung-chiang Yang                       tcyang@netcom.com

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.clever.net/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: Wed, 14 May 1997 15:06:12 -0500
From: Dale Johnson <djohnson@uu.net>
To: David M Holmes <david.holmes@bigfoot.com>
Subject: Re: Regex problem - removing trailing form input
Message-Id: <337A1B34.167EB0E7@uu.net>

David M Holmes wrote:
> 
> Hi,
> 
> I'm having a problem deleting trailing form input from a URL.  Here is
> the code.
> 
> #!/usr/local/bin/perl -w
> 
> use strict;
> use diagnostics;
> my $testurl = "http://www.here.com/path/to/file/me.html?a=b&c=d";
> print "$testurl\n";
> # remove trailing form input
> $testurl =~ m/.*?(\?.*)/;
> $testurl =~ s/$1//;
> print "$testurl\n\n";
> The error message I get is:
> Uncaught exception from user code:
>         /?a=b&c=d/: ?+* follows nothing in regexp at testurl.pl line 13.
David,

Try using split() (splitting on a "?") to get URL and Query String.

#!/usr/local/bin/perl

use strict;
use diagnostics;

my $testurl = "http://www.here.com/path/to/file/me.html?a=b&c=d";
my $formdata = "";

($testurl, $formdata) = split(/\?/, $testurl);

print "$testurl\n\n";

### END OF SCRIPT ###

Dale

--
Dale R. Johnson, Jr.                                djohnson@uu.net
Key fingerprint =  D5 2D F7 96 E5 69 3A A3  F5 00 A8 FC EF 35 41 54


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

Date: Wed, 14 May 1997 14:35:38 -0500
From: "Christopher S. Reickenbacker" <chrisre@medianet.com>
Subject: setuid & setgid scripts executed via cgi/internet
Message-Id: <337A140A.8EF@medianet.com>

I am working on a web browser based cgi program to allow Computer
Operators the option of executing commands as root(cancel print jobs,
kill processes, rm files, etc...) Thus far I have had no luck. Right now
I am trying this:
        
        1) the cgi program is owned by root.
        2) the setuid and setgid bits are set on the cgi program.
        3) a system call is made to remove a test file in my home dir.

Result: Nada. The file remains.

I think that the http daemon user who actually runs the program is
being  blocked. I am not sure. If anyone has any idea how to do this, I
would be very thankfull. I know perl is the language for this, as
opposed to c, but I am getting nowhere doing it over the internet(behind
firewall.)

Thanks a million.

Christopher S. Reickenbacker    MEDIANET, Inc.
chrisre@medianet.com            Austin, Texas
(512) 343-2002 ext.439          Systems Programmer


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

Date: Wed, 07 May 1997 17:54:49 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
Subject: Re: splitting text
Message-Id: <3370FA29.3510@ny.ubs.com>

Zachary Brown wrote:
> 
> I'm having a tough time with the following problem:
> 
> How to split along the boundary between space and nonspace. So if I have
> an array of items of text like "of him- or   her-self to attain, etc.", I'd
> like to split it into an array of
> $a[0] = "of"
> $a[1] = " "
> $a[2] = "him-"
> $a[3] = " "
> $a[4] = "or"
> $a[5] = "   "
> $a[6] = "her-self"
> $a[7] = " "
> $a[8] = "to"
> $a[9] = " "
> $a[10] = "attain,"
> $a[11] = " "
> $a[12] = "etc."
> $a[13] = "\n"
> 
> and so on, with $a[14] starting at the beginning of the next item in the
> original array.

One approach, if you can identify a string that absolutely, positively will 
never happen 'naturally' in your text, is to first replace all the spaces with 
themselves bounded by the string, then split on that string. E.g.:

$a = s/(\s+)/#@#$1#@#/g;
push(@b, split(/#@#/, $a));

> 
> I've tried splitting on \b, but that breaks punctuation into their own
> items as well.
> 
> Zack


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

Date: Wed, 14 May 1997 23:24:10 +0100
From: Jong <jong@mrc-lmb.cam.ac.uk>
Subject: suggestion for the last element position $#
Message-Id: <337A3B8A.31DF@mrc-lmb.cam.ac.uk>

Hi,

I sometimes use a long var name like


@correct_group_names_list_long

to get the last element I have to use

$correct_group_names_list_long[$#correct_group_names_list_long]

Rather than this how about using just $#


$correct_group_names_list_long[$#]

Cheers,

Jong


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

Date: Wed, 14 May 1997 14:33:10 -0400
From: "T. Kim Nguyen" <sde@netcom.ca>
To: Mr Simon Lee <silee@news.hk.super.net>
Subject: Re: sybperl problem
Message-Id: <337A0566.3056@netcom.ca>

Mr Simon Lee wrote:
> 
> Hi all,
> 
>         Sometime I have problem to  get the output from centain system
>         procedures via sybperl......
> 
>         For example, I can get all the output of sp_who via it, but
>         can only get the first few lines of the 'sp_helpdb <dbase>'....
>         (only the dboptions display but cannot get the info like device
>         name, size of a segment, free kb of a segment etc)
> 
>         Does anyone know why ?
> 
> Thanks,
> Simon

Have you made sure that you're calling dbresults() in a while loop? 
There are probably many result sets from "sp_helpdb <dbase>", and only
one result set from "sp_who".

By the way, it might help if you included your code in your posting.

	Kim
--
T. Kim Nguyen              k.nguyen@ieee.org
416 982 5119 (TD Bank) / 416 418 9654 (cell)
     Design Intervention Systems Corp.


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

Date: 14 May 1997 19:01:55 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Week numbers
Message-Id: <5ld273$er6$1@en1.engelschall.com>

Bjvrn Nilsson <bjorn.w.nilsson@edt.ericsson.se> wrote:

> The second post on this matter. I need to get the current week number
> given a date. The peculiarity is that in contrast to the american
> system, where the 1'st of January always render week # 1, I'm using the
> Swedish week number system, of which I'm not certain of the rules. (The
> 1'st of Jan could be week 52, week 53 or week 1.

This is covered in my "Date::DateCalc" module:

  ($week,$year) = week_number($year,$mm,$dd);

This function will return a year number different from the given year
number (along with the corresponding correct number of the week) where
appropriate.

The module is based on the ISO/R 2015-1971 and DIN 1355 norms for the
gregorian calendar (the one used in all western countries today), which
is probably what you need.

You can find this module on my web site at

http://www.engelschall.com/u/sb/download/

or at any CPAN ftp server near you.

Hope this helps.

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

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

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