[7017] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 642 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 21 09:07:41 1997

Date: Sat, 21 Jun 97 06:00:42 -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           Sat, 21 Jun 1997     Volume: 8 Number: 642

Today's topics:
     Re: "Cloning" a Perl install (no C compiler) <james.bouressa-next@attws.com>
     Re: ***How to get info from the HTML files in other ser <levenez@club-internet.fr>
     Re: Broken Pipe (Matthew Burnham)
     Can I 'step out' in perldb? <mdsmith@qualcomm.com>
     Re: Case-matching substitution? (Chris Cole)
     Re: CGI.pm and multiple spaces in html. <c.evans@clear.net.nz>
     Re: could this script be made more optimized?? <wesley@woais.com>
     Re: could this script be made more optimized?? (Tung-chiang Yang)
     CSV Files <chriskl@tartarus.uwa.edu.au>
     Re: Error msg (Tad McClellan)
     Help with Arrays? <maelstrom@deathsdoor.com>
     Re: How do you make a perl script jump to another URL?? (Eric Bohlman)
     Re: HTML Doc Tags Missing? (Eric Bohlman)
     Re: need help in sockets - test a port is all <justinb@cray.com>
     Re: None <nelson@cae.ca>
     Perl and C-ISAM file. Re. DBI Module (Poul Kornmod)
     Re: print statement question (Tad McClellan)
     Re: Python as an intermediate lang for compiler/interpr <lkrupp@netONE.com>
     Re: reading end-of-line in a string <twpierce+usenet@mail.bsd.uchicago.edu>
     Re: reading end-of-line in a string <maelstrom@deathsdoor.com>
     Re: reading end-of-line in a string <wesley@woais.com>
     Regular expression matching \s question <comeyk@sisna.com>
     Re: Regular expression matching \s question (Tad McClellan)
     Re: Testing for the non-existence of a variable. <jefpin@bergen.org>
     Re: uc function for PERL4 (Tad McClellan)
     Re: Why is system() failing when used as CGI? (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Jun 1997 19:36:38 -0500
From: James Bouressa <james.bouressa-next@attws.com>
Subject: Re: "Cloning" a Perl install (no C compiler)
Message-Id: <33AB2215.2CFE5B2A@attws.com>

Brian Jepson wrote:

> In article <866657638.20693@dejanews.com>, Robert Flannigan wrote:
> >before I go about re-inventing the wheel, I was wondering if there
> was a
> >"canned" method for duplicating a specific Perl build to X number of
> >systems on a network (37 in my case).
>
>
> [...]
>
>
> You should be able to tar the directory up, and put it on all the
> other machines. Then, you can symlink /opt/perl/bin/perl to
> /usr/bin/perl and /usr/local/bin/perl. Another nice thing is that
> for machines that are relatively close to each other, you could
> just export /opt/perl via NFS, and there will be no need to use up
> any extra disk space.
>

   Brian is right on both counts.You can scoot the same installation of
Perl around to machines of the same OS, and you can definitely NFS mount
it also. I currently use both methods. 'Though, if speed is an issue for
your users, avoid NFS mounting the same dir to more than a few clients,
however close they may be, as performance will be awful, no matter how
fast your LAN.



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

Date: 20 Jun 1997 21:13:27 GMT
From: Eric Levenez <levenez@club-internet.fr>
Subject: Re: ***How to get info from the HTML files in other server??***
Message-Id: <5oerpn$9ah$6@newsfeeds.grolier.fr>

Johnny <jpoon@iastate.edu> wrote:
 >     Is there any ways to get information from a HTML files located in
 > other server (different from the one you are on)??  I want to be able to
 > grep info from HTML files in other server and use it in my own HTML
 > file.  If you have any clue, please help me out.

Your browser can display the HTML source code. If you want to load yourself
the HTML page, look at HTTP specification.

-- 

--------------------------------------------------------------------
Iric Livinez              "Felix qui potuit rerum cognoscere causas"
mailto:levenez@club-internet.fr              Publius Vergilius Maro,
(NeXTMail, MIME)                                   Georgica, II-489
--------------------------------------------------------------------


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

Date: Sat, 21 Jun 1997 11:15:24 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: Broken Pipe
Message-Id: <33b2efa5.10279238@194.72.192.4>

Alex `Taker` Pircher <pircher@informatik.tu-muenchen.de> wrote:

>I got "Broken Pipe" after I opened & closed several Connections
>to my (with perl created) Socket.
>
>What I'm making wrong?

Being as I got the same problem yesterday, I expect you've got a bad
pipe (my problem was calling fly as fly and not ./fly).



-- 
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.mindweb.co.uk/


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

Date: Fri, 20 Jun 1997 18:22:44 -0700
From: Michael Smith <mdsmith@qualcomm.com>
Subject: Can I 'step out' in perldb?
Message-Id: <33AB2CE4.3091@qualcomm.com>

How do I perform a 'step out' interactively using the perl debugger?  I
basically want it to finish executing the current subroutine, and stop
when it has gone back to the previous context on the stack.

Thanks,
-- Michael Smith


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

Date: 21 Jun 1997 04:11:39 GMT
From: dmi@deltanet.com (Chris Cole)
Subject: Re: Case-matching substitution?
Message-Id: <5ofk9r$m16$1@news01.deltanet.com>

In article <33AABB84.778FA493@siva.usc.edu> J Allen <allen@siva.usc.edu> writes:
>    $search = "cat";
>    $replace = "feline";
>    s/($search)/if (uc $1 eq $1){uc $replace} 
>    elsif (ucfirst $1 eq $1) {ucfirst $replace} 
>    else {$replace}/iexg;
At the risk of offending accented characters,
here's a method which relies upon an idiosyncracy of 
the way that English letters are represented in ASCII.  
(although many other locales share the relevant idiosyncracy)

	$search = "cat";
	$replace = "feline";
	$_ = "cat Cat CAT CaT CAt caT cAt cAT\n";

	s/\b($search)\b/
		my($c,$l,$r) = ($1,(length $replace)-length $1,lc $replace);
		substr($c,$l<0?$l:-1) x= $l>=0?$l+1:0;
		$r ^ ($r^uc $r)&($c^lc $c)
	/gie;

	print $_;


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

Date: 21 Jun 1997 19:44:36 +1200
From: Carey Evans <c.evans@clear.net.nz>
Subject: Re: CGI.pm and multiple spaces in html.
Message-Id: <87hgesbdsr.fsf@psyche.evansnet>

Daniel Lortie <dlortie@nt.com> writes:

[snip]

> I know there is the 'p' and 'br' tags but I wish there was a 'nbsp' tag
> or something like nbsp(3) to insert three spaces.

Like  print '&nbsp;'x3;  ?

*Please* remember the ; at the end so as not to generate broken HTML.

-- 
                Carey Evans  <*>  c.evans@clear.net.nz

       "Our mail program accidentally deleted our remove list."
						 - Real quote from UCE


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

Date: Sat, 21 Jun 1997 00:52:57 -0500
From: Wesley Miaw <wesley@woais.com>
Subject: Re: could this script be made more optimized??
Message-Id: <33AB6C3A.41C6@woais.com>

Shane 'Fishman' Sherman wrote:
> 
> I know this has something to do with CGI but i think that the actual
> question is more about PERL. here is a portion of the code:
> 
> [code]
> 
> wouldnt there be an easier way of doing this instead of reading all
> the lines and printing them all again?? The bigger the file stored in
> $real gets the longer this program will take to run. Is there a way to
> create a filehandle that you can write to but it doesnt first erase
> the contents of the file? It would be SO much more efficient if you
> could just have it do something like this:
> 
> [code]

Instead of reading a file, closing it, and then reopening the exact same
file to write, simply start by opening the file with read and write
access (make sure to lock it).

Then, you can go through using tell and seek to replace portions of the
file by overwriting line by line, instead of the entire file. Here's an
example:

$location = tell FILE;
while ($line = <FILE>) {
	if ($line =~ /<!--begin-->/) {
        seek(FILE, $location, 0);
        print FILE "$lake{'comments'}<BR>\n";
    }
    $location = tell FILE;
}

This code is not debugged. But basically, tell FILE puts the current
location of the "cursor" in the file into $location. The first time this
is called, $location = the beginning of the file. Thereafter, it equals
the start of the next line. seek moves the cursor back to the beginning
of the current line if the match is found, as $line = <FILE> moves the
cursor to the next line. $location = tell FILE; needs to be at the end
of the while loop to update the cursor location.
-- 
Wesley Miaw                               wesley@woais.com
World of Artists Internet Services        http://www.woais.com/
71 Middlesex Drive                        Tel: 518-439-0412
Slingerlands, NY 12159                    FAX: 518-439-9722


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

Date: Sat, 21 Jun 1997 07:01:49 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: could this script be made more optimized??
Message-Id: <tcyangEC4671.M25@netcom.com>

I believe you can just use

   while (<OUTPUT>){
      if (/<!\-\-begin\-\->/){
	 print OUTPUT1 $lake{'comments'}, "<br>\n";
      }
   }

It is usually not a good idea to read something from the handle OUTPUT
and then write something to it, so I used OUTPUT1 above.

I am not sure if you need to escape hyphen above.  I did not know for sure
a few weeks ago, and I still did not know.  Sigh.

==================================
Shane 'Fishman' Sherman typed before Poison Ivy kissed him:

: (deleted)

: wouldnt there be an easier way of doing this instead of reading all
: the lines and printing them all again?? The bigger the file stored in
: $real gets the longer this program will take to run. Is there a way to
: create a filehandle that you can write to but it doesnt first erase
: the contents of the file? It would be SO much more efficient if you
: could just have it do something like this:

: while($line=<OUTPUT>){
: 	if ($line =~/<!--begin-->/){
: 		print OUTPUT $lake{'comments'}, "<br>\n";}
: }

--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: 21 Jun 1997 12:08:32 GMT
From: "Christopher Kings-Lynne" <chriskl@tartarus.uwa.edu.au>
Subject: CSV Files
Message-Id: <01bc7e3c$25f3bf40$3aa15f82@kings-lynne>

Has anybody got a Perl script which can read in CSV files?

Otherwise, can anybody tell me what the syntax error in the following code
is? (Near the if apparently)

    while (($line eq &read_file("FILE1"))) {
      # split the fields at the , character
      @tabledata = split(/,/,$line);

          if ( ($tabledata[0] ge $start) && ($tabledata[0] le $stop) ) {
            print "<TR>\n";
            foreach $data (@tabledata) {
              print "<TD><B>$data</B></TD>\n";
            }            
            print "</TR>\n";
            $counter++;
          }
    }

The $start and $end are read in from the GET call.  The tabledata things
are read in from a file.

Please reply by email if possible.

ps. I'm really new to the whole Perl thing.

-- 
Christopher Kings-Lynne
http://www.student.uwa.edu.au/~chriskl/


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

Date: Fri, 20 Jun 1997 18:22:27 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Error msg
Message-Id: <jb3fo5.d1e.ln@localhost>

Joshua Frank (joshua@midwest.net) wrote:
: if($tot <= 38)
: {
: 	print "Content-type: text/html\n\n";
: 	print "<html>";
: 	....
: 	....
: 	....
: }

Looks fine to me.


: Perl says that there's something wrong next to "print" it said syntax
: error.

Where is the exact error message.


: Am I doing somthing stupid and missing somthing simple or what?
  ^^^^^^^^^^^^^^^^^^^^^^^^^^

Yep ;-)  Asking about an error message without providing the exact error
message.

You should also try looking it up in the perldiag man page.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Fri, 20 Jun 1997 20:35:23 -0600
From: Maelstrom <maelstrom@deathsdoor.com>
Subject: Help with Arrays?
Message-Id: <866856252.28185@dejanews.com>

Hi.  I'm learning Perl and am confused by the structure of Arrays. I've
checked the FAQ and still can't find the answer.  At the moment I have an
array called $FORM. One of it's fields is called 'Comments' which contains
a string.  As my understanding is I should be able to access each
character in that string by $Comment[1] $Comment[2] and so on.

What I'm trying to do in the snippet of code is to print each character
individually rather than the whole string. Can anyone see what I'm doing
wrong here? I keep getting the error
*The server can not locate the file specified
When I was using the commented out line everything worked fine.

   if $FORM('Comments')
             {
             # print MAIL "$FORM{'Comments'}\n\n"; <-- was using this
             $count = '1';
             foreach $count ($Comments)
               {
                print MAIL "$Comments[$count]";
               }
             }

Any help would be much appreciated.
--Maelstrom
"LOOK AT MEEEEE!!!! I'm a forced metaphor
making a profound philosophical statement."
sammie@world.std.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Sat, 21 Jun 1997 07:06:52 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: How do you make a perl script jump to another URL??
Message-Id: <ebohlmanEC46FG.85y@netcom.com>

Joshua J. Kugler (FIGHT-SPAMjkugler@inreach.com) wrote:
: Try this:

: <meta http-equiv=refresh
: content="5;url=http://place.url.here/and/directory">

: This goes in the html file, and replace the 5 with the number of
: seconds you want to wait before retrieving the new URL.  For an
: instant transfer, use 0.

Using 0 effectively flushes the user's history stack, as when he goes 
back and lands on the "redirect page" it immediately takes him forward 
again.  Genuine redirects using the Location: header don't have this 
problem, as they don't show up as documents in the history stack.



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

Date: Sat, 21 Jun 1997 06:56:26 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: HTML Doc Tags Missing?
Message-Id: <ebohlmanEC45y2.7p9@netcom.com>

Parillo (lparillo@newshost.li.net) wrote:
: I just downloaded the latest Perl from Activeware.
: The HTML formatted docs no longer seem to have links from the perl.html 
: page. Is that the case in all docs? If not, can I download documentation 
: from another release without stepping on my Win32-specific docs?

I used the following little script (which is dependent on the way the 
original page was marked up, so it will work for this application but is 
not very general) to add in the proper links:

open INFILE, "<perl.htm" or die "$!";
open OUTFILE, ">perl1.htm" or die "$!";
while (<INFILE>)
{s!(<LI>\s+)(perl.*?\b)!$1<A HREF=\"$2.htm\">$2</A>!;
 print OUTFILE;
}
close INFILE;
close OUTFILE;

Much of this could, of course, be replaced with a one-liner; I wrote it 
the way I did for personal pedagogical purposes (trying to "internalize" 
some syntax).



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

Date: Fri, 20 Jun 1997 22:41:05 -0500
From: Justin Banks <justinb@cray.com>
Subject: Re: need help in sockets - test a port is all
Message-Id: <33AB4D50.59E2@cray.com>

Tony Reeves wrote:
> 
> I don't know much about sockets in perl.. but here is what I need to
> do..
> 
> I have a list of ip addresses in our intranet.
> I want to check each ip address at port 80 to see if a webserver is
> there.
> 
> seems to me that a socket would do this nicely, just connect, if
> connect web must be there, else no web..
> 
> I've looked at the commands for socket.pm and I'm not sure I
> understand how to do a connect..
> can someone help me?
> 
> please send email if you can.
> 
> ---
> Tony Reeves
> N7SF - areeves@goodnet.com, tony@toners.com - HF: 14.242Mhz or 7.239Mhz
> Homepage: http://www.toners.com - http://www.goodnet.com/~areeves
> The secret to imortality: 4A 65 73 75 73

Can't you just do this :

open HOSTS, "/etc/hosts" or die "bleen!: $!";

while (<HOSTS>) {
	$status = `telnet $_ 80";
	if ($status =~ /refused/go) {
	  $hosts{$_} = "nope";
	   next;
   	}
	$hosts{$_} = "yup";
}

Granted, I've not tried this (or even tried to compile it), but it seems
like the idea would work.


-- 
Justin Banks
Silicon Graphics Cray Research
Eagan, Minnesota


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

Date: Fri, 20 Jun 1997 15:56:47 -0400
From: Nelson Asinowski <nelson@cae.ca>
To: Chris Fogarty <ctf@faithquest.com>
Subject: Re: None
Message-Id: <33AAE07F.4278@cae.ca>

I took a quick glace at it but could not see the problem.
Even though this is a simple script a little more detail is needed.
Where does it not work.. how far throught the script does it run
correctly. Are the input values getting to the script (If not its a web
server problem) A little debug detective work is needed work is in order
before someone could answer your questions.

Also this question may get more respones with a clear subject and sent
to comp.infosystems.www.authoring.cgi because while the laguage is perl
the issue is a CGI topic.


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

Date: Fri, 20 Jun 1997 21:27:17 GMT
From: pbk@cphzt.sasintern.com (Poul Kornmod)
Subject: Perl and C-ISAM file. Re. DBI Module
Message-Id: <33aaf364.2437702@news.dknet.dk>

Dear All,

Has anyone of you tried connection to C-ISAM files, using the DBI
Module? I could use some examples, because I have an Informix SE70
where I would like to make queries from Perl.

Thank in advance

Poul

---------------------------------------------------------------------------------------------------------------------
Poul Kornmod				Radisson SAS Hotels Worldwide
Systems Analyst				IT-Department (CPHZT)
pbk@cphzt.rdsas.com			70 Amager Boulevard
Telephone: +45 3341 1022		DK-2300 Copenhagen S. 	
Telefax:      +45 3341 1010		Denmark
www.rdsas.com


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

Date: Fri, 20 Jun 1997 19:30:35 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: print statement question
Message-Id: <bb7fo5.oae.ln@localhost>

Gary Ebert (garye@iname.com) wrote:

: Also I know that this is poor practice but I _REALLY_ do not have time
: to keep up with this news group.  Could you kindly cc: any responses to
: my e-mail.  THANKS a lot!!!!! 


Just use a newsreader to read news with.

Mark your subject as highlighted, delete all other messages.

Viola, you can get your answer without reading (or even knowing
of the existence of) the other posts...

The right tool for the job has a large impact on how hard the job is...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 20 Jun 1997 21:40:38 -0400
From: Louis Krupp <lkrupp@netONE.com>
Subject: Re: Python as an intermediate lang for compiler/interpreter development ?
Message-Id: <97-06-080@comp.compilers>
Keywords: translator

Harris Gilliam wrote:
> A while back I asked this question... got no replies or followup
> posts.  If this is some sort of "sin" in the Python community please
> tell me :-) Anyway... I was interested in seeing if Python would make
> a good intermediate language for developing an interpreter/compiler
> for a language that closely resembles C and C++.  If anyone has done
> this or something similar I'd be interested in your experiences.
> Thanks.

Something vaguely similar:

I wanted to translate a subset of Microsoft Visual Test (the parts
that correspond more or less to BASIC) to C++.  I used yacc to parse a
Visual Test program and generate a Perl script which, when executed,
generates a C++ program.  The yacc part is relatively simple; Perl
handles symbol tables and so on.  It's slow, but it works.  And it was
fun to do.

I've redirected this away from comp.lang.python and towards
comp.lang.perl.misc, because I used Perl (5.003) and not Python.

However, just for the record, I don't know much about Python, and I
have no argument with anyone who assert that Python would have worked
just as well.

Louis Krupp
lkrupp@netONE.com


--
Send compilers articles to compilers@iecc.com,
meta-mail to compilers-request@iecc.com.


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

Date: Fri, 20 Jun 1997 21:54:06 GMT
From: Tim Pierce <twpierce+usenet@mail.bsd.uchicago.edu>
Subject: Re: reading end-of-line in a string
Message-Id: <EC3Gu6.5su@midway.uchicago.edu>

In article <866839480.16356@dejanews.com>,
Maelstrom  <maelstrom@deathsdoor.com> wrote:

>I just looked at the source and the phase wrap=hard is used in the
>Textarea declaration if anyone knows what that means?

Documentation is wonderful for this sort of thing.  See
http://developer.netscape.com/library/index.html.

-- 
Support the Marriage Project--Hawaii: call 1-900-97-MARRY ($5/call).
See <URL:http://www.ftm.org/> for more information.


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

Date: Fri, 20 Jun 1997 16:04:22 -0600
From: Maelstrom <maelstrom@deathsdoor.com>
Subject: Re: reading end-of-line in a string
Message-Id: <866839480.16356@dejanews.com>

In article <33AA23A3.2300@woais.com>,
  wesley@woais.com wrote:

> <TEXTAREA> boxes on a web page return a single long string. There are no
> end-of-line characters passed to the CGI. Instead, you will need to edit
> the script so that it counts of say, 40 characters, and inserts a
> newline character there.


Are you sure? I'm using a textarea to post this from Deja news and they
seem to be able to preserve Enter characters.

   See?

I just looked at the source and the phase wrap=hard is used in the
Textarea declaration if anyone knows what that means?

--Maelstrom

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 20 Jun 1997 22:23:09 -0500
From: Wesley Miaw <wesley@woais.com>
Subject: Re: reading end-of-line in a string
Message-Id: <33AB491D.369D@woais.com>

Maelstrom wrote:
> 
> In article <33AA23A3.2300@woais.com>,
>   wesley@woais.com wrote:
> 
> > <TEXTAREA> boxes on a web page return a single long string. There are no
> > end-of-line characters passed to the CGI. Instead, you will need to edit
> > the script so that it counts of say, 40 characters, and inserts a
> > newline character there.
> 
> Are you sure? I'm using a textarea to post this from Deja news and they
> seem to be able to preserve Enter characters.
> 
>    See?
> 
> I just looked at the source and the phase wrap=hard is used in the
> Textarea declaration if anyone knows what that means?

You are correct. Sorry. WRAP="hard" will return the \n characters.
WRAP="virtual" will not.
-- 
Wesley Miaw                               wesley@woais.com
World of Artists Internet Services        http://www.woais.com/
71 Middlesex Drive                        Tel: 518-439-0412
Slingerlands, NY 12159                    FAX: 518-439-9722


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

Date: Fri, 20 Jun 1997 14:56:54 +0000
From: Kendall Comey <comeyk@sisna.com>
Subject: Regular expression matching \s question
Message-Id: <33AA9A36.28A2@sisna.com>

Hello,

I am trying to match a string composed of a starting point any number of
characters including newline or other whitespace characters and an
ending point.

This is what I've tried without success:
s/<start_match>.*<end_match>/<start_match>$input{'new_string'}<end_match>/s;

s/<start_match>(.|\s)*<end_match>/<start_match>$input{'new_string'}<end_match>/;

s/<start_match>[\w\s]*<end_match>/<start_match>$input{'new_string'}<end_match>/;

I've worked around it by using $input{'new_string'} =~ s/\s+/ /g; so
that later when I match the string there is no whitespace to worry
about, but I know there's a better and more correct way to do this.

I appreciate any help. 

Also, does anyone know of a perl guru in the Jackson Hole, WY area?
Would love yo have someone to talk to.

Thanks.
-- 
Kendall Comey
comeyk@sisna.com


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

Date: Fri, 20 Jun 1997 18:31:11 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regular expression matching \s question
Message-Id: <vr3fo5.l3e.ln@localhost>

Kendall Comey (comeyk@sisna.com) wrote:

: I am trying to match a string composed of a starting point any number of
: characters including newline or other whitespace characters and an
: ending point.

: This is what I've tried without success:
                          ^^^^^^^^^^^^^^^

What does that mean?

Where is a small sample program that illustrates your problem?


: s/<start_match>.*<end_match>/<start_match>$input{'new_string'}<end_match>/s;

: s/<start_match>(.|\s)*<end_match>/<start_match>$input{'new_string'}<end_match>/;

: s/<start_match>[\w\s]*<end_match>/<start_match>$input{'new_string'}<end_match>/;

: I've worked around it by using $input{'new_string'} =~ s/\s+/ /g; so

Changing the replacement string will have no effect on being able
to match.

I don't think I'm following you here...


: that later when I match the string there is no whitespace to worry
: about, but I know there's a better and more correct way to do this.

: I appreciate any help. 


Your first one seems to work OK when I go to the trouble of writing
a small sample program, attempting to find your (or any) problem:

----------------------
#! /usr/bin/perl -w

$input{new_string} = 'my new string';

$_ =<<ENDTEXT;
<start_match> some
other
stuff     goes here             two tabs 
too <end_match> outside of match
ENDTEXT


s/<start_match>.*<end_match>/<start_match>$input{'new_string'}<end_match>/s;
print;
----------------------


You are sure that you actually have a multiline string in $_, right?


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Fri, 20 Jun 1997 16:54:45 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: "Joshua J. Kugler" <FIGHT-SPAMjkugler@inreach.com>
Subject: Re: Testing for the non-existence of a variable.
Message-Id: <Pine.SGI.3.96.970620165400.29411B-100000@davinci.bergen.org>

unless....
unless($var){
	#la de da
}

or..
if (!$var){
	#la de da
}
should work...

----------------
| "A bird in the hand leaves a nasty stain."
| 	- Me
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com
Got a JavaScript/CGI/Perl question or problem?  Let me know!
webXS - the new eZine for WebProgrammers! webXS@juno.com
Visit us @ http://www.bergen.org/~jefpin/webXS



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

Date: Fri, 20 Jun 1997 19:25:14 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: uc function for PERL4
Message-Id: <a17fo5.oae.ln@localhost>

Bruno Pagis (pagib@aur.alcatel.com) wrote:
: I've written a uc (capitalize) function for PERL4.
: There is more than one way to do it. Anybody wloud have a better idea ? 
: sub uc
: {
:   @t = unpack('C*', $_[0]);
:   $j=0;
:   foreach $i (@t)
:   {
:     if ($i>=97 && $i<=122)
:       { $t[$j] = $i -32; }
:     $j++;
:   }
:   return pack('C*', @t);
: }


tr/a-z/A-Z/; # ignores locale though...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Fri, 20 Jun 1997 18:39:48 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Why is system() failing when used as CGI?
Message-Id: <4c4fo5.g4e.ln@localhost>

Wade Williams (wwilliam@cisco.com) wrote:


: I've got a program that does the following:

: $majordomo="/usr/local/mail/majordomo";

: chdir("$majordomo");
: system("make");

: (I've also tried it without quotes)

: If I run this program from the command line, it works like a charm.  But if
: I run it as a cgi script, it appears the make does not happen.  


So check the return values...


: Anyone have any thoughts?  The system is Solaris 2.5.1.

I'd guess you either have a permission problem, or a "command not found"
problem when run as the user that the server runs CGI scripts under.



chdir($majordomo) || die "could not chdir()  $!";
system("make")    && die "error from system() call  $!";

or maybe:

system("/usr/bin/make")    && die "error from system() call  $!";


Then go have a look in your server error log.



--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 642
*************************************

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