[9627] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3221 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 22 05:07:18 1998

Date: Wed, 22 Jul 98 02:00:25 -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, 22 Jul 1998     Volume: 8 Number: 3221

Today's topics:
    Re: Debugging Perl 5.x (Martin Vorlaender)
    Re: efficiency: print<<"xxx" vs. print (Matt Knecht)
        Expand variables without expanding "\t"'s - how? (Steve Mading)
    Re: Expand variables without expanding "\t"'s - how? (Larry Rosler)
        field <kamrani@ifi.uio.no>
        Filedate under win32 (Duane Smith)
    Re: Flow Analsys tools for perl (Martin Vorlaender)
    Re: GET & PUT from commandline <Tony.Curtis+usenet@vcpc.univie.ac.at>
        HELP! How do i read a remote HTML file into a local var <rudis@mindless.NOSPAMcom>
    Re: help: "LWP from CPAN" (CGI-Unix) (Martin Vorlaender)
        how to refresh??? <lem.zazul@sibnet.ru>
    Re: how to refresh??? (Larry Rosler)
    Re: Is there a location that I can lookup perl commands merzky@physik.hu-berlin.de
    Re: Need help with POST <jwb79@mail.idt.net>
    Re: open (IN, "foo.txt") works, open (IN, "$foo") does  (J|rgen P|nter)
        Pattern Matching Snafus groans@mailexcite.com
    Re: Pattern Matching Snafus (Larry Rosler)
    Re: perl executable for win95 <snif@xs4all.nonono.nl>
    Re: Perl for IIS4 (Martin Vorlaender)
    Re: print FIC  :  An easy question ! <uri@sysarch.com>
    Re: Strange problem.... <mkahlert@kagi.com>
        system("grep edu list|wc -l>a") alexYPchiu@hotmail.com
    Re: system("grep edu list|wc -l>a") merzky@physik.hu-berlin.de
    Re: What's wrong? <aperrin@mcmahon.qal.berkeley.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 22 Jul 1998 05:00:58 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Debugging Perl 5.x
Message-Id: <35b555ea.524144494f47414741@radiogaga.harz.de>

skillit@my-dejanews.com wrote:
: $ test2.pl
: Bad name after CLEARSTART_HOME:: at test2.pl line 36.

:  I am really getting tired of this message!!!!
: Does anyone know of a good resource for debugging perl?

perldebug -- but not for compilation errors...

: Is there a perldoc explaining error messages?

There is the diagnostics module.

: For those of you who just love to solve problems look at the
: following code. See anything obvious? {beside the point that it is incomplete}
: I believe the problem lies somewhere within the getenv subroutine.

Nope.

: $tmp_filename  = 'c:\temp\' . $$ . ".txt";
                           ^^
This is the problem: \' is special even in a single-quoted string.
So the string assigned to $tmp_filename is terminated by the quote
in front of CLEARSTART_HOME, and CLEARSTART_HOME' then is interpreted
as a module name (old style -- new style CLEARSTART_HOME::).

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Cetero censeo            | work: mv@pdv-systeme.de
 Redmondem esse delendam. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Fri, 17 Jul 1998 16:09:09 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <FGKr1.144471$on1.7747285@seletar.ap.deuba.com>

Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
>:Real Programmers don't write comments!  Seriously, comments should deal 
>:with higher-level function, not with implementation details, which should 
>:speak for themselves (assuming the reader knows the language).
>
>Why is it that so few programmers ever figure this out?  Even the
>millionth time you see an "add one to i" comment, it doesn't help.
>
>--tom
>
>    Basically, avoid comments. If your code needs a comment to be
>    understood, it would be better to rewrite it so it's easier to
>    understand.  --Rob Pike

In my experience, it's been that few programmers ever comment, not the
inverse.

I don't comment for the code I'm writing, I comment for the logic I'm
using.  Even if nobody ever sees it except me, it can be a useful map to
follow a program by.  This is especially true when you get deeply
nested, and are dealing with many variables or states.

They are also useful to explain why a particular contstruct was chosen.  I
often quantify something with:

# X would be a good deal faster if it was Y, but not nearly as
# bullet-proof.

All this and the fact that my employers love comments works for me
(Although, I think we can all safely say: '$i++; # increment $i' is a
pointless waste of time).

-- 
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"


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

Date: 22 Jul 1998 01:37:21 -0500
From: madings@earth.execpc.com (Steve Mading)
Subject: Expand variables without expanding "\t"'s - how?
Message-Id: <6p41b2$gaj@newsops.execpc.com>


A Simple question, I think: 

How do I interpolate a varaiable into a string without
also substituting the backslashed chars like '\t'?

Example:  $var is set to "C:\tempdir\filename", but the
"\t" and "\f" are literally in the string (not a tab and
a formfeed)  I want to print out the contents, like
so:  print "the file is called $var\n", but when I do,
it substitutes the tab for \t and the formfeed for \f.
If I switch to singlequotes to protect the backslashes,
then I can't interpolate the string with "$var" either.

Yes, I am already aware of the ability to double-backslash
the backslahses, but in this application that isn't very
easy to do.  The string needs to remain pure and 
unmolested for work in other parts of the code I didn't
write.

Reason for the problem:  This is for a web site where
the perl script needs to accept filenames in *any* form
for any OS, and that includes Windows's backward slashes.
-- 
Steve Mading:  madings@execpc.com   http://www.execpc.com/~madings



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

Date: Wed, 22 Jul 1998 00:36:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Expand variables without expanding "\t"'s - how?
Message-Id: <MPG.101f365abea7ce84989774@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc; copy mailed to Steve Mading 
<madings@earth.execpc.com>.]

In article <6p41b2$gaj@newsops.execpc.com> on 22 Jul 1998 01:37:21 -0500, 
Steve Mading <madings@earth.execpc.com> says...
> 
> A Simple question, I think: 
> 
> How do I interpolate a varaiable into a string without
> also substituting the backslashed chars like '\t'?
> 
> Example:  $var is set to "C:\tempdir\filename", but the
> "\t" and "\f" are literally in the string (not a tab and
> a formfeed)  I want to print out the contents, like
> so:  print "the file is called $var\n", but when I do,
> it substitutes the tab for \t and the formfeed for \f.
> If I switch to singlequotes to protect the backslashes,
> then I can't interpolate the string with "$var" either.

Why not?  The contents of a string variable have no recollection of the 
delimiters of the string.  Thus either

$var = "C:\\tempdir\\filename";

or

$var = 'C:\tempdir\filename';

produce identical values for $var and interpolate exactly the same 
string.  Try it and see.
  
 ...

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


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

Date: Wed, 22 Jul 1998 10:47:43 +0200
From: Kamran Iranpour <kamrani@ifi.uio.no>
Subject: field
Message-Id: <35B5A72F.781B@ifi.uio.no>

Hi

I am new to perl and my question may seem elementary but
please help.
I am looking for some function in perl that does the same
thing as awk does, i.e. print only a field of a line. To be
more specific I need to list all the machines belonging to
a certain network, which I does with :
exec('ypcat hosts.byaddr');
The output consists of several fields, like the ip, the full name...
I want to extract just the name of the machine without the domain name.
I would have done that in awk by just doing "print $3", where "3"
is the field I am looking for. Is there a similiar thing in perl ?
And why can't I do :
exec('ypcat hosts.byaddr | awk "{print $3}"');
This does not work in my perl script, as if it just ignores the
awk command.


Thanks in advance

Kamran


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

Date: Tue, 21 Jul 1998 16:57:58 GMT
From: (Duane Smith)
Subject: Filedate under win32
Message-Id: <35b6c848.125691655@news.etex.net>


Hash: SHA1

Greetings,

I am trying to get the date of a file using stat under perl for win32.
 I can get the filename, size, etc., but not the date.  What is the
answer?

TIA,
- --James


Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBNbTIkzuMQBTeV1ONEQKRMwCgxJYagH/Qq2sb8OAha9i1FG2Vg5sAoJPm
TydZdEUxmewWVq016mVADgey
=XJce
-----END PGP SIGNATURE-----



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

Date: Wed, 22 Jul 1998 05:16:38 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Flow Analsys tools for perl
Message-Id: <35b55996.524144494f47414741@radiogaga.harz.de>

Matthew Roderick (mat@icl.net) wrote:
: I'm after a tool that will look at a number of perl scripts (cgi) and
: modules (.pl &.pm) and analsys what scripts call what functions and what
: library modules are included, etc, etc.

: Is there such a beast ?

AFAIK, no -- only perl can parse Perl.

That said, you can get the files loaded by main:: via do/require/use using

  % perl -d yourscript

  DB<1> x keys %INC

(and the files loaded at a given point in a script by stepping to that
 point and issuing this command.)

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Cetero censeo            | work: mv@pdv-systeme.de
 Redmondem esse delendam. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 22 Jul 1998 08:55:11 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: GET & PUT from commandline
Message-Id: <7xk956l6i8.fsf@fidelio.vcpc.univie.ac.at>

Re: GET & PUT from commandline, JLEHMANN
<JLEHMANN@dsccc.com> said:

JLEHMANN> In win95, how can you pass GET and PUT information
JLEHMANN> to your perl script for testing?  For instance,
JLEHMANN> I'd like to be able to simulate "perl
JLEHMANN> login.pl?newuser".
          ^^^^^
             authenticate would be a better name


The CGI.pm module allows you to pass in arguments either on
the command line or via standard input, which makes it easy
to test perl CGI scripts outside of browsers...

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!    | personal email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.  |     tony_curtis32@hotmail.com


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

Date: 22 Jul 98 02:33:21 -0600
From: "rudis" <rudis@mindless.NOSPAMcom>
Subject: HELP! How do i read a remote HTML file into a local variable?
Message-Id: <B1DAFFF4-13C135@207.228.75.55>

I'm making a perl 5 CGI script in which i need to read remote html
files into local variables, similar to the way you can open local ones
with


open(FILE,"/local/path/to/file");

@somearray =3D <<FILE>;

close(FILE);


I've tried replacing the local path on the open command to a remote
URL (i.e.: open(FILE,"http://www.somehost.com/somefile.html");)), but
that doesn't seem to work.


Can someone please help me out by emailing me some code snippets to
rudis@mindless.NOSPAMcom (after removing the word NOSPAM from that
address).


Thanks in advance,

rudis


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

Date: Wed, 22 Jul 1998 05:39:08 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: help: "LWP from CPAN" (CGI-Unix)
Message-Id: <35b55edc.524144494f47414741@radiogaga.harz.de>

miedo (431854@cienz.unizar.es) wrote:
: Someone has written it to me, i asked how to open a document in the
: web;  like searchers do to pick up the title or keywords from your page.
: But i don4t undernstand nothing.
: What is LWP and CPAN?

CPAN is the "Comprehensive Perl Archive Network", available from
http://www.perl.com/CPAN/ and its mirrors.

LWP is the "libwww-perl", a collection of perl modules for accessing the
WWW. It is located at
http://www.perl.com/CPAN/authors/id/GAAS/libwww-perl-#.##.tar.gz
(#.## denoting the version number)

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Cetero censeo            | work: mv@pdv-systeme.de
 Redmondem esse delendam. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Wed, 22 Jul 1998 13:57:45 +0600
From: "Lem Zazul" <lem.zazul@sibnet.ru>
Subject: how to refresh???
Message-Id: <6p429n$mga$1@ntlg.sibnet.ru>

Hi!

Is where any way to tell internet browser (IE, or NS) don't load images from
local disk and load it each time from internet?

Lem




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

Date: Wed, 22 Jul 1998 00:39:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how to refresh???
Message-Id: <MPG.101f37196e0a0f6b989775@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc; copy mailed to Lem Zazul 
<lem.zazul@sibnet.ru>.]

In article <6p429n$mga$1@ntlg.sibnet.ru> on Wed, 22 Jul 1998 13:57:45 
+0600, Lem Zazul <lem.zazul@sibnet.ru> says...
> Is where any way to tell internet browser (IE, or NS) don't load images from
> local disk and load it each time from internet?

Yes, but this has nothing to do with Perl.  You will get a more 
authoritative answer by consulting newsgroups that deal with those 
browsers.

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


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

Date: Wed, 22 Jul 1998 08:06:16 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: Is there a location that I can lookup perl commands?
Message-Id: <6p46hn$mn7$1@nnrp1.dejanews.com>

In article <35B3C44F.91D1C08B@ns1.com>,
  David Freed <dfreed@ns1.com> wrote:
> I want to know how to get the current date in perl. While I was thinking
> about this I realized that I don't know of any place that I can look for
> a command to do a specific task. Is there such a location?


man perl?

 ...

       For ease of access, the Perl manual has been split up into a number of
       sections:

           perl        Perl overview (this section)
           perldelta   Perl changes since previous version
           perlfaq     Perl frequently asked questions

           perldata    Perl data structures
           perlsyn     Perl syntax
           perlop      Perl operators and precedence
           perlre      Perl regular expressions
           perlrun     Perl execution and options
>>>>>      perlfunc    Perl builtin functions
           perlvar     Perl predefined variables
           perlsub     Perl subroutines
           perlmod     Perl modules: how they work
           perlmodlib  Perl modules: how to write and use
           perlform    Perl formats
           perllocale  Perl locale support

           perlref     Perl references
           perldsc     Perl data structures intro
           perllol     Perl data structures: lists of lists
           perltoot    Perl OO tutorial
           perlobj     Perl objects
           perltie     Perl objects hidden behind simple variables
           perlbot     Perl OO tricks and examples
           perlipc     Perl interprocess communication

           perldebug   Perl debugging
           perldiag    Perl diagnostic messages

 and many more...
more docs at http://www.perl.org.
see also 'perldoc'

--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/

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


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

Date: 22 Jul 1998 07:36:48 GMT
From: "jim babbington" <jwb79@mail.idt.net>
Subject: Re: Need help with POST
Message-Id: <01bdb542$6d66e210$6488fdc7@dixon>



file <file@job.to> wrote in article
<6p23ti$e06$1@usenet51.supernews.com>...
: There is no code... but lets say I wanted to post to
: www.abc.com/script.cgi the following varialbes name with the value "file"
-
: email with the value "something@else" etc... and then the same fashion
for
: other scripts as well... i basically want to simulate the pressing of a
: submit-button...

You may want do download and play around with the LWP package. This package
allows you to emulate a "browser" as an http client. Also, be sure to read
about robots.txt compliance, before using this on someone else's http
server.

Have fun,

Jim


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

Date: 22 Jul 1998 04:40:13 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: open (IN, "foo.txt") works, open (IN, "$foo") does not???
Message-Id: <6p3qfd$124$1@penthesilea.Materna.DE>

In article <1dcji1n.2a0j0y1o0ejgiN@bay1-314.quincy.ziplink.net>, 
rjk@coos.dartmouth.edu says...
>
>J|rgen P|nter <Juergen.Puenter@materna.de> wrote:
>
>> Consider this problem solved.
>
>So, what was the solution?  It was an interesting problem, so I'm
>curious how you fixed it.

I myself didn't fix it. I finally got hold of the sysadmin for the server
where the script/webserver runs on. I asked him to look into it. He
fiddled around for some time and miraculously it worked thereafter.
He mumbled something about 'recent Unix update' 'space problems'
'frequent crashes' 'unstable behaviour' 'strange path problems'...

So I'm not sure what exactly caused this, but I was too happy that it
finally worked to press the question.

Have a nice day
	Juergen Puenter



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

Date: Wed, 22 Jul 1998 07:20:31 GMT
From: groans@mailexcite.com
Subject: Pattern Matching Snafus
Message-Id: <6p43rv$inp$1@nnrp1.dejanews.com>

Hi All, I posted this question to a similar newsgroup, but was directed back
to this one because I had a better chance of getting an answer here.  Here is
the thing.  I want to be able to read in a text file (specifically an html
file) and be able to 1. find a keyword within that text 2. if that keyword
exists in that text, it should be part of a javascript.  And if that keyword
exists, I want to be able to delete the Javascript from the page.

My first idea was to do something like the following:

#!/usr/local/bin/perl -w $file = 'rogue.html'; open(INFO, "$file"); @lines =
<INFO>; foreach $line (@lines) {  @fields =
split(/[<]script.*[</]script/,$line); # or something like that print @fields;
}

This does not work though because ".*" stops matching once it gets to a
newline character right?  It will not match past the end of a string.  But
HTML text is multilined, and has many strings.	So when there is javascript
in it, it might look like this:

<script LANGUAGE="JavaScript">
          script stuff here
        more script stuff here.
</script>

I need my perl script to start from the very first "<script.*" and delete or
split things up until the last "</script>."  I hope someone will have some
advice for my on this.  I have been looking everywhere for some answer to how
to do this (yes I have three books on perl).  Thanx in advance!
~Prime

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


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

Date: Wed, 22 Jul 1998 01:07:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pattern Matching Snafus
Message-Id: <MPG.101f3db6c35d5d01989776@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc; copy mailed to groans@mailexcite.com 
<groans@mailexcite.com>.]

In article <6p43rv$inp$1@nnrp1.dejanews.com> on Wed, 22 Jul 1998 07:20:31 
GMT, groans@mailexcite.com <groans@mailexcite.com> says...
 ...
>   I want to be able to read in a text file (specifically an html
> file) and be able to 1. find a keyword within that text 2. if that keyword
> exists in that text, it should be part of a javascript.  And if that keyword
> exists, I want to be able to delete the Javascript from the page.
> 
> My first idea was to do something like the following:
> 
> #!/usr/local/bin/perl -w $file = 'rogue.html'; open(INFO, "$file"); @lines =
> <INFO>; foreach $line (@lines) {  @fields =
> split(/[<]script.*[</]script/,$line); # or something like that print @fields;
> }

It would be nice if that were formatted legibly.  However...

> This does not work though because ".*" stops matching once it gets to a
> newline character right?  It will not match past the end of a string.  But
> HTML text is multilined, and has many strings.

Yes.  So you want to ignore line boundaries.  The easiest way is to 
undefine the input record separator and read the entire file into a 
scalar variable.  Then you can use the /s modifier on your regex to cause 
'.' to match new-lines as well as anything else.

The following is not tested (it's quite late here), but probably correct:

#!/usr/local/bin/perl -w
use strict;

my $file = 'rogue.html'; 
open(INFO, $file) or die "Couldn't open $file. $!";
{ local $/;  $_ = <INFO>; }
s!<script\s.*</script>!!is;
print;
__END__

Comments:  Starting with '-w' is good.  Adding 'use strict;' is 
better.  Your quotes around $file are bad style, and you forgot to check 
whether the file was opened successfully.  '<' is not special in a regex.  
You may want to add \s* within those tags, and you surely want to ignore 
case in HTML.

>   I have been looking everywhere for some answer to how
> to do this (yes I have three books on perl).

It's all documented in there!

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


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

Date: Wed, 22 Jul 1998 08:22:51 +0200
From: "Jonkers" <snif@xs4all.nonono.nl>
Subject: Re: perl executable for win95
Message-Id: <6p40e5$9hs$1@news.gns.getronics.nl>

Have a look at http://www.perl.com/latest.html (and do remember that win95
is a win32).

Sander

shane wrote in message <35B55A23.DD756549@baylinks.com>...
>Hello,
>
>Could somebody provide a pointer to a
>download for an executable for win95?
>
>If such a thing exists...
>
>I tried the IBM site and they have a link
>but it only produces a 404 message.
>
>
>Thanks,
>--
>Shane
>_______________________________________________
>http://www.baylinks.com/~gandoff1/sc/front.html




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

Date: Wed, 22 Jul 1998 07:02:58 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Perl for IIS4
Message-Id: <35b57282.524144494f47414741@radiogaga.harz.de>

Mike Wesolowski (mwesol@hacm.org) wrote:
: Has anybody gotten I/O redirection working in Perl for IIS4 running on a NT
: box?

: I am having trouble passing webform data back to perl to process.  My
: webform ask for info and I want to store that info in a file on the NT box
: but it seems the the i/o direction isn't being passed back as the values are
: null.

- Make sure that you've got Windows Scripting Host installed as part
  of Option Pack 4. You can verify this by looking for the file
  %system32%\cscript.exe.
- Using the CLI, go to %system32%\inetsrv\adminsamples.
- Run this:

        adsutil.vbs SET W3SVC/1/CreateCGIWithNewConsole 1

  It'll say that CScript isn't set up to handle this. That's ok.
- Click Ok.
- Click yes, you want to register.
- Run it again.
- Using MMC, restart all web sites.

%system32% denotes the system32 subdirectory in your WinNT directory.
MMC is the Microsoft Management Console.

The number in the adsutils parameter may be different if you have multiple
web sites on your system.

Hope it helps,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Cetero censeo            | work: mv@pdv-systeme.de
 Redmondem esse delendam. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 22 Jul 1998 02:03:21 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: print FIC  :  An easy question !
Message-Id: <x73ebumnh2.fsf@sysarch.com>

>>>>> "RJK" == Ronald J Kimball <rjk@coos.dartmouth.edu> writes:

  RJK> delta <delta@netpage.tm.fr> wrote:

  >> "I love comp.lang.perl.misc"
  >> 
  >> Here, it is the  " " that I would like automatically add to my line text

  RJK> If you want to include quotes, you need to specify them within the
  RJK> string.  Here is one way of doing that:

  RJK> print FIC "\"$in{'fond1'}\"" if $in{'fond1'} =~ m/\S/;

hey ronald, you should know about qq! a much cleaner way to do this and
it avoids the backwhacks and it handles nested pairs of
parens/braces/brackets

print FIC qq{"$in{'fond1'}"} if $in{'fond1'} =~ m/\S/;

TIMTOWTDI

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 22 Jul 1998 08:54:34 +0200
From: Matthias Kahlert <mkahlert@kagi.com>
To: Zach Malchano <zjm@fast-inc.com>
Subject: Re: Strange problem....
Message-Id: <35B58CAA.4AE67527@kagi.com>

Something like that can happen when an application called from Perl produces
an error or writes anything to stdout or stderr. If you call any
application, send it's aoutput to /dev/null

e.g.    eval `do anything here > /dev/null 2>&1`;

Perhaps something like that happens when "finger" is called...

Zach Malchano schrieb:

> I'm having a weird problem w/ a sperl program. The program takes some
> CGI info passed to it, and is suppose to call the system program finger.
> The error i get follows:
>
> [21/Jul/1998:21:18:19] failure: for host sc248.wpmedia.net trying to GET
> /cgi-bin/check.cgi, cgi-parse-output reports: the CGI program
> /usr/web/servers/test/cgi-bin/check.cgi did not produce a valid header
> (program terminated without a valid CGI header. Check for core dump or
> other abnormal termination)
>
> The program is the following:
>
> #!/usr/bin/sperl
>
> use ACGI::Cgi;
> use Shell qw(finger);
>
> my $cgi = new ACGI::Cgi();
> my %data = $cgi->get_cgi_input();
>
> $ENV{PATH} = "/bin:/usr/bin";
> $user = $data{'user'};
>
> if ($user =~ /^([-\@\w.]+)$/)  {
>         $user = $1;
>         $finger = finger("-m", "$1")";
>         print "Content-type: text/html\n\n";
>         print "<html><head><title>Checking username</title></head>";
>         print "<body><p>".$finger."</p>";
>         print "</body></html>";
>
> } else {
> die "Error!!! $!";
> }
>
> The cgi portion of the program is known to work, but i can't get around
> the perlsec measures (or at least i think this is my problem).
>
> Zach Malchano





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

Date: Wed, 22 Jul 1998 04:56:00 GMT
From: alexYPchiu@hotmail.com
Subject: system("grep edu list|wc -l>a")
Message-Id: <6p3rd1$8qs$1@nnrp1.dejanews.com>

  I have a mailing list. And I try to calculate the number of subscribers
in different groups, ie .edu, .com, etc. For shell, I can do it easily
with "grep .edu LISTNAME|cw -l". But I don't know how to do it using perl.

  I try something like the following, but I think it's awkward. Any
suggestions? BTW, I tried to put the number in a file.

#!/usr/bin/perl
open(FILE, ">test.html");
system("grep edu LISTNAME|wc -l>a");
open(IN,"<a");
$a=<IN>;
close(IN);
print (FILE $a);
close(FILE);

Thanks!

Alex Chiu
alexchiu@eurekais.com.tw

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


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

Date: Wed, 22 Jul 1998 08:40:01 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: system("grep edu list|wc -l>a")
Message-Id: <6p48h1$ok3$1@nnrp1.dejanews.com>

In article <6p3rd1$8qs$1@nnrp1.dejanews.com>,
  alexYPchiu@hotmail.com wrote:
>   I have a mailing list. And I try to calculate the number of subscribers
> in different groups, ie .edu, .com, etc. For shell, I can do it easily
> with "grep .edu LISTNAME|cw -l". But I don't know how to do it using perl.
>
>   I try something like the following, but I think it's awkward. Any
> suggestions? BTW, I tried to put the number in a file.
>
> #!/usr/bin/perl
> open(FILE, ">test.html");
> system("grep edu LISTNAME|wc -l>a");
> open(IN,"<a");
> $a=<IN>;
> close(IN);
> print (FILE $a);
> close(FILE);

There is a easy way to catch output:

#!/usr/bin/perl -w
use strict;

my ($a) = 0;

$a = qx {grep edu LISTNAME | wc -l};    # run shell and catch stdout
chomp $a;                               # get rid of "\n"
print "found $a\n";

# write to file if you want to...
open(FILE, ">test.html");
print (FILE "<BODY>Found $a members...</BODY>");  # or so :)
close(FILE);

Hope this helps...

Andre.


>
> Thanks!
>
> Alex Chiu
> alexchiu@eurekais.com.tw
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>


--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/

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


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

Date: Tue, 21 Jul 1998 22:53:04 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: What's wrong?
Message-Id: <35B57E40.DD25957C@mcmahon.qal.berkeley.edu>

On my system it works fine, despite half the group's thinking the problem
is the space between ! and / (no problem at my site, perl 5.003 under
Solaris 2.6), and the other half the group's thinking it's the name of the
program;  if I do

 ./ex

I get the hello, world output; if I do

ex

I get the standard /usr/ucb/ex prompt (:) -- NOT the error the guy
reported....

However, since his code worked fine in my system, I'm afraid I can't offer
an explanation of his problem.

Cheers-
Andy Perrin

Greg Bacon wrote:

> In article <35B4FBF1.697D@min.net>,
>         John Porter <jdporter@min.net> writes:
> : You happened to pick a name for program that is "already taken".
> : Name your file something more likely to be unique, like
> : "henriquez_test_001".  "test" is another name that frequently trips
> : people up.  Even if you pick something that you think should be safe,
> : like "foo", try to determine before-hand if it is already used.
> : If you use csh, check out the "which" command, for example.
>
> ...or just use ./ex
>
> Greg
> --
> open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
> f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
> d2ac158c84c4ece4d22d1000118a8d5491000000
> EOF



--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting -  (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King
http://socrates.berkeley.edu/~aperrin        to e-mail me)
    e-mail wheres-andy@socrates.berkeley.edu to find me!
-------------------------------------------------------------




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

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

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