[9838] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3431 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 12 17:08:17 1998

Date: Wed, 12 Aug 98 14:01:30 -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, 12 Aug 1998     Volume: 8 Number: 3431

Today's topics:
    Re: Q: Problems with <system> command (Gary L. Burnore)
    Re: Q: Problems with <system> command <jdw@dev.tivoli.com>
    Re: Regexp this! (if possible anyhow...) (Damian Conway)
        Simple regex problem. <richardr@airmail.net>
    Re: Simple regex problem. <mjforder@earthling.net>
    Re: Simple regex problem. <richardr@airmail.net>
    Re: SSI exec alternative (Craig Berry)
    Re: SSI exec alternative <ccunning@socrates.mps.ohio-state.edu>
        trying to execute a perl script using server side inclu st6hu@jetson.uh.edu
    Re: Using 2 delim's causing problems? <jdporter@min.net>
    Re: What's the most efficient regex to force NOT matchi <rootbeer@teleport.com>
        Zip File Script <ray@alabe.com>
    Re: Zip File Script <ccunning@socrates.mps.ohio-state.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 12 Aug 1998 19:47:16 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: Q: Problems with <system> command
Message-Id: <35d5f130.52073399@nntpd.databasix.com>

On 12 Aug 1998 18:33:54 GMT, in article <6qsn6i$pnk$3@client3.news.psi.net>,
abigail@fnx.com (Abigail) wrote:

>Matthias Kranz (kranz@paris.ifh.de) wrote on MDCCCVII September MCMXCIII
>in <URL: news:6qs3u9$aet$1@pandora.ifh.de>:
>++ 
>++ 
>++ The problem is that I get the result of system in rc, but I want also
>++ catch the output of the pgp command.
>
>Any reason why you can't find what you want in the manual?
>
Any reason why you still act like a jerk when you post?
-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: 12 Aug 1998 13:57:23 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Q: Problems with <system> command
Message-Id: <obg1f2yqng.fsf@alder.dev.tivoli.com>


kranz@paris.ifh.de (Matthias Kranz) writes:
> I have the following problem. I want to use the system command
> to invoke a pgp command on the system.
> 
> $rc = system("env PGPPATH=$PGPPATH pgp -fe $USER 2>/dev/null << $file");
> 
> The problem is that I get the result of system in rc, but I want also
> catch the output of the pgp command.
> 
> In Tcl I can write something like this:
> 
> set rc [catch {exec env PGPPATH=$PGPPATH pgp -fe $USER 2>/dev/null \
> 	<< $file} mess]
> 
> After the execution I have the result of the pgp command caught by the
> catch command in mess and the result of the system command in rc.
> 
> 
> Any ideas?

perldoc -f system

(esp the end of the 1st paragraph, where it talks about how system is 
"I<NOT> what you want to use to capture the output from a command" :)

-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: 12 Aug 1998 20:39:46 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Regexp this! (if possible anyhow...)
Message-Id: <6qsuij$aaf$1@towncrier.cc.monash.edu.au>

Niklas Matthies <matthies@fsinfo.cs.uni-sb.de> writes:

>I got a tough parsing task. Consider a text file, collapsed in a single
>scalar (i.e. a string containing newlines). It may contain C-style comments
>("/* ... */"), Pascal(?)-style comments ("(* ... *)") and/or C++-style
>comments ("// ... \n"). These may be freely nested and intermixed, and
>may (except the C++-style comments) span multiple lines. Now, I need the
>first line matching /^[ \t]* KEYWORD [ \t]+ (\w+) [ \t]*$/x that is _not_
>contained in any comment. More precisely, I need the word following the
>KEYWORD, plus the line number of that line, plus the remaining lines.

You might find it easier to use Parse::RecDescent to build a recursive
descent parser for your input. The file 'demo_decomment', which comes
with the package, gives an example of parsing out C++ comments. It
should be fairly easy to modify that example to preserve line information.

Damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 name: Damian Conway                           addr: School of Computer Science
email: damian@csse.monash.edu.au                        and Software Engineering
  web: http://www.cs.monash.edu.au/~damian           Monash University
  fax: +61-3-9905-5146                               Clayton 3168, AUSTRALIA


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

Date: Wed, 12 Aug 1998 14:02:51 -0700
From: "RickR" <richardr@airmail.net>
Subject: Simple regex problem.
Message-Id: <35d1e65c.0@news1.ibm.net>

I have a file which consists of the follwing two lines:

Listing of [system\currentcontrolset\services\netbt\adapters]

[Elnk31]

How do I search for whatever is in the second set of brackets, and pass that
value to a variable? For instance, $adapter = Elnk31.

I will now RTFM, but if anyone can supply an answer in the meantime, I would
appreciate it.  (I know it will be less rewarding if someone gives me the
answer, but it will be much faster and easier, which is why I use computers
and newsgroups in the first place).

Thanks




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

Date: Wed, 12 Aug 1998 21:23:01 +0200
From: "Matthew J. Forder" <mjforder@earthling.net>
To: RickR <richardr@airmail.net>
Subject: Re: Simple regex problem.
Message-Id: <35D1EB94.EA16598C@earthling.net>

Try this one for size

open FOO, "filename";
while (<FOO>) {
    if (/^\[(\w+)\]/) { $adapter = $1 }
}
close FOO;

Matthew Forder

RickR wrote:

> I have a file which consists of the follwing two lines:
>
> Listing of [system\currentcontrolset\services\netbt\adapters]
>
> [Elnk31]
>
> How do I search for whatever is in the second set of brackets, and pass that
> value to a variable? For instance, $adapter = Elnk31.
>
> I will now RTFM, but if anyone can supply an answer in the meantime, I would
> appreciate it.  (I know it will be less rewarding if someone gives me the
> answer, but it will be much faster and easier, which is why I use computers
> and newsgroups in the first place).
>
> Thanks
>



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

Date: Wed, 12 Aug 1998 15:00:54 -0700
From: "RickR" <richardr@airmail.net>
Subject: Re: Simple regex problem.
Message-Id: <35d1f3fb.0@news1.ibm.net>

That did the trick.  Thanks!  (This newsgroup is awesome. Mission
accomplished < 30 min.)


Matthew J. Forder wrote in message <35D1EB94.EA16598C@earthling.net>...
>Try this one for size
>
>open FOO, "filename";
>while (<FOO>) {
>    if (/^\[(\w+)\]/) { $adapter = $1 }
>}
>close FOO;
>
>Matthew Forder
>
>RickR wrote:
>
>> I have a file which consists of the follwing two lines:
>>
>> Listing of [system\currentcontrolset\services\netbt\adapters]
>>
>> [Elnk31]
>>
>> How do I search for whatever is in the second set of brackets, and pass
that
>> value to a variable? For instance, $adapter = Elnk31.
>>
>> I will now RTFM, but if anyone can supply an answer in the meantime, I
would
>> appreciate it.  (I know it will be less rewarding if someone gives me the
>> answer, but it will be much faster and easier, which is why I use
computers
>> and newsgroups in the first place).
>>
>> Thanks
>>
>




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

Date: 12 Aug 1998 20:13:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: SSI exec alternative
Message-Id: <6qst0u$4p3$2@marina.cinenet.net>

Ryan Bischoff (rbischof@onecall.net) wrote:
: I am unable to have SSI commands due to paranoid Network Admin.,
: so I can not initiate a cgi program via embedded exec command in my
: html.  I have tried a redirect through an image but it gives me a broken
: image every time. (ex. <img src= "cgi-bin/foo.cgi?anything.gif">).
: Any suggestions on how to initiate a cgi program within html without
: using any Server Side Include commands.??  Thanks in advance.

Your only real alternative is to turn the model around; have a CGI app be
your primary URL, and have it serve the page with any needed on-the-fly
content integrated as you go.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 12 Aug 1998 16:50:15 -0400
From: Chad Cunningham <ccunning@socrates.mps.ohio-state.edu>
To: rbischof@onecall.net
Subject: Re: SSI exec alternative
Message-Id: <35D20007.E92093C2@socrates.mps.ohio-state.edu>

Are you running Apache web server? If so, maybe he will let you get the PHP
module. PHP is a kick ass scripting language that embeds in html files. It's
simpler than Perl, and almost as powerful. Perl has some advantages, mainly
in filehandling, but I find PHP easier and capable for most uses. It let's
you put your scripting stuff right in the html file, rather than calling an
external script. Who needs SSI? It also let's you do conditional html, so
you can do an if statement in PHP, and then go back to plain html. Plus it's
faster than perl, especially as a module in apache.

http://www.php.net

Ryan Bischoff wrote:

> I am unable to have SSI commands due to paranoid Network Admin.,
> so I can not initiate a cgi program via embedded exec command in my
> html.  I have tried a redirect through an image but it gives me a broken
> image every time. (ex. <img src= "cgi-bin/foo.cgi?anything.gif">).
> Any suggestions on how to initiate a cgi program within html without
> using any Server Side Include commands.??  Thanks in advance.





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

Date: Wed, 12 Aug 1998 20:05:27 GMT
From: st6hu@jetson.uh.edu
Subject: trying to execute a perl script using server side include - help!
Message-Id: <6qssi8$dul$1@nnrp1.dejanews.com>

I'm trying to execute a perl script through a server-side include.  I need to
pass some arguments to the script and display the results inside the html
document.

Below is the html I used:

<html> <body background=recback.jpg bgcolor="#ffffff" text="#002200"
link="#0000FF" vlink="#009900"> <!--#exec
cgi="/cgi-itc/DB_Manager/db_search.cgi?setup_file=ssi_music_info_search.setup
 .cg i&submit_search=yes"--> </body> </html>

This does not work & one person told me it doesn't go through the CGI this
way.  Well, great, so how do I get it to work?



You can execute this script with arguments directly & it works:
http://www.ballparks.com/cgi-itc/DB_Manager/db_search.cgi?setup_file=ssi_musi
c_i nfo_search.setup.cgi&submit_search=yes


The html file above(with the ssi tag) is
titled:
http://www.ballparks.com/top10x.shtml
This does not work & I get the  [an error occurred while processing this
directive]  error

If anyone can help with this thanks!

Please reply via e-mail at st6hu@jetson.uh.edu

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 12 Aug 1998 16:36:42 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Using 2 delim's causing problems?
Message-Id: <35D1FCDA.6CA1@min.net>

Sara Rosso wrote:
> 
> I use one textarea for users to enter checkpoints and their dates,
> relating to a project. I have a need of two deliminators (;,|) because I
> need to separate the checkpoints from each other, as well as the
> checkpoint from its date.

The word is "delimiter".

> for $milestones (split /$delim/, $in{'milestones'}) { 
>   $towritemilestones .= "<tr>";
>   for $milestoneindiv ( split /$delim2/, $milestones )

> I also declare the two delim's globally by:
> $delim = ';';
> $delim2 = '|';
> 
> So obviously the ; is working and the | is not. Is there a problem with
> using | as a deliminator? Or is it another problem?

Indeed there is.  When used in a regular expression, the vertical bar
means "or".  For example, /foo|bar/ means match the string 'foo' or the 
string 'bar'.  In your case, you're splitting on /|/, which means
"nothing or nothing" -- not what you meant.  You want to "escape" or
"quote" the regex metacharacters (bar, in this case) in such a way
that they do not have their special meanings in the match.  The
perl function which does this is called quotemeta.  So you could say:

	$delim = quotemeta( ';' );  # just to be safe.
	$delim2 = quotemeta( '|' );

Alternatively, you can embed special characters in the match
pattern itself to cause quotemetafication; \Q begins the quoted
part, and \E ends it. So you could do this:

	split /\Q$delim2\E/, $milestones

Whatever you do, don't do it both ways.
I think, in your case, I would use the quotemeta() call.

-- 
John Porter


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

Date: Wed, 12 Aug 1998 20:24:51 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: What's the most efficient regex to force NOT matching any char? (repost)
Message-Id: <Pine.GSO.4.02.9808121309170.10161-100000@user2.teleport.com>

On Wed, 12 Aug 1998, Marco Moreno wrote, originally quoting me:

> > > If so, use /\b\B/ . I can't say that it's the most efficient
> > >  pattern ever, but you won't have to wait long for it to fail
> > >  to match!
> 
> I would think that this would be less efficient than [^\x00-\xff] or
> (?!.) since \b must read two chararacters before it can decide whether
> it is at a word boundary or not.

Only a benchmark will know for sure. But a benchmark may well show
different behavior on different versions of perl. And maybe even on the
same version with different machines or with different compilers? 

[ quoting Ilya ]

> > Hmm, I would use (?!).  Benchmarks welcome.

Ah, Ilya agrees with me. Mediocre minds think alike. :-)

> I'm doing character conversions on very large files so performance is
> critical.

I have a hard time believing that the difference will be enough to notice
on any real-world program, but you're welcome to prove me wrong! :-)

In fact, I have a hard time believing that the speedup you can get from
this is more than, say, 10% of the speedup you can get from improving your
code in other ways. (In short, I think you're trying to make your racecar
lighter by removing the racing stripes. :-)

Good luck with it!

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



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

Date: Wed, 12 Aug 1998 15:31:51 -0700
From: Ray White <ray@alabe.com>
Subject: Zip File Script
Message-Id: <35D217D7.CE028BE1@technovate.org>

Is there some fairly simple way to view a text file that has been zip
compressed on a Unix web server? I have some large text files, and I want to
zip them to save on my disk space and yet still let people view them on my web
site.
I could use Unix, Perl, HtmlScript, Javascript, or Java. Would perfer something
really simple and compatible with older browsers.




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

Date: Wed, 12 Aug 1998 16:44:03 -0400
From: Chad Cunningham <ccunning@socrates.mps.ohio-state.edu>
To: Ray White <ray@alabe.com>
Subject: Re: Zip File Script
Message-Id: <35D1FE93.C94DEF2E@socrates.mps.ohio-state.edu>

If you're just using gzip, then you can use the command gzip -dc to output the
data. You would have to write a perl script that executes gzip -dc filename and
then collects the data and spits it out to a web page.

Ray White wrote:

> Is there some fairly simple way to view a text file that has been zip
> compressed on a Unix web server? I have some large text files, and I want to
> zip them to save on my disk space and yet still let people view them on my web
> site.
> I could use Unix, Perl, HtmlScript, Javascript, or Java. Would perfer something
> really simple and compatible with older browsers.





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

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

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