[16805] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4217 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 3 21:05:38 2000

Date: Sun, 3 Sep 2000 18:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968029517-v9-i4217@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 3 Sep 2000     Volume: 9 Number: 4217

Today's topics:
    Re: $LIST_SEPARATOR bug?? <elephant@squirrelgroup.com>
    Re: A Challenge <got1toomany@trojans.com>
    Re: A Challenge (Tony L. Svanstrom)
    Re: A Challenge (Logan Shaw)
    Re: A Challenge (Martien Verbruggen)
    Re: cookies and SSI's (Tony L. Svanstrom)
    Re: cookies and SSI's <jpryan@labs.tamu.edu>
        CR/LF from a form <reevehotNOSPAM@hotmail.com>
    Re: CR/LF from a form <jpryan@labs.tamu.edu>
    Re: CR/LF from a form <reevehotNOSPAM@hotmail.com>
    Re: creating an enviroment variable (Martien Verbruggen)
    Re: creating an enviroment variable <elephant@squirrelgroup.com>
        Error embedding CGI in CGI using Perl? lilo_san@my-deja.com
    Re: Error msg in PPM "search" <elephant@squirrelgroup.com>
    Re: exec, Apache, win32 <elephant@squirrelgroup.com>
    Re: Getting a range of rows with DBI (Logan Shaw)
    Re: Getting a range of rows with DBI <elephant@squirrelgroup.com>
    Re: hello world? (Logan Shaw)
    Re: How do you use setuid in perl (Martien Verbruggen)
    Re: How to browse database with perl? <elephant@squirrelgroup.com>
    Re: How to truncate file after nth occurrence of string <lr@hpl.hp.com>
    Re: How to truncate file after nth occurrence of string <elephant@squirrelgroup.com>
    Re: Pattern Matching <bcaligari@my-deja.com>
    Re: Pattern Matching <elephant@squirrelgroup.com>
    Re: perl regex to strip out anything other than a lette <lr@hpl.hp.com>
    Re: perl regex to strip out anything other than a lette <sungfung@yahoo.com>
    Re: Relative to Absolute help? (Martien Verbruggen)
    Re: Self-extracting program miko@idocs.com
    Re: source code for newsgroups functionality <bhp@uni-c.dk>
        using VC++ to install modules <john@eagleinfosystems.com>
    Re: using VC++ to install modules <randy@theory.uwinnipeg.ca>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 03 Sep 2000 23:21:52 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: $LIST_SEPARATOR bug??
Message-Id: <MPG.141d7a8b9bbec89d98974c@localhost>

Uri Guttman <uri@sysarch.com> wrote ..
>try looking upthe docs on a unix platform or on the web from a reliable
>site. also a good book like the camel or even the desktop reference are
>worth keeping around at all times when you are hacking perl.

btw .. this 'reliable site' that you talk of can't be ActiveState 
themselves .. because that's also suffering the same problem with $``

these sorts of things in the HTML documentation are generally down to 
Pod::Html .. the $`` problem is the same one that means that throughout 
the doco the following appears

  looking for a ``bar'' that isn't preceded by a ``foo''

it does some peculiar conversions on double quotes - turning the first 
one into the two chars `` and the second one into the two chars '' .. 
it's hideous even in the above quoting type context .. and implemented 
badly enough to convert $" to $``

I don't know why it's done this way .. some sort of pretend unicode 
quotations .. I've made the following patch to v1.03 of Pod::Html


WARNING: this will not be to a lot of people's liking because it uses
         the unicode chars for open/close double-quotes - but it's easy
         to see where to adjust the patch for that



*** Html.pm.orig        Mon Sep 04 10:06:11 2000
--- Html.pm     Mon Sep 04 10:12:00 2000
***************
*** 1332,1343 ****

      my(@words, $lead, $trail);

!     # convert double-quotes to single-quotes
!     if( $$quote && $text =~ s/"/''/s ){
!         $$quote = 0;
!     }
!     while ($text =~ s/"([^"]*)"/``$1''/sg) {};
!     $$quote = 1 if $text =~ s/"/``/s;

      # keep track of leading and trailing white-space
      $lead  = ($text =~ s/\A(\s+)//s ? $1 : "");
--- 1332,1338 ----

      my(@words, $lead, $trail);

!     while ($text =~ s/"([^"]*)"/\x93$1\x94/sg) {};

      # keep track of leading and trailing white-space
      $lead  = ($text =~ s/\A(\s+)//s ? $1 : "");

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sun, 03 Sep 2000 23:51:23 GMT
From: James Bond <got1toomany@trojans.com>
Subject: Re: A Challenge
Message-Id: <5ro5rs460slic2tdgqpmukg8p3h4f3dkc5@4ax.com>

On Sun, 03 Sep 2000 16:58:00 GMT, marcel@codewerk.com (Marcel
Grunauer) wrote:

>On Sun, 03 Sep 2000 16:55:06 GMT, James Bond <got1toomany@trojans.com> wrote:
>
>>I came accross the following script. It was essentially designed to
>>display the contents of a directory on a web page. The writer said
>>he designed it for an ftp site.
>>
>>Although I like the script as is, I can't do what I really want with
>>it. I'd like to be able to display the contents of multiple dirs.
>>
>>I'm new to perl (not a programmer by any stretch), and I've tried
>>anything I can think of. I always end up killing the script, or only
>>seeing the contents of one dir.
>>
>>Any takers????
>
>
>I'll send you my rate card.
>
>Or did you have a specific Perl question?
Looking for suggestions... pardon me for thinking i could get any
here. Here's one for u, don't be such a prick!


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

Date: Mon, 4 Sep 2000 01:57:52 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: A Challenge
Message-Id: <1egew2z.mtgzdiog81dkN%tony@svanstrom.com>

James Bond <got1toomany@trojans.com> wrote:

> On Sun, 03 Sep 2000 16:58:00 GMT, marcel@codewerk.com (Marcel
> Grunauer) wrote:
> 
> >On Sun, 03 Sep 2000 16:55:06 GMT, James Bond <got1toomany@trojans.com> wrote:
> >
> >>I came accross the following script. It was essentially designed to
> >>display the contents of a directory on a web page. The writer said
> >>he designed it for an ftp site.
> >>
> >>Although I like the script as is, I can't do what I really want with
> >>it. I'd like to be able to display the contents of multiple dirs.
> >>
> >>I'm new to perl (not a programmer by any stretch), and I've tried
> >>anything I can think of. I always end up killing the script, or only
> >>seeing the contents of one dir.
> >>
> >>Any takers????
> >
> >
> >I'll send you my rate card.
> >
> >Or did you have a specific Perl question?

> Looking for suggestions... pardon me for thinking i could get any
> here. Here's one for u, don't be such a prick!

Here's a suggestion for you... Don't come with such a lame subject-line
as "A Challenge" and think that you can trick people into working for
free.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: 3 Sep 2000 19:44:46 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: A Challenge
Message-Id: <8our9u$q8q$1@provolone.cs.utexas.edu>

In article <9205rssmbg6g53m5goha4cvhb9qari0djf@4ax.com>,
James Bond  <got1toomany@trojans.com> wrote:
>I came accross the following script. It was essentially designed to
>display the contents of a directory on a web page. The writer said
>he designed it for an ftp site.
>
>Although I like the script as is, I can't do what I really want with
>it. I'd like to be able to display the contents of multiple dirs.
>
>I'm new to perl (not a programmer by any stretch), and I've tried
>anything I can think of. I always end up killing the script, or only
>seeing the contents of one dir.

I have a challenge too.  You see, I have some noodles, several cheeses,
some tomatoes, some ground beef, and various spices sitting here in my
kitchen, but I don't know how to cook.  So, I was wondering if some
bright young chef would like to come over and cook me a lasagna.

  - Logan


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

Date: Mon, 4 Sep 2000 11:35:51 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: A Challenge
Message-Id: <slrn8r5rj7.ucf.mgjv@martien.heliotrope.home>

On Sun, 03 Sep 2000 16:55:06 GMT,
	James Bond <got1toomany@trojans.com> wrote:
> I came accross the following script. It was essentially designed to
> display the contents of a directory on a web page. The writer said
> he designed it for an ftp site.
> 
> Although I like the script as is, I can't do what I really want with
> it. I'd like to be able to display the contents of multiple dirs.
> 
> I'm new to perl (not a programmer by any stretch), and I've tried
> anything I can think of. I always end up killing the script, or only
> seeing the contents of one dir.
> 
> Any takers????

First of all: Don't try to hide the fact that you want someone else to
do work for you behind phrases like 'A Challenge'. It isn't a challenge,
it's a request for help, for free. And before you repost this: Don't put
vaguaries like that in the subject of your post. It should express what
the post is about, not what you want.

Second of all, you will get some bad reactions to this, and that is not
surprising. This group consists of perl _programmers_, who normally have
much better things to do than to work for someone else on trivial
problems. If you want work done, hire a programmer, or learn to program
yourself. If you don't want to do either, you'll have to make do with
whatever you get for free, and you better realise that you can't
complain about that. If you do, you will end up in many killfiles, and
you will never be seen by those people anymore. One day, when you have a
real problem, that might be a big, huge bummer.

On to the problem.

> #!/usr/local/bin/perl

no -w, no use strict. bad, bad, bad.

> # END OF CONFIG

> # By the way, to Perl programmers:

Hey, that's us, I guess..

> # I'm not quite familiar with directory handling
> # I used a quite silly method to determine which is a dir 
> # and which is a file (but it works, of course)
> # If you have a better method, please email me

I have no clue what he's talking about here, but I think he's talking
about the virtual paths on the server, not real directories. otherwise,
-d and -f from perlfunc might be of help.

> ($action, $vir_path) = split(/&/, $ENV{'QUERY_STRING'});
> $vir_path =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

Ahem.. A CGI script, and no use CGI? I doubt you'll find many takers.
Too many incorrect CGI handling goes on in these scripts.

[snip] of the rest. At this moment in time it is clear to me that any
time spent on this would be much better spent on writing a new program,
from scratch. That is if I could be bothered to find out what exactly
this one is trying to do.

Note the followups, please.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Begin at the beginning and go on
Commercial Dynamics Pty. Ltd.   | till you come to the end; then stop.
NSW, Australia                  | 


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

Date: Mon, 4 Sep 2000 01:07:10 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: cookies and SSI's
Message-Id: <1egetrd.if1no31p2ie8mN%tony@svanstrom.com>

James Ryan <jpryan@cis.tamu.edu> wrote:

> This is my circumstance:  all of the HTML files are SHTML, and each SHTML
> file runs a script via server-side-include that displays a navigation
> panel if the user is logged in.  how do I access the client's cookie data
> from a script that is run as an SSI?

The same way that you would if it'd been a normal CGI-script.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Sun, 03 Sep 2000 19:57:20 -0500
From: James Philip Ryan <jpryan@labs.tamu.edu>
Subject: Re: cookies and SSI's
Message-Id: <39B2F370.9C946E01@labs.tamu.edu>

I may be doing something wrong, but when I run the script by itself (as in not
an SSI directive), the $ENV{'HTTP_COOKIE'} variable contains the cookie data.
When I run the script from an SSI (<!--#exec cgi=/cgi-bin/nameofscript.pl -->
), the variable is empty.  Any other suggestions?

-James Ryan

"Tony L. Svanstrom" wrote:

> James Ryan <jpryan@cis.tamu.edu> wrote:
>
> > This is my circumstance:  all of the HTML files are SHTML, and each SHTML
> > file runs a script via server-side-include that displays a navigation
> > panel if the user is logged in.  how do I access the client's cookie data
> > from a script that is run as an SSI?
>
> The same way that you would if it'd been a normal CGI-script.
>
>      /Tony
> --
>      /\___/\ Who would you like to read your messages today? /\___/\
>      \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
>  --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
>    on the verge of frenzy - i think my mask of sanity is about to slip
>  ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
>     \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/



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

Date: Mon, 4 Sep 2000 09:17:13 +1000
From: "James R" <reevehotNOSPAM@hotmail.com>
Subject: CR/LF from a form
Message-Id: <D3As5.8153$cr3.236109@ozemail.com.au>

I have a Perl CGI script I'm sending form data to. The script does not
format the data at all, so it's up to me to do it.

How can I insert a CR/LF character where I want it? Otherwise all the data
prints out in one big long string.

For example, after sending a form field saying "Hi <name>" I would want to
send a CR/LF before going on to a new field saying "I hope everything is
OK".

Please help if you know!

PS. I could try <br> but it won't work for people who use plain-text email
programs.
PPS. The script itself uses "\n" in certain place, but I can't get that to
work from within the form data (and I don't want to hardwire anything into
the script so that it remains flexible).




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

Date: Sun, 03 Sep 2000 17:25:44 -0500
From: James Philip Ryan <jpryan@labs.tamu.edu>
Subject: Re: CR/LF from a form
Message-Id: <39B2CFE8.64C14D93@labs.tamu.edu>

I am not sure what exactly your circumstance is.  Do you have fields in an
HTML document that you want to be able to enter a line feeds and carriage
returns in?  The only thing that MAY work is this:

&#10;        - line feed
&#13;        - carriage return

If you can be more specific I may be able to help a little more... by the way,
these codes only work in HTML.

Also, nice name

-James R

James R wrote:

> I have a Perl CGI script I'm sending form data to. The script does not
> format the data at all, so it's up to me to do it.
>
> How can I insert a CR/LF character where I want it? Otherwise all the data
> prints out in one big long string.
>
> For example, after sending a form field saying "Hi <name>" I would want to
> send a CR/LF before going on to a new field saying "I hope everything is
> OK".
>
> Please help if you know!
>
> PS. I could try <br> but it won't work for people who use plain-text email
> programs.
> PPS. The script itself uses "\n" in certain place, but I can't get that to
> work from within the form data (and I don't want to hardwire anything into
> the script so that it remains flexible).



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

Date: Mon, 4 Sep 2000 10:54:50 +1000
From: "James R" <reevehotNOSPAM@hotmail.com>
Subject: Re: CR/LF from a form
Message-Id: <avBs5.8251$cr3.237587@ozemail.com.au>

Thanks James R!

In clarification, I want to capture certain data in a form (the usual stuff,
name, email, subject, body) and send it to the specified email address as an
email. A "formmail" script.

The script I use will print exactly what data I send it, so if I don't send
it CRs it will send all the data in one big long string to the email
recipient. (eg. "Hi James I hope all is well That's all for now love
Nicole") whereas of course it should look...

<START>
Hi James

I hope all is well

That's all for now

love

Nicole
<END>

This script is multi-function (ie. I use it in a number of different
situations) so I can't hard-wire "\n" into the script as the script doesn't
exactly know what form data will be sent to it and in what order.

The only solution as I see it is to embed Hidden Fields into my HTML form
which send CR/LF characters at suitable spots in the data stream (because
although the Perl script is multi-function, each HTML page is purpose
written).

I tried sending "\n" (which works inside the script) but it failed.

I was hoping there's a work-around.

Thanks.

"James Philip Ryan" <jpryan@labs.tamu.edu> wrote in message
news:39B2CFE8.64C14D93@labs.tamu.edu...
> I am not sure what exactly your circumstance is.  Do you have fields in an
> HTML document that you want to be able to enter a line feeds and carriage
> returns in?  The only thing that MAY work is this:
>
> &#10;        - line feed
> &#13;        - carriage return
>
> If you can be more specific I may be able to help a little more... by the
way,
> these codes only work in HTML.
>
> Also, nice name
>
> -James R
>





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

Date: Mon, 4 Sep 2000 11:43:29 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: creating an enviroment variable
Message-Id: <slrn8r5s1h.ucf.mgjv@martien.heliotrope.home>

[Please, in the future, post your replies _after_ the suitably trimmed
text you reply to.]

On Sun, 3 Sep 2000 14:17:58 -0400,
	Pun H. Shiu <ship@long.eecom.gatech.edu> wrote:

[reordered post]

> On Tue, 22 Aug 2000, Aitor Garcia wrote:
> 
> > Hello everybody;
> > 
> > I'm a Perl newbie and I've got a little question.  I want to create
> > a new enviroment variable and set a value to it.  I have tried the
> > following code but it does not work.
> > 
> > #!/usr/bin/perl 
> > $ENV{"USE_NC"} = "1";
> 
> Putting the following line at the end of the script
> 
> exe $ENV{'SHELL'}
> 
> will create a subshell.

No, it doesn't. What you probably meant is

exec $ENV{SHELL};

But that doesn't start a subshell, it replaces the current process with
whatever $ENV{SHELL} is set to. And that could be quite disastrous. In
other words, don't do it, unless you know what you're doing. Copying bad
ideas like this leads to potentially dangerous situations. Understand
before you program.

Furthermore, if I am correct in assuming that you did indeed mean to
exec a shell, how does that answer the OP's question? The code they post
most definitely works, and that should have been the answer. With a
little more ESP, one could infer that the OP was trying to set an
environment variable in the CALLING program (be that a shell or not),
and point them to the FAQ rthat deals with this:

# perldoc perlfaq8
[snip]
    I {changed directory, modified my environment} in a perl
    script.  How come the change disappeared when I exited the
    script?  How do I get my changes to be visible?
[snip]

And because the OP was so vague in their question, we won't know what
they wanted exactly, until they come back and explain it a bit better.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | life ain't fair, but the root
Commercial Dynamics Pty. Ltd.   | password helps. -- BOFH
NSW, Australia                  | 


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

Date: Mon, 04 Sep 2000 00:56:08 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: creating an enviroment variable
Message-Id: <MPG.141d90a869c27f0d989752@localhost>

Pun H. Shiu <ship@long.eecom.gatech.edu> wrote ..

>On Tue, 22 Aug 2000, Aitor Garcia wrote:
-
>> 
>> I'm a Perl newbie and I've got a little
>> question.
>> I want to create a new enviroment variable
>> and set a value to it.
>> I have tried the following code but it does
>> not work.
>> 
>> #!/usr/bin/perl
>> $ENV{"USE_NC"} = "1";
>> 
>> Can anyone help me with this ?
>
>Putting the following line at the end of the
>script
>
>exe $ENV{'SHELL'}
>
>will create a subshell.

you forgot the smiley face to indicate that this was meant as a joke (I 
hope) .. also 'exe' is not a perl function


to the originator .. see the perlfaq8 question:

  "
   I {changed directory, modified my environment} in a perl script.  How
   come the change disappeared when I exited the script?  How do I get
   my changes to be visible?
  "

basically the environment variable was created - and set to the string 
"1" .. but it's only available to your script - and children of your 
script

perhaps you wanted instead to add a line to your .profile or .login file 
 .. or if on Win32 perhaps you wanted to adjust the registry

this will affect the environment of all shells that use these 
configurations during their startup (obviously - the shell has to read 
those configs after your script has made the changes - ie. it will not 
affect an already running shell)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sun, 03 Sep 2000 23:36:34 GMT
From: lilo_san@my-deja.com
Subject: Error embedding CGI in CGI using Perl?
Message-Id: <8ouna2$99h$1@nnrp1.deja.com>

I'm porting an SHTML website into CGI using Perl.  Since CGI doesn't
really support direct SHTML translation, I have to translate the SHTML
commands into CGI.

So, I made a function to catch incoming #exec cgi="/cgi-
bin/dirname/file.cgi" and to change that to system
("../dirname/file.cgi");  Nothing wrong, eh?  Well, the output of any
CGI script I run through system() appears at the TOP of the document,
NOT where I ran the script from!  Look here if you need to visualize
this: (http://www.animecenter.com/cgi-bin/reviews/review.cgi).

The image on top should be under Downloads on the right bar, even
though I executed the script under Downloads!  Argh!

Anybody know why and how to fix this extremely peculiar problem?

--LILO-san


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 03 Sep 2000 22:36:59 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Error msg in PPM "search"
Message-Id: <MPG.141d70043011b27198974b@localhost>

Bryce Pursley <hbpursle@duke-energy.com> wrote ..
>On Fri, 01 Sep 2000 17:10:48 GMT, jason <elephant@squirrelgroup.com>
>wrote:
>
>_________Cut____________
>>
>>alternatively .. you should be able to just go to line 494 of ppm.bat 
>>and add a PPM:: in front of RepositorySummary so it looks like this
>>
>>  my %summary = PPM::RepositorySummary("location" => $loc);
>________Cut_____________
>
>I did try this but I got the same error.  This time it had PPM: in
>front of the RepositorySummary piece.

taking your reply above literally - then you didn't try what I suggested 
 .. if it really had PPM: in front of RepositorySummary then you must 
have tried PPM:RepositorySummary and not PPM::RepositorySummary (which 
is what it should have been)

if you did do it correctly - then the problem must be in PPM.pm .. 
contact ActiveState

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Mon, 04 Sep 2000 00:21:26 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: exec, Apache, win32
Message-Id: <MPG.141d8880b67dddbd98974e@localhost>

Chris Seeling <chs@netlink.com.au> wrote ..
>This question is probaly more of an Apache question but here it goes:
>
>I would like to start a Window app. (such as Excel.exe) on the server
>using say
>    my_server/cgi-bin/test01.pl
>on the browser
>where test01.pl contains:
>        ...
>        exec("excel.exe");
>
>Excel should macro away and the job is done. Unfortunately this simplistic
>approach does not appear to work (the excel gui never appears). Is it a
>question of permissions on the cgi directory?
>
>(ps. I am a novice on Apache and Perl. So it's more than possible that I am
>missing the bleeding obvious).

I'm not certain on this .. but yes - I think it is a permissioning thing 
 .. but the "permissioning thing" might be more serious than you think .. 
to create a window on the server - the web server actually needs to be 
allowed to do this by Windows itself .. which I don't think it is

ie. (I think) it doesn't matter how much permissions the user who logs 
on actually has .. the web server itself doesn't have authorisation to 
create windows on the server .. think of it as sort of a sandbox thing

you'll probably find that the excel.exe application itself is running 
after the script executes .. but there's no window - and it is in sort 
of a limbo because the web server can't get a windows handle for it

now .. all that having been said .. and realising that I'm not sure 
about any of it .. you can probably still do what you want with the 
Win32::OLE module .. look it up in the documentation .. it allows you to 
interact with excel.exe (in a window-less mode) and run your macros from 
within the Perl code

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 3 Sep 2000 19:17:02 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Getting a range of rows with DBI
Message-Id: <8ouplu$q6m$1@provolone.cs.utexas.edu>

In article <8otrbg$cvc$1@news.tudelft.nl>,
Willem Joosten <nospam@jsoft.xs4all.nl> wrote:
>for a web database app I have to make a search result like output. So I need
>to show rows 1-10 on the first page, 11-20 second etc etc. The problem is
>the records in the database are not continuous so I can't just get the
>correct rows with a select.

Does your database support SQL "LIMIT"?  If so, that may be the
solution.  Of course, you can always read all the data every time and
throw away that which you don't want.  Another solution, if you already
have session keys for your visitors is to store the query into a
temporary file somewhere (or temporary database table) and store some
session-related information to allow subsequent runs of your CGI to
find the data.

  - Logan


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

Date: Mon, 04 Sep 2000 00:37:07 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Getting a range of rows with DBI
Message-Id: <MPG.141d8c323bf454ac989750@localhost>

Willem Joosten <nospam@jsoft.xs4all.nl> wrote ..
>for a web database app I have to make a search result like output. So I need
>to show rows 1-10 on the first page, 11-20 second etc etc. The problem is
>the records in the database are not continuous so I can't just get the
>correct rows with a select.
>
>Any clues on how to tackle this problem?

a) do the same 'select' each time - but limit the output to the 
requested row range

b) create a more complex system whereby a single 'select' is done on the 
initial running of the script .. and at that point a temporary table is 
created with all the results .. or with the primary keys of all the 
results .. which means that on subsequent calls the lookups are very 
quick

c) similar to (b) but store the results in some other persistent storage 
like a package hash variable in a mod_perl script that's available on 
subsequent calls .. you would need to use an identifier of some sort 
that's written back to the browser (eg. a hidden field, unique URL or 
cookie) so that you know who's who

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 3 Sep 2000 19:24:34 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: hello world?
Message-Id: <8ouq42$q7f$1@provolone.cs.utexas.edu>

In article <8ou9s2$8tr$1@orpheus.gellyfish.com>,
Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>On Sun, 03 Sep 2000 11:38:14 GMT Mark wrote:
>> And here is one without using any modules. 
>
>And here is one without using Perl :
>
>#!/bin/sh
>
>echo 'Content-type: text/plain'
>echo
>echo 'Hello, World'

And here's one without even using the shell:

	#! /bin/sed 1,2d
	
	Content-type: text/plain
	
	Hello, World

  - Logan


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

Date: Mon, 4 Sep 2000 11:46:00 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: How do you use setuid in perl
Message-Id: <slrn8r5s68.ucf.mgjv@martien.heliotrope.home>

On Sun, 03 Sep 2000 13:08:19 GMT,
	Colin Keith <newsgroups@ckeith.clara.net> wrote:
> In article <8oob50$gko$1@nnrp1.deja.com>, shobs11@my-deja.com wrote:
> >setuid should do it, and I can get this working in C/C++ but I would
> >like to use it within perl.
> >Can anyone tell me how to do this?
> 
> Tell you how to do what?
>   chown root.wheel filename.pl
>   chmod u+s filename.pl

very platform dependent answer. Group wheel doesn't exist on that many
systems. The ones with BSD heritage will most likely have it. Most other
probably not.

The rest of the post is correct, and contains good advice.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd.   | enough features yet.
NSW, Australia                  | 


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

Date: Mon, 04 Sep 2000 00:29:56 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: How to browse database with perl?
Message-Id: <MPG.141d8a829b78169a98974f@localhost>

Bernie <bfb@att.net> wrote ..
>Can someone please show me an example of using perl
>to browse a database using an html page?  I have perl
>communicating with a PostgreSQL database, and what I'd
>like to do is have several text fields which correspond
>to a record in a database, then have buttons to handle
>"Next", "Previous", "Update", etc.

the DBI documentation provides numerous examples

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sun, 3 Sep 2000 16:54:12 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to truncate file after nth occurrence of string
Message-Id: <MPG.141c84786810ce3898ad19@nntp.hpl.hp.com>

In article <39B2B940.F06FF1AF@cc.gatech.edu>, stephenk@cc.gatech.edu 
says...
> Bryan McAvoy wrote:

 ...

> Since you have a set delimeter, you can use $/ to pull full entries out of the
> file, instead of single lines:
> $/='$$';
> Calling <SVRFILE> in list context will return an array of product entries, and
> calling it in scalar context will return the next entry in the file.  So
> something like:
> $/='$$';
> print SVROUT scalar <SVRFILE> foreach (1..5);
> 
> should do the trick.
> Read perlvar for further info.

The answer is fundamentally sound.  It can be improved in two ways:

The value of $/ should be localized to a block, so other input statements 
aren't affected.

The delimiter would be less likely to occur inadvertantly if surrounded 
by newlines.

Thus:

    {
        local $/ = "\n\$\$\n";
        ...

Note also that the special variable $. will contain the number of the 
*record* read, not the number of lines read.  This is probably what you 
want to use to monitor counting the records.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 04 Sep 2000 00:09:45 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: How to truncate file after nth occurrence of string
Message-Id: <MPG.141d85c7587c80cc98974d@localhost>

Bryan McAvoy <gustfrnt@globalvision.net> wrote ..
>I want to truncate a log file. Basically this file consists of hundreds of
>similar products all separated by a "$$" string. I only want the last 5
>products. Thus, I want to truncate the log file after the 5th occurrence of
>the "$$" string and write that to a new file. I cannot figure out how
>truncate this file based on the nth occurrence of a string. Can anyone help?

your description sounds a little confused .. you want to truncate the 
file after the fifth occurence of '$$' and yet you also want the last 
five products ?

having no idea about your problem .. but making some guesses about what 
you actually mean

look up the input record separator variable $/ in perlvar .. you can set 
this to be whatever you like (eg. '$$') and it will then affect the 
diamond operator for input .. it will also affect the notion of line 
number that $. has (again - see perlvar for more information)

  perldoc perlvar

then within your while loop you should pushe and shift to and from an 
array - so you're always keeping the last five records in memory .. this 
means that when your while loop exits you will have the last five 
records

you could be writing the record that you shift off the array during each 
iteration .. which would mean that after the while loop exits you'd have 
the output file containing everything EXCEPT the last five entries and 
the array containing the last five entries

HTH

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sun, 03 Sep 2000 23:37:12 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Pattern Matching
Message-Id: <8ounb7$99n$1@nnrp1.deja.com>

In article <8otr57$d0l$1@nnrp1.deja.com>,
  sfcq2@my-deja.com wrote:
> Hello,
>
> I am creating a htaccess and htpasswd management system, but have hit
a
> bit of a hurdle.
>
> I can add all names and encrypted passwords to "htpasswd", but I want
to
> compare the names from the existing file to those in a new file that
> will update the site. If a name already exists, the user will not be
> sent an email confirming his username and password, because they are
> already there.
>
> I am creating the user as follows:
>
> $newline[$a] = $username[$a]. ":" .$newpass[$a];
>
> and this gives an output like:
>
> rob.phillips:a1fZxO.8KssXw
>
> which is added to a temp file. Then, I open htpasswd and search
through
> it line by line until a match is found like this:
>
> open (PASS, "<htpasswd") || die "Can't open htpasswd: $!\n";
> @oldusers = <PASS>;
> close (PASS);
>
> for ($a = 1; $a < @oldusers; $a++) {
>      $_ = $oldusers[$a];
>      if (/$newline[$a]/) {
>           DO STUFF
>      }
> }
>
> A match should be found because I am using the same data source fle
each
> time, but it never finds the entry in htpasswd. Have I missed
something?
>
> Thanks for your help,
>
> Rob.
>

In perlfaq 4, there are questions like:
"How can I tell whether a list or array contains a certain element?"
"How do I compute the difference of two arrays?"

Solutions use hashes.  At times...for quick and dirty solutions
involving a very small number of 'words' I like joining said words into
a string separated with a single space and search for the atoms using a
regex match /\b$atom\b/.

Brendon
++++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 04 Sep 2000 00:47:07 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Pattern Matching
Message-Id: <MPG.141d8e8761362057989751@localhost>

sfcq2@my-deja.com <sfcq2@my-deja.com> wrote ..
>Hello,
>
>I am creating a htaccess and htpasswd management system, but have hit a
>bit of a hurdle.
>
>I can add all names and encrypted passwords to "htpasswd", but I want to
>compare the names from the existing file to those in a new file that
>will update the site. If a name already exists, the user will not be
>sent an email confirming his username and password, because they are
>already there.
>
>I am creating the user as follows:
>
>$newline[$a] = $username[$a]. ":" .$newpass[$a];
>
>and this gives an output like:
>
>rob.phillips:a1fZxO.8KssXw
>
>which is added to a temp file. Then, I open htpasswd and search through
>it line by line until a match is found like this:
>
>open (PASS, "<htpasswd") || die "Can't open htpasswd: $!\n";
>@oldusers = <PASS>;
>close (PASS);
>
>for ($a = 1; $a < @oldusers; $a++) {
>     $_ = $oldusers[$a];
>     if (/$newline[$a]/) {
>          DO STUFF
>     }
>}
>
>A match should be found because I am using the same data source fle each
>time, but it never finds the entry in htpasswd. Have I missed something?

yup .. in Perl - like most languages - arrays are zero-based .. ie. the 
first element is at index zero .. not 1

there are a number of other improvements that can be made .. but there 
are two that will possibly affect the result of your program

currently you're checking the username *and* password .. which means 
that if someone signs up with the same username as an existing user - 
but with a different password then your program will consider them to be 
a new and completely different user

also .. usernames are generally case insensitive (by convention) and you 
may want to adopt this policy in your check as well (though obviously 
only once you've taken the password out of the equation)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sun, 3 Sep 2000 16:57:36 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: perl regex to strip out anything other than a letter or a numb
Message-Id: <MPG.141c85474c990f5b98ad1a@nntp.hpl.hp.com>

In article <sr39mj6qc5d126@corp.supernews.com>, cberry@cinenet.net 
says...

 ...

> If you want it to be locale-safe, and are willing to accept underscore _
> as well as letters and numbers, this very simple form works:
> 
>   $test =~ s/\W//g;
> 
> If you need to exclude _ as well, alternation can be added:
> 
>   $test =~ s/\W|_//g;

A character class would be somewhat more efficient than an alternation.

    $test =~ s/[\W_]//g;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 04 Sep 2000 00:37:27 GMT
From: sung <sungfung@yahoo.com>
Subject: Re: perl regex to strip out anything other than a letter or a numb
Message-Id: <7kr5rsomo9aiuaa3iqnjkhbu5huj0t9vb8@4ax.com>

Thanks for the help


Thanks,
sung

On Sun, 03 Sep 2000 01:18:11 GMT, cberry@cinenet.net (Craig Berry)
wrote:

>sung (sungfung@yahoo.com) wrote:
>: I'm trying to strip out anything other than a letter or a number from
>: a scalar, here's the regex I have:
>: 
>: $test =~ s/[^[a-zA-Z]\d]//g;
>: 
>: It doesn't work. I think it has to do with putting a character class
>: in an anti character class? I'm not sure.
>
>You can't nest classes like that; perl is parsing it as a class consisting
>of anythin no a left bracket or a letter, with the \d and the second right
>bracket being seen as ordinary regex pattern characters.  Since your $test
>string likely doesn't contain a lot of string matching that, the
>substitution ends up not happening.
>
>If you are happy with narrowing your match criterion from 'letters'
>(potentially locale-dependent) to 'English language, ASCII letters' (like
>in your attempt above, this is most readily done using tr/// like this:
>
>  $test =~ tr/A-Za-z0-9//cd;
>
>The 'c' modifier causes the match set to be complemented, becoming 'any
>character which is *not* a letter or number'.
>
>If you want it to be locale-safe, and are willing to accept underscore _
>as well as letters and numbers, this very simple form works:
>
>  $test =~ s/\W//g;
>
>If you need to exclude _ as well, alternation can be added:
>
>  $test =~ s/\W|_//g;



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

Date: Mon, 4 Sep 2000 11:25:34 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Relative to Absolute help?
Message-Id: <slrn8r5qvu.ucf.mgjv@martien.heliotrope.home>

On Sun, 03 Sep 2000 20:31:41 GMT,
	Bart Lateur <bart.lateur@skynet.be> wrote:
> ptomsic@my-deja.com wrote:
> 
> >Does anyone know of anything currently avail that will transform
> >relative links to absolute?
> >
> >I've got a full directory listing of 2400 html files, and I'm searching
> >for something that will allow me to supply the root directory, and the
> >URL, and have it transform (inside the HTML files)
> >a link such as (href=../../file.html) to
> >(http://sitename.com/dir1/dir2/file.html)
> 
> At least look into the documentation (at CPAN) for HTML::LinkExtor and
> URI::URL. Even if HTML::LinkExtor doesn't exactly do what you want (I
> think not), then you still can use it's source for inspiration for
> creating your own script. The functionality is all there.

Might I add another source you can use to copy ideas from: lwp-rget from
the LWP distribution does what you want.

Maybe after reading its documentation, you'll decide that you don't need
to write anything yourself at all. (make sure to understand the --depth
and --limit options, and to make sure you use them correctly).

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | System Administration is a dirty
Commercial Dynamics Pty. Ltd.   | job, but someone said I have to do
NSW, Australia                  | it.


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

Date: Sun, 03 Sep 2000 23:32:11 GMT
From: miko@idocs.com
Subject: Re: Self-extracting program
Message-Id: <8oun1r$97k$1@nnrp1.deja.com>

In article <8oqlha$ulk$1@orpheus.gellyfish.com>,
  Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Fri, 01 Sep 2000 11:40:41 GMT tltt@my-deja.com wrote:
> >
> > I would like to have a single program which when ran extracts from
> > itself all the files that constitute the system and installs them
> > in the right places after performing various checks
>
> You could do it with one file.


Interestingly (to me anyway) I just happenned to have developed such a
system, but I am now questioning the wisdom of it.

I've written an extensive set of Perl script utlities (which will
eventually be released GPL to the world) and to make the installation
as simple as possible I created a self-extracting Perl script. You
download the script, run it, answer some questions, and it explodes
itself into the entire set of scripts for the full application.

Then one of the nice people who's beta testing the software said "of
course, I'd like to look through the scripts before actually running
them" and I realized that that will quite difficult to do given that
everything's all mashed together in one file.

Indeed, I realized that my system is somewhat antithetical to the
concept of open source... like a Windows program, you have to run it
before you find out what it does.  I'm proud of my own programming, but
I'm also proud of being part of the open-source movement and I don't
expect everyone to just trust my code.

So what do you all think?  Is self-extraction a good idea?

-miko

--
Miko O'Sullivan
Author of The Mikodocs Guide to HTML
http://www.mikodocs.com/tags/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 04 Sep 2000 00:12:49 +0200
From: Bo Hedemark Pedersen <bhp@uni-c.dk>
Subject: Re: source code for newsgroups functionality
Message-Id: <39B2CCE1.8EAC63A0@uni-c.dk>

Thanks, here (NNML::Server) is a lot to dig into.

Bo

Colin Keith wrote:
> 
> In article <020920001222300624%brian+usenet@smithrenaud.com>, brian d foy <brian+usenet@smithrenaud.com> wrote:
> >there are modules for NNTP on CPAN.  there's no need to tell someone to
> >play with TCP/IP.
> 
> No, you're entirely correct. Lets see what's on offer..
> 
>    Net::NNTP - NNTP Client class
>    News::NNTPClient - Perl 5 module to talk to NNTP (RFC977) server
>    News::Article - Object for handling Usenet articles in mail or news form.
>    News::Newsrc VERSION 1.07 - manage newsrc files
> 
> In fact the only module on CPAN I can find that's an NNTP server (at least
> using "NNTP" in the search facility there) is:
> 
>    NNML::Server - a minimal NNTP server
> 
> It depends what's wanted of course. I mean just searching the text of the
> CPAN archives for NNTP might not be enough to find a module that is a
> complete NNTP server, it might be that there is one there. It might also be
> that the person might actually want to learn about how it works.
> 
> You know spawning child processes via fork() or open(), why you might want to
> poll from sockets. Perhaps tying technologies together so they can
> authenticate users via DBI, or using tie() to their owwn DB format.
> 
> But you know, no need to tell anyone that... *snort*
> 
> Col.
> 
> ---
> Colin Keith
> Systems Administrator
> Network Operations Team
> ClaraNET (UK) Ltd. NOC


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

Date: Sun, 3 Sep 2000 20:29:26 -0400
From: "John Menke" <john@eagleinfosystems.com>
Subject: using VC++ to install modules
Message-Id: <39b2ece7_2@news.eclipse.net>

I have VC++ and ActivePerl.  I want to install several modules on my system.
How do I configure VC++ so that the make commands work?

----------------------------------------------------------------------
                Best viewed with courier 10 ppt. Font

      .---.        .----------   John Menke
     /     \  __  /    ------   JCN Capital
    / /     \(  )/    -----    Eagle Information Systems
   //////   ' \/ `   ---      Research Consultant - Web Developer
  //// / // :    : ---      Home Phone No. 908-876-1538
 // /   /  /`    '--       Work Phone No. 914-627-1115
//         ///..\\\       Email: john@eagleinfosystems.com
         ==UU====UU==    http://www.eagleinfosystems.com




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

Date: Sun, 3 Sep 2000 19:49:43 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: using VC++ to install modules
Message-Id: <8ourq1$jv9$1@canopus.cc.umanitoba.ca>


John Menke <john@eagleinfosystems.com> wrote
     in message news:39b2ece7_2@news.eclipse.net...
> I have VC++ and ActivePerl.  I want to install several modules on my
system.
> How do I configure VC++ so that the make commands work?

Look at Perl's Config.pm file (eg, in C:\Perl\lib\), and
adjust (possibly) the entries cc='cl', make='nmake', and
and libpth="...". Then just go ahead and make modules
in the usual way:
    perl Makefile.PL; nmake; nmake test; nmake install
Make sure that you run VC++'s vcvars32.bat (which
sets various environment variables) before starting.
You might also want to look at the CPAN.pm module
for installing things automatically; type, in a DOS window,
    perl -MCPAN -e shell
which will take you through a configuration dialogue.
Installing modules then proceeds, in the CPAN shell,
as, for example,
    cpan> install Net::FTP

best regards,
randy kobes





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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4217
**************************************


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