[8660] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2277 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 8 18:07:48 1998

Date: Wed, 8 Apr 98 15:00:28 -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, 8 Apr 1998     Volume: 8 Number: 2277

Today's topics:
        @INC and avoiding -I <bldadmin@esd.sgi.com>
    Re: @INC and avoiding -I <lr@hpl.hp.com>
    Re: Bill Gates should be invited to O'Reilly's "Free So ben@hayamasa.demon.co.uk
    Re: Bill Gates should be invited to O'Reilly's "Free So dg50@chrysler.com
    Re: Bill Gates should be invited to O'Reilly's "Free So <gnat@frii.com>
    Re: Bill Gates should be invited to O'Reilly's "Free So (Tim Smith)
    Re: DB_File and multiple processes otis@POPULUS.net
        FAQ question (Louie)
    Re: Getting the subroutine name from within a sub (Jason Gloudon)
    Re: Getting the subroutine name from within a sub (Mark-Jason Dominus)
    Re: How to access a randomly created file for reading (Jason Gloudon)
    Re: How to post to phtml? (John Callender)
    Re: If "=~" means match what is doesn't match? stvhoof@netvision.net.il
        Obfuscated Perl: figure this one out (Kevin Reid)
        Oddities in bitwise string |, &, ^ (Tom Rokicki)
    Re: Overriding 'print' (Jason Gloudon)
    Re: Overriding 'print' (Mark-Jason Dominus)
        Password Problem <galbmill@21st-century-comm.com>
        Perl compilation problem (pp_ctl.c) (Sam Hulick)
        Perl Install Hell <noid@shell.snni.com>
        Problems with "use integer" in combination of CGI.pm (Bert Tijhuis)
        Read file and interpolate contents as string? <Bill_York@MathWorks.com>
        REQ: Help with slightly confusing recursive unlinking : (Steve McNabb)
    Re: RMS should be invited to O'Reilly's "Free Software  (Ilya Zakharevich)
    Re: RMS should be invited to O'Reilly's "Free Software  (I R A Aggie)
    Re: running `ls $file` on a nt workstation in a search  <webmaster@mvrs.com>
    Re: running `ls $file` on a nt workstation in a search  <ludlow@us.ibm.com>
    Re: scanf substitute in perl (Andrew M. Langmead)
    Re: SDBM error (Jason Gloudon)
    Re: serpinski gasket almost-1-liner needs polishing (Ronald L. Parker)
    Re: Simple Unix Question,  ( Simple for you maybe ) (Tad McClellan)
    Re: Strange "Modification of a read-only value attempte <cnwetzel@linguistik.uni-erlangen.de>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 08 Apr 1998 13:42:04 -0700
From: Build Administrator <bldadmin@esd.sgi.com>
Subject: @INC and avoiding -I
Message-Id: <352BE11C.66DC004C@esd.sgi.com>

On an NT4 system, how/where does @INC get initialized?

I'm unable to use modules and INC is pointing to the wrong directories.
If I attempt to append to it at run time (prior to a use directive),
the use directive is flagged and the script won't run.

The command line -I works, but this is a pain.

Thanks.

JR



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

Date: Wed, 08 Apr 1998 14:05:26 -0700
From: Larry Rosler <lr@hpl.hp.com>
To: Build Administrator <bldadmin@esd.sgi.com>
Subject: Re: @INC and avoiding -I
Message-Id: <352BE696.836120BC@hpl.hp.com>

Build Administrator wrote:
> 
> On an NT4 system, how/where does @INC get initialized?
> 
> I'm unable to use modules and INC is pointing to the wrong directories.
> If I attempt to append to it at run time (prior to a use directive),
> the use directive is flagged and the script won't run.
> 
> The command line -I works, but this is a pain.
> 
> Thanks.
> 
> JR

Have you tried prepending to @INC in a BEGIN block (preferably the first
BEGIN in 'main')?  After that, the 'use' directives in the program
proper should behave correctly.  (This should work on Windows or UNIX,
whatever.)

Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Wed, 08 Apr 1998 13:51:10 -0600
From: ben@hayamasa.demon.co.uk
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6ggguu$lds$1@nnrp1.dejanews.com>

In article <6ggdss$h5s$1@nnrp1.dejanews.com>,
  ben@hayamasa.demon.co.uk wrote:

> (I don't know if O'Reilly's proprietory software was developed using
> free sources: I wouldn't be surprised.)

I forgot that the O'Reilly proprietory Perl extensions (written
by Larry Wall) here which are a good example of where O'Reilly has made
free software into proprietory software.

Also reading the original page which sparked this
discussion I was astonished to see that Tim O'Reilly describes
himself as a Free Software Luminary, which perhaps means that
he thinks Richard Stallman is a proprietory software luminary.  That
would explain why RMS wasn't invited to O'Reilly's conference.
On the other hand the other great free software luminary Bill Gates
should be invited of course.



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


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

Date: Wed, 08 Apr 1998 15:04:29 -0600
From: dg50@chrysler.com
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6ggl8d$r7r$1@nnrp1.dejanews.com>

In article <6ggguu$lds$1@nnrp1.dejanews.com>,
  ben@hayamasa.demon.co.uk wrote:
>
> In article <6ggdss$h5s$1@nnrp1.dejanews.com>,
>   ben@hayamasa.demon.co.uk wrote:
>
> > (I don't know if O'Reilly's proprietory software was developed using
> > free sources: I wouldn't be surprised.)
>
> I forgot that the O'Reilly proprietory Perl extensions (written
> by Larry Wall) here which are a good example of where O'Reilly has made
> free software into proprietory software.
>
> Also reading the original page which sparked this
> discussion I was astonished to see that Tim O'Reilly describes
> himself as a Free Software Luminary, which perhaps means that
> he thinks Richard Stallman is a proprietory software luminary.  That
> would explain why RMS wasn't invited to O'Reilly's conference.
> On the other hand the other great free software luminary Bill Gates
> should be invited of course.

Are you _completly_ nuts, or just trolling?

- O'Reilly publishes the best books on free software. In many cases, they
publish the _only_ books on free software.

- O'Reilly actively promote free software at every opportunity, and are doing
everything they can to help "legitimise" free software in the corporate world.

- O'Reilly are paying at least one noted free software developer (Larry Wall)
to develop free software - and to the best of my knowledge, there's no strings
attached with this. Perl is still free, and will always remain so.

- As for "proprietary" books... you can still DL all the LDP stuff they
publish, and I believe their pick books (no longer in print) have been GPLed.

So IMHO, Tim O'Reilly has every right to refer to himself as a "free software
luminary" if he so chooses. He's done stuff to back it up.

What, prey tell, have you written and released lately, that gives you the
right to throw stones at him?

DG

These are my opinions, not Chrysler's.


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


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

Date: 08 Apr 1998 14:38:58 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <5qiuokyrod.fsf@prometheus.frii.com>

ben@hayamasa.demon.co.uk writes:
> I forgot that the O'Reilly proprietory Perl extensions (written
> by Larry Wall) here which are a good example of where O'Reilly has made
> free software into proprietory software.

Actually, the Java stuff sold in the Perl Resource Kit was never free.
O'Reilly hired Larry to write some code to interface Java with Perl.
He did.  They sold it.  Perl is still free.  The world goes on.

People are hired to write proprietary code tied to Linux.  They sell
that properietary code.  Linux stays free.  This is considered a good
thing.

Nat


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

Date: 8 Apr 1998 14:28:37 -0700
From: tzs@halcyon.com (Tim Smith)
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <6ggq65$b0m$1@halcyon.com>

<ben@hayamasa.demon.co.uk> wrote:
>O'Reilly publishes several books about free software.  O'Reilly have
>taken several freely redistributable works and turned them into
>proprietory works.  The best known example is the X windows
>documentation which was taken by O'Reilly and made into proprietory
>books with the freedoms removed.  Several other freely redistributable
>works have been turned into books and taken out of the free realm by
>O'Reilly.  In many cases, unlike the X windows documentation, they
>have been killed off as freely redistributable works, so O'Reilly is a
>company that has done some harm to free redistribution.

Unless O'Reilly has hacked into assorted FTP servers and removed the
free software, they have not killed off any free software, nor made
it unavailable.  Rather, they have offered a non-free alternative.

--Tim Smith


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

Date: Wed, 08 Apr 1998 16:48:20 -0600
From: otis@POPULUS.net
To: "Paul Marquess" <pmarquess@bfsec.bt.co.uk>,ronaldws@aol.com (RonaldWS)
Subject: Re: DB_File and multiple processes
Message-Id: <6ggrb4$3cj$1@nnrp1.dejanews.com>

Hi,

> >Does DB_File provide some kind of internal locking/serialization mechanism
> >that will allow me to have multiple processes modify the same DBM without
> >having to handle those acecsses myself?
>
> Nope. You have to manage the locking yourself.  Have a read at the section
> called "Locking Databases" in the DB_File documentation.

yes, I saw that section, but I KNOW I read somewhere (either Berkeley DB docs,
or in one of the perl modules or maybe in some perl book) that Berkeley DB
provides internal locking mechanism.
Damn :(

> >If I use DB_File and HAVE Berkeley DB installed oon my machine, will
> DB_File
> >use Berkeley DB or something else? Thanks!
>
> DB_File is a front end to Berkeley DB.

got that :)
I also found BerkeleyDB.pm - should I use that for using the latest berkeley
db (2.1 something I think)

Thanks!

Otis

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


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

Date: Wed, 08 Apr 1998 19:58:41 GMT
From: $louie@visca.com (Louie)
Subject: FAQ question
Message-Id: <352bd6e7.2240892@news.jet.es>

Greetings:

Here's my script, which uses the "simple-minded" approach for removing
HTML tags suggested in Perlfaq9:

----BEGIN------
#!/usr/local/bin/perl/ -w
use strict;
use diagnostics;
my $infile = 'c:/www/visca/index.html';
my $outfile = 'c:/www/visca/texts/out.txt';
open (OUT, ">$outfile") or die "Can't open $outfile $!\n";
@ARGV = ("$infile") or die "Can't open $infile $!\n";
while (<>) {
	s/<(?:[^>'"]*|(['"]).*?\1)*>//gs;
	print OUT "$_";
}
-----END--------

With the GS Perl 5.004_02 on Win95, the program doesn't execute and I
get the following error message :

"Uncaught exception from user code:
        /<(?:[^>'"]*|(['"]).*?\1)*>/: regexp *+ operand could be empty
at html2txt.pl line 9."

With the AS 5.003_07, build 316 (after commenting out "diagnostics") I
get the following message, but the program executes correctly:

"(?:[^>'"]*|(['"]).*?\1)* matches null string many times at
html2txt.pl line 9."

Is there a fix for this?

Thank-you.
-- 
Louie
louie@visca.com
http://www.visca.com/


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

Date: Wed, 08 Apr 1998 19:13:34 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Getting the subroutine name from within a sub
Message-Id: <slrn6initt.jio.jgloudon@manitoba.bbn.com>

Mark-Jason Dominus <mjd@op.net> wrote:
>	sub myLog {
>	  my $caller = (caller(1))[3];
>	  Log("$caller: ", @_);
>	}
>
>and call myLog instead of calling Log directly.

Hopefully you read the manpage and have tried caller(0).

-- 
Jason Gloudon


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

Date: 8 Apr 1998 15:44:05 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Getting the subroutine name from within a sub
Message-Id: <6ggk25$t1c$1@monet.op.net>

In article <slrn6initt.jio.jgloudon@manitoba.bbn.com>,
Jason Gloudon <jgloudon@bbn.com> wrote:
>Hopefully you read the manpage and have tried caller(0).

Hopefully you read the previous articles in this thread and figured
out that we already discussed caller(0) and saw that it was not
really appropriate.


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

Date: Wed, 08 Apr 1998 19:27:10 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: How to access a randomly created file for reading
Message-Id: <slrn6injnc.jio.jgloudon@manitoba.bbn.com>

cmeena@hotmail.com <cmeena@hotmail.com> wrote:

>open(LDOUT, ">>/tmp/$link_up_file") || die "could not write to $link_up_file
>\n"
>print LDOUT ("@linkup_list\n");
>
>I know the file gets created and also I am able to see it in the /tmp
>directory.

Did you close LDOUT ? Or flush the writes you made to that file ?

>Now, I try to read the same file I created a while ago by doing

-- 
Jason Gloudon


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

Date: 8 Apr 1998 13:56:43 -0700
From: jbc@west.net (John Callender)
Subject: Re: How to post to phtml?
Message-Id: <6ggoab$7rr@acme.sb.west.net>

Apisilp Trunganont (b39ast@nontri.ku.ac.th) wrote:
: 	I found one web page (http://www.paclink.co.th/phtml/send.phtml)
: that use phtml. Could you tell me please what is phtml? And this site has
: CGI form that post data to http://www.paclink.co.th/phtml/send.phtml. I am
: so confuse, phtml can be both HTML file and CGI file? I try to post using
: my Perl script as I show below, but it doesn't work. Please tell me what
: should I do?

The .phtml filename extension probably means that the Web server 
delivering those pages has been configured to use PHP, which allows one 
to embed scripting stuff in the Web page itself, with that stuff being 
parsed and executed by the server before the page is delivered. So yes, 
it's sort of like combining CGI scripting and static HTML pages in one 
hybrid process.

More information about PHP can be found at the following Web address:

http://www.php.net/

(No doubt one or more people will tell you that this was not really a 
Perl question, and should not have been posted to this group. 
Technically, those people are probably right. Of course, the post in 
which they tell you your question is off-topic for the group is itself 
arguably off-topic for the group, so I say screw 'em -- especially if 
they fall into that sad, twisted subset of people who apparently believe 
it is not only their right, but their *duty* to be intentionally rude to 
newcomers in a vain effort to restore a Golden Age of c.l.p.m. ethnic 
purity, before all us clueless non-programmers found out how cool Perl 
was and started yammering on about boring issues like CGI scripting and 
Unix file permissions and all the other things that, for a clueless 
non-programmer, tend to be lumped together into the category of "things I 
don't quite understand, but which I see those shining beacons of 
expertise in c.l.p.m. talking about, so I'll just go ahead and ask them." 

-- 
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Wed, 08 Apr 1998 16:45:43 -0600
From: stvhoof@netvision.net.il
Subject: Re: If "=~" means match what is doesn't match?
Message-Id: <6ggr68$34a$1@nnrp1.dejanews.com>

In article <Pine.BSI.3.96.980406073817.7640A-100000@pentagon.io.com>,
  Chocolate <poohba@io.com> wrote:

> 	        if($line =~ "Phone:") {

The above line is where your error is...it should be

                if($line =~ /Phone:/) {

You need to use slashes (or the "m" operator) to do pattern matching...quotes
would not work.  You should be able to just use a regular "else" to handle the
case of there being no phone number.

If however, you ever end up needing a "not match" operator, it is
!~ instead of =~.

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


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

Date: Wed, 8 Apr 1998 16:50:54 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Obfuscated Perl: figure this one out
Message-Id: <1d76ef6.9acwykva2nqkN@slip166-72-108-93.ny.us.ibm.net>

#!/usr/bin/perl -w-e 'open ME,@_[$$];print %_{$0+1}'
eval scalar((($_='!;_$$,!$_!;') =~ tr@_$;!,@=",$;@),
$_); eval "@{[reverse split /[1-9]/, '>1A2T3A5D4<6 '
 .'7t8in1r2p2;405,801,8A9AT3k D5e6e7s8']}" __END__

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: 8 Apr 1998 14:28:18 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Oddities in bitwise string |, &, ^
Message-Id: <6ggq5i$891@cello.hpl.hp.com>


Beware that bitwise string ops might not behave as you expect.
& seems to return a string as long as the shortest one you pass
in; | and ^ return one as long as the longest one you pass in.
The same seems to be true for the |=, &=, and etc. variants.

[448] % perl -de 1

Loading DB routines from perl5db.pl version 1.01
Emacs support available.

Enter h or `h h' for help.

main::(-e:1):   1
  DB<1> $a1 = "1" ;

  DB<2> $a5 = "12345" ;

  DB<3> p length($a1 & $a5)
1
  DB<4> p length($a5 & $a1)
1
  DB<5> p length($a1 ^ $a5)
5
  DB<6> p length($a5 ^ $a1)
5

Note also that the return value from & may not be null-terminated
in the internal representation.

perl -de 1

Loading DB routines from perl5db.pl version 1.01
Emacs support available.

Enter h or `h h' for help.

main::(-e:1):   1
  DB<1> use Devel::Peek ;

  DB<2> $a = "abc" ;

  DB<3> Dump($a)
SV = PV(0x400143d4)
  REFCNT = 1
  FLAGS = (POK,pPOK)
  PV = 0x4002ab88 "abc"\0
  CUR = 3
  LEN = 4

  DB<4> $a &= "ab" ;

  DB<5> p $a
ab
  DB<6> Dump($a)
SV = PV(0x400143d4)
  REFCNT = 1
  FLAGS = (POK,pPOK)
  PV = 0x4002ab88 "ab"
  CUR = 2
  LEN = 4

  DB<7> $a |= "ab" ;

  DB<8> Dump($a)
SV = PV(0x400143d4)
  REFCNT = 1
  FLAGS = (POK,pPOK)
  PV = 0x4002ab88 "ab"\0
  CUR = 2
  LEN = 4

The `problem' if it can be considered as such is in doop.c line about line
420:

        case OP_BIT_AND:
            while (len--)
                *dc++ = *lc++ & *rc++;
            break;
        case OP_BIT_XOR:
            while (len--)
                *dc++ = *lc++ ^ *rc++;
            goto mop_up;
        case OP_BIT_OR:
            while (len--)
                *dc++ = *lc++ | *rc++;
          mop_up:
            len = lensave;
            if (rightlen > len)
                sv_catpvn(sv, rsave + len, rightlen - len);
            else if (leftlen > len)
                sv_catpvn(sv, lsave + len, leftlen - len);
            else
                *SvEND(sv) = '\0';
            break;
        }

Note that OP_BIT_AND does a break, not a goto mop_up; this is maybe
intentional.

[450] % perl -v

This is perl, version 5.004_04 built for PA-RISC1.1

Copyright 1987-1997, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.



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

Date: Wed, 08 Apr 1998 19:00:16 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Overriding 'print'
Message-Id: <slrn6ini4v.jio.jgloudon@manitoba.bbn.com>

aixgod@ix.netcom.com <aixgod@ix.netcom.com> wrote:
>I tried to find the answer to this from the FAQ but the link pointed to for
>overriding built-in Perl methods was broken, so I'm just going to punt and
>ask for help here.
>
>I want to jump in every time a print statement is executed, examine the
>filehandle, and if it matches a certain one then I want to do something.  For
>example, I might want to cause things going to <STDOUT> to also be pushed
>onto an array which I might later write out to a file (kinda sorta like
>'tee', but not exactly).
>
>I assume I need to somehow override print, do what I want to do, and then
>still print out ... just not sure how to do it.  Can someone point me to some
>docs covering this?

You can use a tied Filehandle to do this providing you have a sufficiently
recent version of perl. The following module does this:

www.perl.com/CPAN-local//modules/by-module/Tie/STBEY/Tie-Handle-3.0.readme

man perltie to understand how it works.

Overriding of builtin functions is described in `man perlsub`. Depending 
on your perl version the manpage may or may not mention how to call the
builtin version of a function using the package prefix CORE::.

-- 
Jason Gloudon


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

Date: 8 Apr 1998 15:40:42 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Overriding 'print'
Message-Id: <6ggjrq$svb$1@monet.op.net>

In article <6gg926$anb$1@nnrp1.dejanews.com>,  <aixgod@ix.netcom.com> wrote:
>I assume I need to somehow override print, do what I want to do, and then
>still print out ... just not sure how to do it.  Can someone point me to some
>docs covering this?

One way to do it is to actually redefine the `print function, which
you can do like this:

	use subs 'print';

	sub print {
	  # Do something interesting;
	  CORE::print ... ;    # Call the real `print'.
	}


Another way to accomplish this is with tied filehandles.  In brief,
you can define a filehandle with any semantics you want, and whenever
the program tries to read or write the filehandle, Perl will call an
appropriate subroutine that you supply.  See `perltie' manual for
full details.


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

Date: Wed, 08 Apr 1998 15:10:38 -0400
From: Mikhail Galbmillion <galbmill@21st-century-comm.com>
Subject: Password Problem
Message-Id: <352BCBAE.4AE2@21st-century-comm.com>

Hello,
I created .htaccess file for authorized access of Web pages
and my problem is : Is that possible to fetch user password
from Apache HTTP server?
I need this password to be pass to CGI script. All  I can get now is
user login name (using CGI user_name()).

Appreciate your help.
Michael.


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

Date: 8 Apr 1998 16:54:10 -0500
From: shulick@pobox.com (Sam Hulick)
Subject: Perl compilation problem (pp_ctl.c)
Message-Id: <6ggrm2$p6r@typhoon.xnet.com>


I'm trying to compile Perl 5.004_04 on a UTS machine.  It barfs
horribly.  Don't worry about the preroot stuff.. it's something we have
to do at work so programs don't cross-compile for the switch module.
This has nothing to do with the compiler error(s).  These errors
probably have more to do with this compiler sucking badly.  But I was
curious if any of you gurus had a way to get around this, as I
desperately need Perl 5.004 on this machine.

$ /etc/preroot /native /bin/make
        `sh  cflags libperl.a pp_ctl.o`  pp_ctl.c
          CCCMD =  cc -M -DPERL_CORE -c -DCRIPPLED_CC -O   
pp_ctl.c: 171: improper indirection
pp_ctl.c: 180: improper indirection
pp_ctl.c: 180: warning: improper combination of pointer and integer
pp_ctl.c: 201: improper indirection
pp_ctl.c: 222: improper indirection
pp_ctl.c: 227: improper indirection
pp_ctl.c: 227: warning: improper combination of pointer and integer
*** Error code 1

Stop.


Some of the culprit code:

   171      UV *p = (UV*)*rsp;
   172      U32 i;
   173
   174      if (!p || p[1] < rx->nparens) {
   175          i = 6 + rx->nparens * 2;
   176          if (!p)
   177              New(501, p, i, UV);
   178          else
   179              Renew(p, i, UV);
   180          *rsp = (void*)p;

So, my compiler doesn't like (some_type *)*rsp.  However, this is
perfectly normal C.  Any ideas on this one?  Please e-mail, don't post a
followup.. I most likely won't catch it.

Much appreciated,
-S

-- 
Sam Hulick              hulick@lucent.com    (630) 979-5318
Programmer
Consulting Group, Inc. / Lucent Technologies


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

Date: Wed, 08 Apr 1998 19:42:41 GMT
From: noid <noid@shell.snni.com>
Subject: Perl Install Hell
Message-Id: <RqQW.4$f2.36975@katana>

Hey..I'm trying to install Perl5 on a R/S 6000 H50 box running AIX 4.3
and when I run the install I get the following

"The Unsupported function umask function is unimplemented at
 ../../lib/ExtUtils/Install.pm line 247"

Anyone  running AIX 4.3 encounter this before?


-- 
	-noid

******************************************************************************
UIN: 2998966                 *  The best thing about being me,   
SoCalUnderground:            *      is that I ain't you.
http://exo.com/~noid         *                     -Some Redneck T-Shirt
        Barfing Yak Publications: Building a better tomorrow through
                           fear and opression
******************************************************************************
 



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

Date: Wed, 08 Apr 98 19:07:19 GMT
From: B.Tijhuis@inter.nl.net (Bert Tijhuis)
Subject: Problems with "use integer" in combination of CGI.pm
Message-Id: <6gglcg$2p$1@news.NL.net>

Today I've create a little CGI program that calculates something.
The calculation should only be done in integer format.
Before using the line
"use integer" 
me CGI script runs well.

When inserting after the line

use CGI;                # the line
use integer;

some strange things happens to my CGI script.

I've solved this by blocking the "use integer" statement

{
        use integer;

        # some calculations

}

Is this a bug in somewhere or?????

When someone want to try the script it is possible to post it. (about 30 lines 
of code)











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

Date: 8 Apr 1998 21:23:43 GMT
From: Bill_York <Bill_York@MathWorks.com>
Subject: Read file and interpolate contents as string?
Message-Id: <6ggpsv$i00$1@turing.mathworks.com>

Is it possible to pass a string to the interpolator?

What I mean by that is this:

- read a file from the disk
 
  the file contains mostly strings but some stuff is $var1 or $var2

- slurp data into single string 

  easy to do by mucking with $/

- "do magic on string"

  here's the fun part, without writing a reg-exp parser, I want
  perl to treat the string as a HERE document created with double
  quotes around the EOF tag.


Here's and example (sudo code):

Foo contains this:

Hello world.  It is now $time o'clock.

Perl file contains this:

open (F, "foo") or die();
$/ = undef;
$foo = <F>;
close(F);

$time = convertTimeToWallClock(time); # assume this works

print($foo);  # returns foo as it appears on disk
$bar = INTERPOLATE($foo);
print($bar);  # returns foo with the current time replaced for $time.

-- 
William York
william@mathworks.com



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

Date: 8 Apr 1998 21:50:05 GMT
From: smcnabb@NO@%SPAMinterlog.com (Steve McNabb)
Subject: REQ: Help with slightly confusing recursive unlinking :-)
Message-Id: <6ggred$qk8$1@nntp3.uunet.ca>

Hi:

(Code is attatched to the end of this message)

Ok, first off, I'm very far from being a perl expert, so my code is probably 
full of hideous redundancies, superfluous punctuation and other glaring 
ugliness, but, well, I'm learning :)  Any suggestions on improving the elegance 
of this are also appreciated.  Right - now on with the problem.  I have an 
array containing a list of "Id's" for "groups" (collections of documents) that 
need to be deleted.  The process goes something like this:

1)  for each directory, read @files
2)  for each file in @files, unlink that file  
#now directory should be empty
3)  rmdir the directory
4)  move on to next directory (lather rinse repeat)

So, here's the situation --

this model works great! Except for the very last element in the directory 
array, for which unlinking each file in @files returns a $! (permission denied)

I happen to be running NT and IIS 3, but I don't think this is at all web 
server related, since it does the same thing from the command line.

My conundrum is, I would think that if it were a file permissions issue, all 
the other attempts to unlink would also fail, not just the _last_ one.. (???)


So, I appreciate all those eyes having a look at the following code
(note: the whole proggie is about 1,000 lines long, so I've only posted the 
appropriate chunk -- I've also added extra comments where req'd to explain 
subroutines that aren't shown here -- :-) Please note, I had to do some 
re-formatting to get this to display ala usenet - so a ; or two may have been 
eaten.  I've also truncated my normally hyper-descriptive error messages to 
something like this: open(FOO, "foo.txt") or print "eh?:$!";  I hope this 
slightly mutilated example code is enough to help diagnose the problem.

Thanks ever so much,

Steve
smcnabb@interlog.com


$Spitter is a template parsing module which "$Spitter->Crank"'s variables 
through text templates

--- start the problematic code ---
<bunch of other stuff snipped for your reading pleasure>

if($ACTION eq "del_group_4")
{
	$ORG_ID = param("org_id");
	$ORG_NAME = Lookup_Org_By_ID($ORG_ID); #returns name or "error"
	
	$GROUP_ID = param("group_id");
	
	$GROUP_TO_SMITE = $GROUP_ID;
	$GROUP_NAME = Lookup_Group_By_ID($ORG_ID,$GROUP_TO_SMITE);
	chomp($ORG_ID,$GROUP_ID,$GROUP_TO_SMITE);
	%FAMILY_TREE = Create_Lineage_Hash($ORG_ID); #returns all lineages
	$keys = @KEYS = keys %FAMILY_TREE;
	sort @KEYS;
	for $key (@KEYS)
	{	
		if($key =~ /\Q$GROUP_TO_SMITE/) { push @DEATH_ROW, $key; next;}
	}
	$DEADMEN = @DEATH_ROW;
	#need to sort lineages by length -- this gives me the groups, sorted
	#by group ID into P groups and L groups (L groups are leaf groups)
	
	for $key(@DEATH_ROW)
	{  ++$i; $DEAD_GROUPS{$key} = $i; }
	for $key (sort keys %DEAD_GROUPS)
	{
		$len = length($key);
		$DATA = $len.":".$key;
		push @_DEAD, $DATA;	
	}
	@_DEAD = reverse sort numerically @_DEAD;
	for $key (@_DEAD) 
	{ 	undef @filez;
		@_LINEAGE = split /:/,$key;
		$_MY_ID = $_LINEAGE[-1];
		
		if($_MY_ID =~ /^L/)  
		{ $NODE_TYPE = "leaf";
		$NODE =  =new Leaf_Group($_MY_ID,$SCRIPT_ROOT);
		}

		if($_MY_ID =~ /^P/)  
		{ 
		$NODE_TYPE = "parent"; 
		$NODE = new Parent_Group($_MY_ID, $SCRIPT_ROOT);
		}
		
		$PARENT_ID = $NODE->{PARENT_ID};
		$PARENT_ID = Strip($PARENT_ID);
		if ($PARENT_ID =~ /^P/)
		{ 	
#this is a parent group -- remove my entry from the parent's children.dat file
			$PARENT_TYPE = "parent";
			open(SIBLINGS, "$PARENT_ROOT/$PARENT_ID/children.dat");
			flock(SIBLINGS,2);  seek(SIBLINGS,0,1);
			local $/ = undef;
			$SIBLING_DATA = <SIBLINGS>;
			close SIBLINGS;
			open(SIBLINGS, 
">$PARENT_ROOT/$PARENT_ID/children.dat");
			flock(SIBLINGS,2); 
			if($SIBLING_DATA) { %SIBLING_HASH = 
$NODE->parse_pairs($SIBLING_DATA); }
			delete $SIBLING_HASH{$_MY_ID};
			for $key (sort keys %SIBLING_HASH)
			 { 
				print SIBLINGS "$key:$SIBLING_HASH{$key}\n"; 
			}
			close SIBLINGS;
			

			
		} 
		
		else 
		{ 	#this is the org
			$PARENT_TYPE = "org";
			open(ORG_KIDS, "$ORG_ROOT/$ORG_ID/children.dat");
			flock(ORG_KIDS,2);seek(ORG_KIDS,0,1);
			local $/ = undef;
			$ORG_KIDS_DATA = <ORG_KIDS>;
			close ORG_KIDS;
			open (ORG_KIDS, ">$ORG_ROOT/$ORG_ID/children.dat");
			flock (ORG_KIDS,2);
			if($ORG_KIDS_DATA) 
			{ 
			%ORG_KIDS_HASH=$NODE->parse_pairs($ORG_KIDS_DATA); 
			}
			delete $ORG_KIDS_HASH{$_MY_ID};
			for $key (sort keys %ORG_KIDS_HASH)
			{ 
			print ORG_KIDS "$key:$ORG_KIDS_HASH{$key}\n";
			}
			close ORG_KIDS;
			
			
		}
#ok, we've removed the parent's link -- now to clean up the files
opendir (MY_ROOT, "$GROUP_ROOT/$NODE_TYPE/$_MY_ID") or print "eh? :$!",br;
		@filez = readdir MY_ROOT;
		closedir MY_ROOT;
		for $file (@filez) 
		{ 
		chomp($file);
	if(($file ne "") and ($file ne "..")and ($file ne ".")and($file))
	{ 
	unlink ("$GROUP_ROOT/$NODE_TYPE/$_MY_ID/$file") or print "eh: $!",br;
	}
			
	}
	rmdir "$GROUP_ROOT/$NODE_TYPE/$_MY_ID/" or print "eh? :$!",br;
			
			
#either way, we need to remove the entry from the org's group db
open (ORG_GROUPS, "$ORG_ROOT/$ORG_ID/groups.dat") or print "eh? :$!";
		flock (ORG_GROUPS,2);
		seek (ORG_GROUPS,0,1);
		local $/ = undef;
		$ORG_GROUPS_DATA = <ORG_GROUPS>;
		close ORG_GROUPS;
open (ORG_GROUPS, ">$ORG_ROOT/$ORG_ID/groups.dat") or print "eh? :$!";
		flock(ORG_GROUPS,2);
		seek(ORG_GROUPS,0,1);
		if($ORG_GROUPS_DATA) 
		{ %ORG_GROUPS_HASH = $NODE->parse_pairs($ORG_GROUPS_DATA); }
		delete $ORG_GROUPS_HASH{$_MY_ID};
		close ORG_GROUPS;
$REPORT = $REPORT ."deleted $_MY_ID  notifying next of kin *$PARENT_ID* 
<br>\n";  #sorry - long line :)
	
	
	}
	$DEADMEN--;
$out = $Spitter->Crank("$TEMPLATE_ROOT/root_admin/del_group_success.tpl");
	print $out;
	

}


<bunch of subroutines snipped for your reading pleasure>





	








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

Date: 8 Apr 1998 19:21:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <6ggin4$oud$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Joe Buck
<jbuck@synopsys.com>],
who wrote in article <6gg9st$9o3@hermes.synopsys.com>:
> >> Hmm. If RMS does not qualify, then maybe Bill Gates is invited
> >> (because IE is a freeware).
> 
> ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> >No it is not.  You are mixing "free" and "free".
> 
> You clearly don't get it.  The notion of having a free software summit
> and not inviting RMS is nonsense.  Hence the previous poster's comment
> that O'Reilly might be confused as to what free software means.

You clearly never had any relation to GPLed software.  GPL is as far
from "free" as you can get - preserving an impression of being free.

While I applaud most other efforts by RMS, GPL is a clear indication
of what people should not use.

Ilya

P.S.  Note that I do not discuss here RMS invitation.  *I* would
      invite him anyway.


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

Date: Wed, 08 Apr 1998 17:17:23 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <fl_aggie-0804981717230001@aggie.coaps.fsu.edu>

In article <6gg9st$9o3@hermes.synopsys.com>, jbuck@synopsys.com (Joe Buck)
wrote:

+ You clearly don't get it.  The notion of having a free software summit
+ and not inviting RMS is nonsense.

I have yet to see either:

a) RMS was invited and turned it down
b) RMS was snubbed

Until such evidence is presented, this is all pure speculation. Of course,
I don't routinely follow gnu.* or *.linux.*, so my apologies if such
evidence has been presented...

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Wed, 08 Apr 1998 11:52:33 -0700
From: ADR Webmaster <webmaster@mvrs.com>
Subject: Re: running `ls $file` on a nt workstation in a search script problem?
Message-Id: <352BC771.18F7CEFA@mvrs.com>

Iqbal wrote:
> Not sure, but does ls even work on NT, write a quick one liner, or try
> it from the command line, but I dont think it gives directory listing. I
> could be completely wrong but...

I ran this code with on my NT server and it does print.

An ls is available in the Posix tools in the NT Resource Kit. It's not a
legit ls, however. (It's been embraced and extended). The one avail w/
Cygnus bash is much better IMHO.

However...

I *am* confused by this bit of code:

> >                                 if (-d $file) {
> >                                 $filename = "$file$temp_file";
> >                                 if (-T $filename) {
> >                                 push(@FILES,$filename);
> >                                 }
> >                         }

Isn't $file still "*.htm" or "*/*.htm" (*/* ???) depending on which time
through the foreach loop this is? So in effect he's asking is *.htm a
directory?

Am I off here?

	-/matt/-


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

Date: Wed, 08 Apr 1998 13:47:51 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: running `ls $file` on a nt workstation in a search script problem?
Message-Id: <352BC657.96399106@us.ibm.com>

tim pickup wrote:
[snip]
> the key line is                 $ls = `ls $file`;
> What exactly does this line do. I figure it is saying something like

Unless you happen to have a batch file (or executable) in the system
path called ls.bat (or ls.exe), it won't do anything.  I think that what
you may be looking for instead is:

$ls = `dir $file`;

-- 
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.


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

Date: Wed, 8 Apr 1998 19:11:37 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: scanf substitute in perl
Message-Id: <Er3zzD.9rJ@world.std.com>

amehdiza@joule.ee.calpoly.edu (Ali Mehdizadeh) writes:

>Is there a direct substitue for C's scanf in perl?


Perl's POSIX man page recormmends using regular expressions instead.

>Let's say I want to read in the number from the following line:

>some text 123

>in C I would do something like this:

>scanf("%s %s %i", &string1, &string2, &num);

($string1, $string2, $num) = ( $line =~ /(\S+)\s+(\S+)\s+([-+]?\d+)/ );

Is close, except that in scanf() if a line partially, but not
completely matches the format string, the arguements that do match are
stored. With regular expressions, it is all or nothing (unless you
specify it as being optional with the "?" or "*" quantifiers.)
-- 
Andrew Langmead


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

Date: Wed, 08 Apr 1998 19:12:07 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: SDBM error
Message-Id: <slrn6inir5.jio.jgloudon@manitoba.bbn.com>

Rui Guo <ruig@ece.nwu.edu> wrote:
>I got an error when I run this following program:
>
>#!/usr3/local/bin/perl5.00404
>use POSIX;                               # needed for O_RDWR and O_CREAT
>use SDBM_File;   # Create an SDBM hash
>tie(%hash, SDBM_File, 'movies-sdbm', O_RDWR | O_CREAT, 0666);
>$hash{'The Seven Samurai'} = 1954;
>$hash{'City Lights'}       = 1931;
>$hash{'The Third Man'}     = 1949;
>untie %hash;                             # not necessary, but good form

Like, What's the error ? Did You check the result of the tie ?
Did you print $! ?

-- 
Jason Gloudon


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

Date: Wed, 08 Apr 1998 21:39:38 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: serpinski gasket almost-1-liner needs polishing
Message-Id: <352cebcc.30599599@10.0.2.33>

On 8 Apr 1998 14:29:43 GMT, root@compstat.wharton.upenn.edu (Jack
Siler) wrote:

>Inspired by J. Reed's article in TPJ on L-Systems I used substitution
>to produce a Serpinski gasket fractal.  I was unhappy about putting the
>substitutions inside functions but since substitutions return
>number-of-subs instead of the string I couldn't figure out how to put
>the subs in the print line (like I did for the appending) nor how to
>make the functions less clunky.  Comments appreciated.

How's this? (split onto multiple lines for the sake of your
newsreader)  Note the "improvements" to your sub C, and the
elimination of the evil $&.

$s=$x='*';$y=' ';$reps=16;while(--$reps){print $y x$reps,(join$y,split
//,$s=&${\sub{$_[0]=~s/((.)\2)|../$1?$y:$x/ge,$_[0]}}($y.&${\sub{$_[0]=~
s/(.)/$1x2/ge,$_[0]}}($s).$y)),"\n"}




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

Date: Wed, 8 Apr 1998 14:44:11 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Simple Unix Question,  ( Simple for you maybe )
Message-Id: <b2kgg6.pr4.ln@localhost>

Rob Tanner (rtanner@linfield.edu) wrote:
: In article <kfreg6.gl.ln@localhost>, tadmc@flash.net (Tad McClellan) wrote:

: > Namsuk Kim (a-namsuk@microsoft.com) wrote:
: > : Try @variable = `ls -l`
: > 
: > : I think this is what you meant.
: > 
: > 
: > Why do you think that?
: > 
: > 
: > : Tad McClellan wrote in message ...
: > : >UNIXstuff (unixstuff@aol.com) wrote:
: > : >
: > : >: From with a perl script.
: > : >: I want to run the UNIX command ls -l
: > : >: and have the info/string stored in a variable.
: >                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
: > 
: > 
: > : >   $my_variable = `ls -l`;
: > 
: > That looks like a string stored in a variable to me.
: > 

: `ls -l` is back-ticked.  That means perl should execute the command "ls
: -l", the output of which is multiple lines and so is a list.

: The sequence $my_variable = `ls -l` will yield the count of returned lines
                                           ^^^^^^^^^^^^^^^
: in the variable $my_variable.


No it won't.


from the 'perlop' man page (my underlining):

-----------------------------------------------
=head2 I/O Operators

There are several I/O operators you should know about.
A string is enclosed by backticks (grave accents) first undergoes
variable substitution just like a double quoted string.  It is then
interpreted as a command, and the output of that command is the value
of the pseudo-literal, like in a shell.  In a scalar context, a single
                                              ^^^^^^^^^^^^^^    ^^^^^^
string consisting of all the output is returned.  In a list context,
^^^^^^                              ^^^^^^^^^^^
a list of values is returned, one for each line of output.  (You can
-----------------------------------------------




Uh. I thought I included some code in the post you are following up to.

You didn't run it I guess.  Code is meant to be run. 

That's why I seldom post code _fragments_.

I usually try to post complete programs that can be run after a simple cut
and paste. I guess I'm wasting my time with that...


Please run it and see for yourself.



: The sequence @my_variable = `ls -l` will yield the output the the "ls"
: command in the array @my_variable.

That part is right.


: As you can see, there is a major difference there.


I can see the difference...


 ...but it isn't that difference  ;-)

(which I expect was Namsuk Kim's misperception too)


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 08 Apr 1998 20:41:07 +0200
From: Christian Wetzel <cnwetzel@linguistik.uni-erlangen.de>
Subject: Re: Strange "Modification of a read-only value attempted" error
Message-Id: <352BC4C3.1A83@linguistik.uni-erlangen.de>

James A Squire 312 M 193884 wrote:
> =

> I'm using Perl 5.003 and have the following code snippet:
> [code example]
> When I run this using:
> =

> myscript.pl -name ALICE BESS |& tee -a output.log (using tcsh)
> I get the error message in the subject header, referencing the
> line with the arrow above (the arrow's not part of the script,
> of course).
> =

> Where am I trying to modify a read-only value???

If I remove the abbrev() and arglist (changing $arg to $argx)
and run the script with =


  myscript.pl -name ALICE BESS |& tee -a output.log

it works fine under perl 5.004_04 and ksh (also without the tee
part) and @names contains ALICE and BESS, as intended. =


Christian
-- =

  Korrosionsbeschleunigend k=F6nnen sich Temperaturerh=F6hungen,
  Konzentrationen des Mediums oder bei an und f=FCr sich
  reinen Medien unerw=FCnschter Wassereintritt auswirken.




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

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

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