[10616] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4208 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 12 19:07:19 1998

Date: Thu, 12 Nov 98 16:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 12 Nov 1998     Volume: 8 Number: 4208

Today's topics:
    Re: Can I force format_TOP out w/o write? <rootbeer@teleport.com>
        HELP!!!  Script needed to create a site index <a.r.mccoy@larc.nasa.gov>
        How to resolve sym links johnvv@hotmail.com
    Re: How to resolve sym links (Mike Kelly)
    Re: How to resolve sym links <zenin@bawdycaste.org>
        Is it possible to pass ref of regular expression? bill_raty@my-dejanews.com
    Re: Lazy Perl Bastards (Steve Linberg)
    Re: losing global variable value?? <rootbeer@teleport.com>
    Re: Need easy way to convert P4 scripts to P5 <rootbeer@teleport.com>
        next loops <gala@sonic.net>
    Re: next loops (Sam Holden)
        Occasional Perl Script Failure <tory1@IDT.NET>
    Re: Passing Perl Hash Through DCOM (Tye McQueen)
    Re: Perl and CGI wrap : a weird problem <rootbeer@teleport.com>
        perl cgi script (Tri Tram)
        Perl scripts as a NT service <cresentmoon@geocities.com>
    Re: Perl, ORacle & Linux (Alastair)
    Re: perl/cgi script problem in html <rootbeer@teleport.com>
    Re: Setuid works as "perl suid.pl" but not "suid.pl" <rootbeer@teleport.com>
    Re: SMTP server on the Web (Alastair)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 12 Nov 1998 22:17:16 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Can I force format_TOP out w/o write?
Message-Id: <Pine.GSO.4.02A.9811121332070.791-100000@user2.teleport.com>

On Wed, 11 Nov 1998 narins@my-dejanews.com wrote:

> One of the guys on them team asked me if it is possible to force the
> header of a format (like STDOUT_TOP) to be spit out even before any
> writes are done.

In other words, even if zero records are written, you still want a header
(on an otherwise blank page of output). I think you should be able to do
this, but I couldn't find a way without using a dummy format and kludging
$%, which is annoying.

format DUMMY =
 .

    {
        my $old_fh = select STDOUT;        # or wherever
        local $~ = $^;
        local $^ = 'DUMMY';
        $% = 1;         # before...
        write;
        $% = 1;         # ...and after
        select $old_fh;
    }

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 12 Nov 1998 17:02:44 -0500
From: "Alan McCoy" <a.r.mccoy@larc.nasa.gov>
Subject: HELP!!!  Script needed to create a site index
Message-Id: <72flu0$mab$1@reznor.larc.nasa.gov>

Does anyone have (or know where I can find) a script that will take a list
of terms and phrases (like a typical index found at the end of a book) and
search the site for each occurance of those words and phrases, then write an
html version of the list with links inserted beside the terms, like so:

BEFORE:

- A -
Air Traffic Management
Airframe Systems


AFTER:

- A -
Air Traffic Management        3.0, 5.1, 6.3
Airframe Systems               2.3, 2.4


Any help with this would be appreciated! Thanks in advance!

Alan McCoy
a.r.mccoy@larc.nasa.gov









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

Date: Thu, 12 Nov 1998 22:09:42 GMT
From: johnvv@hotmail.com
Subject: How to resolve sym links
Message-Id: <72fmb7$lrn$1@nnrp1.dejanews.com>




Hi all,

I am working on HP UNIX boxes at 10.10.

This is my problem:

I have a list of files and some are links.

In my perl script I need to be able to identify the files that are pointed to
by the links.

I can back tic shell commands but the results of a symlink  seems to depend
on which directory the link was created.  I won't have any control on how the
link where the link was created.

Thanks in advance, John aka johnvv@hotmail.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 12 Nov 1998 23:41:35 GMT
From: tfsmiles@ecst.csuchico.edu (Mike Kelly)
Subject: Re: How to resolve sym links
Message-Id: <72frnf$6e3$1@hubble.csuchico.edu>

In article <72fmb7$lrn$1@nnrp1.dejanews.com>,  <johnvv@hotmail.com> wrote:
>
>
>
>Hi all,
>
>I am working on HP UNIX boxes at 10.10.
>
>This is my problem:
>
>I have a list of files and some are links.
>
>In my perl script I need to be able to identify the files that are pointed to
>by the links.
>
>I can back tic shell commands but the results of a symlink  seems to depend
>on which directory the link was created.  I won't have any control on how the
>link where the link was created.
>
Have you tried "ls -Ld"?

The "-L" option follows symlinks.

Mike
(:

-- 
--------TFSmiles@ecst.csuchico.edu-----------------The_glass_is_too_big--------


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

Date: 12 Nov 98 23:41:13 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: How to resolve sym links
Message-Id: <910914404.702166@thrush.omix.com>

johnvv@hotmail.com wrote:
: I am working on HP UNIX boxes at 10.10.
: This is my problem:
: I have a list of files and some are links.
: In my perl script I need to be able to identify the files that are pointed to
: by the links.

	perldoc -f lstat

: I can back tic shell commands but the results of a symlink  seems to depend
: on which directory the link was created.

	Huh?  An example please.

: I won't have any control on how the link where the link was created.

	Huh?

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Thu, 12 Nov 1998 22:37:54 GMT
From: bill_raty@my-dejanews.com
Subject: Is it possible to pass ref of regular expression?
Message-Id: <72fo02$nbq$1@nnrp1.dejanews.com>

I'm not a newbie, but I'm not a guru either.

I'm creating a class in which one method will perform a grep using a regular
expression kept either as an attribute in the object or passed in as an
argument in the method call.

I've seen similar where the contents of the regular expression are passed as
a string, but this effectively limits invoking some types of regular
expressions ( such as those modified with suffixes) and other's irksome--
like selectively having to escape metacharacters when 'quotemeta' doesn't
read your mind.

JavaScript v1.2 has a class for Regular Expressions.  Is there a similar
facility in Perl short of the following:

    sub mygrep {
        my( $re_coderef, @list ) = @_;

        return grep {&{$re_coderef}($_)} @list;
    }

    @list = qw( alpha bravo charlie delta echo );

    @newlist = mygrep (sub {$_[0] =~ /^b/i}, @list);

In other words wouldn't it be neat if you could:


    @newlist = mygrep( m/^b/i, @list );

and have the calling mechanism build a coderef for you (i.e. more condusive to
laziness)?

Regards,

-Bill



-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 12 Nov 1998 18:25:18 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Lazy Perl Bastards
Message-Id: <linberg-1211981825190001@ltl1.literacy.upenn.edu>

In article <72f9jr$ai9$1@nnrp1.dejanews.com>, ptimmins@netserv.unmc.edu
(Patrick Timmins) wrote:

> I'm sorry, but this is funny. And since many Perl types
> *are* lazy, I thought it appropriate for c.l.p.m.
> 
> see www.despair.com
> 
> particularly the Steve Jobs and Microsoft Partnership items
> under the "New Spin" section.

That's too funny.  Those posters are too much.  Great Xmas gift ideas!
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 12 Nov 1998 22:49:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: losing global variable value??
Message-Id: <Pine.GSO.4.02A.9811121448540.791-100000@user2.teleport.com>

On 12 Nov 1998, Richard Smol wrote:

> Whenever the program enters that long if-then list though, I lose the
> value in that variable!

You seem to have given insufficient information to show where the problem
is. Cut your program down to the smallest example which shows the
difficulty, then post that here. Ideally, it should be just a few lines.
Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 12 Nov 1998 22:22:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Need easy way to convert P4 scripts to P5
Message-Id: <Pine.GSO.4.02A.9811121421290.791-100000@user2.teleport.com>

On Wed, 11 Nov 1998, Jason wrote:

> I need to convert a bunch of Perl4 scripts to run with Perl5.

Chances are, they are already converted. The most frequent problem is
putting an e-mail address within double-quotes. See perltrap for more
information. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 12 Nov 1998 14:23:31 -0800
From: "Gala Grant" <gala@sonic.net>
Subject: next loops
Message-Id: <72fn30$tc2$1@ultra.sonic.net>

Is there some reason you can't use a next loop more than once?
I am having trouble.
FILELOOP:while (defined ($line = <FILEIN>) )
{
    if ($line =~ /<TD valign="top" rowspan="1"/i)
    {
        while (defined ($line = <FILEIN>) )
        {
            if ($line =~ m|<IMG src="../images/b_cf.gif"|i)
            {
                while (defined ($line = <FILEIN>) )
                {
                    if ($line =~ /\/TD/i)
                    {
                    print FILEOUT <<"_BUTTONS1_";

                    SOME TEXT

_BUTTONS1_
                     next FILELOOP;
                    }
                }
            }
            if ($line =~ m|<img src="../images/b_nf.gif"|i)
            {
                while (defined ($line = <FILEIN>) )
                {
                    if ($line =~ /\/TD/i)
                    {
                    print FILEOUT <<"_BUTTONS2_"

                     SOME MORE TEXT

_BUTTONS2_
                    next FILELOOP;
                    }
                }
            }

It works fine with only the first next, but if I try it this way it says
there is a syntax error.  Any ideas?
any help is greatly appreciated.
Gala Grant
gala@sonic.net





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

Date: 12 Nov 1998 22:32:08 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: next loops
Message-Id: <slrn74mof8.kbb.sholden@pgrad.cs.usyd.edu.au>

On Thu, 12 Nov 1998 14:23:31 -0800, Gala Grant <gala@sonic.net> wrote:
>Is there some reason you can't use a next loop more than once?
No...

>I am having trouble.
<snip junk of code>
>                    print FILEOUT <<"_BUTTONS2_"
                                                 ^
You need a semicolon here otherwise you will get a syntax error.
(The error message makes it quite clear that the error is here and not
with the next, but your version of perl might be different and might
have different error messages).

<snip more code>

Well if I add that semicolon and all the }s at the end then it passes
perl -c for me anyway.

-- 
Sam

 "... the whole documentation is not unreasonably transportable in a
 student's briefcase." - John Lions describing UNIX 6th Edition
 "This has since been fixed in recent versions." - Kernighan & Pike


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

Date: 12 Nov 1998 23:49:07 GMT
From: James Frogel <tory1@IDT.NET>
Subject: Occasional Perl Script Failure
Message-Id: <72fs5j$6se@nnrp2.farm.idt.net>

I have a perl script that sleeps for 30 seconds and then checks for
the existance of a file. If it finds the file then it ftp's the
file to another machine. It runs 24x7 and seems to run without
problems for weeks at a time. 

However, after a few weeks it appears that the script fails during one
of the sleeps and drops from the machine. I cant seem to find the error.
Perhaps it is some sort of spurious kill signal? Anyway, I am on
Sun Unix Solaris 2.6 with a Sparc 5 96 Meg of memory and 4 Gig 
hard drive. Doing a "top" on the program every day produces no size
difference of the perl script executing in the background. 

Does anyone have any ideas on what this could be or how I could at least
get some sort of warning or error message?  I am on perl, version 5.004_01
with the Net module.

Thanks in Advance

Jim



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

Date: 12 Nov 1998 16:30:20 -0600
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: Passing Perl Hash Through DCOM
Message-Id: <72fnhs$qip@fohnix.metronet.com>

"Randy O'Meara" <randy.omeara@lmco.com> writes:
[ Stuff about "Passing Perl Hash Through DCOM"]
) The PerlCtrl documentation
) provides sample code that uses scalar values, but no arrays or hashes.

You have to marshall the data -- convert it into a stream of bytes
that can be passed through the network connection.  Then the other
side has to unmarshall the data.

Based on what you've said, PerlCtrl knows how to marshall a Perl
scalar.  If it doesn't know how to marshall a Perl hash, then you
can marshall the hash into a scalar and pass that through.

For the simplest of hases, you _could_ just use:

    $marshalled_hash= join( $;, %hash );

    %remote_copy_of_hash= split( /\Q$;\E/, $marshalled_hash );

assuming that all values in %hash are strings and no keys nor values
contain $;.

But, just in case someday you run into more complex hashes, you
should instead use one of the modules that do marshalling (see
also "deep copy" and "persistant data") such as FreezeThaw,
Storable, or even Data::Dumper.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: Thu, 12 Nov 1998 22:20:07 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl and CGI wrap : a weird problem
Message-Id: <Pine.GSO.4.02A.9811121419320.791-100000@user2.teleport.com>

On Wed, 11 Nov 1998, Kevin Hirst wrote:

> open (HEADER, "mheader");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 12 Nov 1998 23:27:57 GMT
From: tram@olympic.seas.ucla.edu (Tri Tram)
Subject: perl cgi script
Message-Id: <F2C16L.A2B@seas.ucla.edu>


I was wondering how I can make it so that only one person can access 
a web page at a time using a Perl CGI script?  I was thinking about creating
a lock file, and then unlink it when the user goes off the page.  But how
do you detect that the user has gone off the page?  Thanks.

--
-----------------------------------------------------------------
Tri Tram, Computer Science and Engineering at UCLA
http://www.seas.ucla.edu/~tram


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

Date: Thu, 12 Nov 1998 22:56:29 GMT
From: "Farouk Khawaja" <cresentmoon@geocities.com>
Subject: Perl scripts as a NT service
Message-Id: <01be0e8d$b99b68a0$79f0b381@nycpc121.nyc.cdc.com>

Hi All,

I'm trying to start run a perl script as a NT service.  My problem is that
my Perl code, interperter, and libraries are on a virtual drive (R: ) . 
Unfortuantely, that's my environment and I cannot change it.  When I try to
start the script from any other drive besides R:, perl cannot find any of
its libraries.

e.g.  My script calls socket.pm by invoking 'use socket'.  @INC points to
'\usr\lib\perllib\socket.pm'.  This is the correct location of the module
but it cannot be located if the script is started from say c:\

	c:\>r:\usr\sbin\mhs\replicate.pl

Is there any way to define a default drive in perl for Windows?  Does
anyone know how I can get around this limitation?

I guess I could always compile the code, but that would be one of my last
options.



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

Date: Thu, 12 Nov 1998 22:53:29 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Perl, ORacle & Linux
Message-Id: <slrn74mplo.7i.alastair@calliope.demon.co.uk>

Ron <mkshanx@uxmail.ust.hk> wrote:
>Hi, 
>
> I would really appreciate if somebody here can suggest a good book/site
>that you know of that deals with the above triangle..Perl, Oracle database
>backend and the LINUX OS. 

Perhaps try searching the web or past news postings.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Thu, 12 Nov 1998 22:59:57 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: perl/cgi script problem in html
Message-Id: <Pine.GSO.4.02A.9811121459220.791-100000@user2.teleport.com>

On Thu, 12 Nov 1998, Mark N. Salvador wrote:

> im creating a counter for my website and when i attach the <!--#exec
> cgi="http://www....../cgi-bin/counter.cgi"--> to the html file, it
> cannot execute.... why?

Sounds as if your webserver isn't doing what you want. Perhaps the docs,
FAQs, and newsgroups about servers could help you. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 12 Nov 1998 22:55:44 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Setuid works as "perl suid.pl" but not "suid.pl"
Message-Id: <Pine.GSO.4.02A.9811121451550.791-100000@user2.teleport.com>

On Thu, 12 Nov 1998 lee.gammell@ctaylor.co.uk wrote:

> My setuid script switches id , then switches back again fine when run
> as "perl suid.pl", but when run as "suid.pl" it will switch id, but
> then will not switch back again. Is it perl (5.00404) or is it the os
> (Solaris 2.5) ?

Could it be that you have suidperl (or sperl) installed on your machine?
On Solaris, that shouldn't be needed, I think. But once you've completely
switched to a non-root ID, you shouldn't be able to change back. Perhaps
you should fork a child process which will drop its permissions and do
some task. Then, when it has finished, your main process can go on as the
original user. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Thu, 12 Nov 1998 22:57:09 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: SMTP server on the Web
Message-Id: <slrn74mpsk.7i.alastair@calliope.demon.co.uk>

smcallister@my-dejanews.com <smcallister@my-dejanews.com> wrote:
>I know this is probably a stupid question, but I am going to ask it anyhow.
>
>Is there somewhere on the new an SMTP server that lets anyone use is as an
>email gateway?

Don't know but if you installed unix you'd have one for free.

>I would like to test some of the Matt's Scripts that use smtp.

Lots of people don't think much of those. Why not learn Perl?

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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