[7626] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1252 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 30 23:07:28 1997

Date: Thu, 30 Oct 97 20:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 30 Oct 1997     Volume: 8 Number: 1252

Today's topics:
     Re: "die" function won't print in CGI!?!! <rootbeer@teleport.com>
     Re: "die" function won't print in CGI!?!! (brian d foy)
     +>> should work, why doesn't it. :-( <raven@lp-llc.com>
     Re: +>> should work, why doesn't it. :-( (Martien Verbruggen)
     [repost] File handle attached to a function? (Lloyd Zusman)
     Re: A new type of Perl math? (Martien Verbruggen)
     Advice on extracting chunks of HTML documents <gnielson@charlotte.infi.net>
     Re: Copying to the clip board <rootbeer@teleport.com>
     Re: File Locking <rootbeer@teleport.com>
     Re: if (0<= $hun < 250) doesn't compile (Damian Conway)
     Re: if (0<= $hun < 250) doesn't compile <youngej@magpage.com>
     Re: Keep track of downloads - redirection <ratbert@earthlink.net>
     Re: Launching Perl (Mike King)
     Re: Newbie Q: read and append file question <justin@nectar.com.au>
     Re: Newbie question; how to redirect (Wesley)
     newbie with a perl question <ryoung@asucla.ucla.edu>
     Re: Perl "Here" document and formatting tabs <rootbeer@teleport.com>
     Re: Perl module for system-independent "stty raw"? (dave)
     Possible bug in LWP::Socket? (Paul Phillips)
     Re: s/$x/$y/eg; problem (Charles DeRykus)
     Re: Scalars containing back references and regular expr (Jason Gloudon)
     Re: server side includes (Iain Chalmers)
     Stating File Systems in Perl (IGuthrie)
     Re: Strings, parameters & Makefiles <rootbeer@teleport.com>
     Re: Telling Whether a Wildcarded Regular Expression Wil <justin@nectar.com.au>
     Re: Year2000 problem with localtime(); (John Moreno)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Oct 1997 15:13:57 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mani Prasad Kancherla <mani@geoplex.com>
Subject: Re: "die" function won't print in CGI!?!!
Message-Id: <Pine.GSO.3.96.971030151244.5814K-100000@usertest.teleport.com>

On Thu, 30 Oct 1997, Mani Prasad Kancherla wrote:

> Subject: "die" function won't print in CGI!?!!

> Is there something wrong with what I'm doing?

Yes; you're not following the CGI specification. And, remember about
buffering issues.) If you have questions about the CGI spec that aren't
answered in the spec itself, check with a newsgroup about CGI. Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 30 Oct 1997 23:00:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: "die" function won't print in CGI!?!!
Message-Id: <comdog-ya02408000R3010972300530001@news.panix.com>

In article <3458FFC6.81A77413@geoplex.com>, Mani Prasad Kancherla <mani@geoplex.com> wrote:

>    Please take a look at the following code:


>die $err_str unless (param("form") eq "trouble_report");

>When the value of "form" is "trouble_report" everything is fine.

use DejaNews [1] to read the recent thread "Die and the Web" in this
newsgroup - you'll find many techniques for this sort of thing.

good luck :)

[1] DejaNews
<URL:http://www.dejanews.com/>

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 30 Oct 1997 15:22:19 -0800
From: Matt McLaughlin <raven@lp-llc.com>
Subject: +>> should work, why doesn't it. :-(
Message-Id: <345916AB.32063B01@lp-llc.com>

Trying to access a list and append (add to) it.

When I access it from my SHELL, it works great.

When I access it from the web "can't open list to append Permission
denied"

Isn't "+>>" supposed to give anyone permission? or am I just reading the
blue camel wrong

Here's how the code looks:

open (LIST, "+>>$LIST")|| print "Content-type: text\/html\n\n can't open
list to append $!";

      print LIST "$you";

close(LIST);




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

Date: 31 Oct 1997 01:43:50 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: +>> should work, why doesn't it. :-(
Message-Id: <63bd4m$rpv$2@comdyn.comdyn.com.au>

In article <345916AB.32063B01@lp-llc.com>,
	Matt McLaughlin <raven@lp-llc.com> writes:

> Isn't "+>>" supposed to give anyone permission?

Now, that would be a handy thing for crackers, wouldn't it? Perl has
to deal with the same limitations on access permissions as the rest of
the programs/shells/scripts on the machine. If you don't have write
permissions to the file or directry, you simply cannot write to it.

perldoc -f open

If the filename begins with '<' or nothing, the file is opened for
input.  If the filename begins with '>', the file is truncated and
opened for output.  If the filename begins with '>>', the file is
opened for appending.  You can put a '+' in front of the '>' or '<' to
indicate that you want both read and write access to the file;

What I see here is that '+>>' would mean 'open the file for appending,
with both read and write access'. It says nothing about permissions.

There is actually something about this in the faq's (gosh, an faq?):

perldoc perlfaq9

My CGI script runs from the command line but not the
browser.  Can you help me fix it?

I suggest you read it, and the references there as well.

> or am I just reading the blue camel wrong

Probably you are misunderstanding that 'open for read and write
access' means something else than 'give me the permissions to read and
write the file'.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | You can't have everything, where would
Commercial Dynamics Pty. Ltd.       | you put it?
NSW, Australia                      | 


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

Date: 31 Oct 1997 02:19:15 GMT
From: ljz@asfast.com (Lloyd Zusman)
Subject: [repost] File handle attached to a function?
Message-Id: <slrn65ifu3.et.ljz@ljz.asfast.net>

[Note: This is a repost of an article I attempted to post a few days
       ago.  Apparently the posting failed, as I have no record of it.
       This is a paraphrase of what I originally wrote. ]

Given some of the newer file-handle functionality in Perl, is it
possible to somehow attach a file handle to a function, as follows? ...

   sub myfunc {
      my $line = shift;
      # do something or other to '$line'
   }
   
   ###  ???  somehow attach file handle 'F' to 'myfunc'  ???

   print F "abc\n";
   print F "def\n";

This would cause 'myfunc' to be called once with "abc\n" as its
argument, and again with "def\n" as its argument.

I know that I can use a pipe and a forked process to give me something
similar to this, but I'm looking for a way to do this without a new
process, and without such things as temporary files, etc.

Any ideas?

Thanks in advance.


-- 
 Lloyd Zusman
 ljz@asfast.com


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

Date: 31 Oct 1997 01:30:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: A new type of Perl math?
Message-Id: <63bcbk$rpv$1@comdyn.comdyn.com.au>

In article <3458228D.63B9B7DF@pangea.ca>,
	Bernard Lechler <blechler@pangea.ca> writes:

> if ($in{$keyA} gt $in{$keyB}) {

perldoc perlop
/gt
/

Binary "gt" returns true if the left argument is stringwise
greater than the right argument.                 ^^^^^^^^^^

Maybe you want 

if ($in{$keyA} > $in{$keyB}) {

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.       | you come to the end; then stop.
NSW, Australia                      | 


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

Date: Thu, 30 Oct 1997 19:36:46 -0500
From: "Gary Nielson" <gnielson@charlotte.infi.net>
Subject: Advice on extracting chunks of HTML documents
Message-Id: <63b937$c4a$1@nw003.infi.net>

Hi,

I need to be able to grab a chunk of an HTML document daily and
use that piece in another HTML doc. The beginnings and endings
remain the same every day. I am a perl novice and am looking for
advice on how to get perl to open a file, go to the start of a block of text
and then grab all the text up to another point in the document.
Are there any scripts out there that can do this, or that I can learn from?

Any help much appreciated. If you could email a reply as well,
that would be great.

Gary







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

Date: Thu, 30 Oct 1997 15:25:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Lachlan Dunlop <lach@lach.net>
Subject: Re: Copying to the clip board
Message-Id: <Pine.GSO.3.96.971030152300.5814N-100000@usertest.teleport.com>

On Thu, 30 Oct 1997, Lachlan Dunlop wrote:

> I am using perl & CGI.  My goal is to have a link on a form, so that
> when you "click" the link.  It first copies the link text, or value into
> the clipboard, then goes to the desired link, where it can be pasted in.

If this can be done at all, it would be something done on the user's
computer - not on the server which can run your CGI scripts. Instead, it
would almost certainly be a feature of their browser (which, of course,
may not have any way to "click" anything, or any clipboard, as those
are not features required of web browsers). If you can't find the info you
need in the docs for the browsers, check with a newsgroup about browsers.
Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Thu, 30 Oct 1997 15:17:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Vik Rubenfeld <VikR@aol.com>
Subject: Re: File Locking
Message-Id: <Pine.GSO.3.96.971030151657.5814M-100000@usertest.teleport.com>

On Thu, 30 Oct 1997, Vik Rubenfeld wrote:

[after being blocked while waiting for the flock to complete]
> ... will I be correctly appending to the end of the file?

Probably not; use seek(). Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 31 Oct 1997 00:24:14 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <63b8fe$i25$1@towncrier.cc.monash.edu.au>

Mark Rafn <dagon@halcyon.com> writes:

	[Correct diagnosis snipped]

> Actually, I don't know of _any_ programming language that handles trinary
> comparison like this.

Just FYI, both "Icon" and "GRAIL" correctly handle multiple comparisons.

("GRAIL" is an introductory teaching language designed here at Monash.
 It handles multiple comparisons because novices _expect_ those semantics,
 and there's no compelling reason for a modern programming language
 _not_ to support them).

damian
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  who: Damian Conway                 email: damian@cs.monash.edu.au
where: Computer Science Dept.          web: http://www.cs.monash.edu.au/~damian
       Monash University             quote: "The best form of self-defence is
       Clayton 3168, Australia               not being there in the first place"


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

Date: 31 Oct 1997 03:00:54 GMT
From: Ed Young <youngej@magpage.com>
Subject: Re: if (0<= $hun < 250) doesn't compile
Message-Id: <63bhl6$igo$0@204.179.92.85>

How about:
  if ($hun < 0) { die "negative number\n" }
  elsif ($hun < 250) { $division = $thou."000"; }
  elsif ($hun < 500) { $division = $thou."250"; }
  elsif ($hun < 750) { $division = $thou."500"; }
  else               { $division = $thou."750"; }

l. trindle gennari wrote:
> 
> Hi gang-
> 
> I have a section of a script that's giving me the blues. Here 'tis:
> 
> if (0 <= $hun < 250) {
>     $division = $thou."000";
>     }
> elsif (250 <= $hun < 500) {
>         $division = $thou."250";
>     }
> elsif (500 <= $hun < 750) {
>     $division = $thou."500";
> }
> else {
>     $hun = $thou."750";
> }
> 
> It doesn't seem to like my <=. Any clue why this doesn't work?


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

Date: Thu, 30 Oct 1997 20:01:26 -0500
From: "~The Rat" <ratbert@earthlink.net>
Subject: Re: Keep track of downloads - redirection
Message-Id: <63balj$ct7@argentina.earthlink.net>

I formal protocol is defined as:

ftp://username:password@hostname:port/pathtoresource   (with the default ftp
port being 21)

~theRat

Miran Sepic wrote in message <01bce517$928353e0$7a02a8c0@pc_miran>...
>On web page I have to show the list of files for download. After selecting
>the file (click on the link or something) I have to write in a txt file the
>username and a selected product. Files are on PASSWORD protected Ftp site.
>
>I tried to do the following:
>replace the direct link to the file with a link to a Perl script that
>writes down the data in txt file, and redirects to the location of the
>file:
>
>print "Location: ftp://name.name/namefile.ext\n\n";
>
>It works when I turn off the password protection on FTP site (NT IIS
>Server). But If i put the protection i got the Anonymous Access Denied
>response.
>
>How can I send the username/password information within the script
>(Location request), or all of it can be done in some other way.
>
>
>Thanks, Miran



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

Date: Fri, 31 Oct 1997 03:02:54 GMT
From: m.king.garbage@praxa.garbage.com.au (Mike King)
Subject: Re: Launching Perl
Message-Id: <34594997.360759414@news.ozemail.com.au>

On Tue, 28 Oct 1997 10:55:02 -0700, Robert Collins
<figuro@sprintmail.com> wrote:

>Hi there: Now that I installed and tested perl on this
>Linux machine how do I get output or launch it ??
>Or, where do I get the instructions ?? Thanks

The perl GUI is very simple to understand: it doesn't have one !

perl does not 'run', as it is like csh, bash or ksh - it is a command
interpreter. Normally it resides in /usr/local/bin/perl

any text file which is executable and contains this as the first line 

#!/usr/local/bin/perl

will cause the perl interpreter to be invoked to run the program.

SO just typing 

MyPerlScript.pl

is all you need to do

 Alternatively you could have typed

perl MyPerlScript.pl

Have fun

Mike


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

Date: Fri, 31 Oct 1997 13:26:27 +1100
From: Justin Wills <justin@nectar.com.au>
Subject: Re: Newbie Q: read and append file question
Message-Id: <345941D2.3B429568@nectar.com.au>


--------------7966FE538891E1DF08F8938D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Tad McClellan wrote:

> : Thank you for your time. I have a sense this is a simple one...
>
> Nearly all "simple ones" can be answered in less that 120 seconds.
>
> No need to post questions like that...
>
> Use the docs that COME WITH the perl distribution.
>
> That is why they are included in the distribution.
>
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@flash.net                        Perl programming
>     Fort Worth, Texas


or buy the O'reilly book.  Nearly all questions can be answered out of it
too.



--
Regards,

Justin Wills
justin@nectar.com.au



--------------7966FE538891E1DF08F8938D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Tad McClellan wrote:
<BLOCKQUOTE TYPE=CITE>: Thank you for your time. I have a sense this is
a simple one...

<P>Nearly all "simple ones" can be answered in less that 120 seconds.

<P>No need to post questions like that...

<P>Use the docs that COME WITH the perl distribution.

<P>That is why they are included in the distribution.

<P>--
<BR>&nbsp;&nbsp;&nbsp; Tad McClellan&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
SGML Consulting
<BR>&nbsp;&nbsp;&nbsp; tadmc@flash.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Perl programming
<BR>&nbsp;&nbsp;&nbsp; Fort Worth, Texas</BLOCKQUOTE>
&nbsp;
<BR>or buy the O'reilly book.&nbsp; Nearly all questions can be answered
out of it too.
<BR>&nbsp;
<BR>&nbsp;
<PRE>--&nbsp;
Regards,

Justin Wills
justin@nectar.com.au</PRE>
&nbsp;</HTML>

--------------7966FE538891E1DF08F8938D--



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

Date: 30 Oct 1997 21:58:17 GMT
From: wkc@amanda.dorsai.org (Wesley)
Subject: Re: Newbie question; how to redirect
Message-Id: <63avtp$1fu@snews1.zippo.com>

I guess this is not what the original question was but anyone knows how to
do a redirect within a perl script?

Say, someone call my perl script from a form.  I'm done processing it.
Now I want to "POST" the result to another web-page.  Any idea?

Pls email me at wkc@cetus.net

Thanx

Wesley


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

Date: Thu, 30 Oct 1997 18:21:42 -0800
From: ryoung <ryoung@asucla.ucla.edu>
Subject: newbie with a perl question
Message-Id: <345940B5.3583CAEE@asucla.ucla.edu>

Hello,

I am new to the vast world of perl and hope someone can assist me with
some code for a script i am trying to modify.    I am really new so can
someone help me?  Here is some of the code i'm working with:(I basically
need to locate spaces within the 'comments' string and replacing them
with "%20" so that i can pass the string in a url without having it chop
off where a space occurs.) Thanks!!

   if ($CONFIG{'redirect'} =~ /http\:\/\/.*\..*/) {

      # If the redirect option of the form contains a valid url,
      # print the redirectional location header.

      $redirect_to = "Location: " . $CONFIG{'redirect'} . "&comments=".
$FORM{'comments'};

 print "$redirect_to\n\n";

   }




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

Date: Thu, 30 Oct 1997 15:16:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil R Lawrence <prl2@lehigh.edu>
Subject: Re: Perl "Here" document and formatting tabs
Message-Id: <Pine.GSO.3.96.971030151422.5814L-100000@usertest.teleport.com>

On 30 Oct 1997, Phil R Lawrence wrote:

> 	system <<"!";
> 		sqlplus $uname/$upass
> 		blah;
> 		blah;
> 		exit
> 	!
> 
> Of course Perl chokes on the tab in front of the terminating string at
> the end of the "Here" document and doesn't know where to end it. 

So, you could either put the tab into your terminating string from the
beginning, or you could use another means of quoting. I'd use qq{},
perhaps. Good luck with it!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 31 Oct 1997 00:53:09 GMT
From: over@the.net (dave)
Subject: Re: Perl module for system-independent "stty raw"?
Message-Id: <34592b4c.194159@news.one.net>

keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis) wrote:

>On Sun, 26 Oct 1997 14:02:43 GMT, over@the.net (dave) wrote:
>
>>ljz@asfast.com (Lloyd Zusman) wrote:
>>
>>
>>>I don't need all the esoteric stty commands.  If I could have
>>>system-independent, Perl versions of the "raw", "echo", "-echo", and
>>>"sane" stty functions, I'd be happy.
>>
>>My curses libarary for HPUX provides a raw mode.  There is a curses module for
>>Perl but I'm not sure whether it supports raw mode and if it does on which
>>platforms.  I'm having trouble with the C curses library on HPUX 10.
>
>I also had hassle building the Curses module under HP-UX 10.20.  The
>demos in particular insisted on core-dumping.  I came to the
>conclusion that the curses library under HP-UX is 'non-standard' (is
>that another way of saying 'broken'?).
>

When I said Curses library, I meant the library for C, not the Perl module, so
your assumption is probably correct.  After several patches to HP-UX 10.20,
curses programs compiled under 10.20 still don't work correctly.  Though curses
programs compiled under 9.X will RUN correctly under 10.20.

Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________


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

Date: 31 Oct 1997 03:25:05 GMT
From: paulp@go2net.com (Paul Phillips)
Subject: Possible bug in LWP::Socket?
Message-Id: <63bj2h$3gn$1@sparky.wolfe.net>

[Appreciate replies copied to email; flaky news server.]

This seems to be a bug, but maybe I'm misunderstanding something.
On my Solaris 2.5.1 and 2.6 systems, when I attempt to connect to a
machine name with multiple A records on a port where nothing is running,
LWP::Socket takes a dinger with a SIGPIPE and dies, presumably from
the multiple RST packets I'm seeing on the wire, as its trying all
the IP addreses in sequence.

-- begin demonstration code --

#!/usr/local/bin/perl -w
#
 
use LWP::Socket;
 
my $socket = new LWP::Socket;
$socket->connect("www.stocksite.com", 81);

-- end demonstration code --

Ignoring SIGPIPE does seem sufficient, but I'm wondering whether:

 -- this "iteration" behavior over multiple IPs is standard
    across other OSes (I don't have access to much else at the moment,
    but this does not mesh with my recollection of connect() semantics)
 -- this is a bug in LWP, Solaris, somewhere else, or nowhere

Thanks,

-- 
Paul Phillips      | A good messenger expects to get shot.
Kibologist         |    -- Larry Wall
<paulp@go2net.com> | 
+1 206 447 1595    |--------* http://www.go2net.com/people/paulp/ *--------


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

Date: Fri, 31 Oct 1997 01:33:26 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: s/$x/$y/eg; problem
Message-Id: <EIw6zq.JJp@bcstec.ca.boeing.com>

In article <3459074B.1B4EF37@fzi.de>, Dirk Hoffmann  <dhoffman@fzi.de> wrote:
>
 > what I do:
 >    prompt{user}: myperlscript '^sub (.*) \{' 'SUBROUTINE $1 ['
 > what I get:
 >    SUBROUTINE $1 [
 > what I wanna get:
 >    SUBROUTINE testname [
 > 
 > my perl script:
 > #!/tools/local/bin/perl
 > 
 > $x = $ARGV[0];
 > $y = $ARGV[1];
 > $z = "sub testname {";
 > 
 > $z =~ s/$x/$y/eg;
 > 
 > print "$z\n";
 > 
 > anyone can help me ?
 > In my case $x and $y MUST be command arguments !!!
 > 

   eval "\$z =~ s/$x/$y/";
   die $@ if $@;


HTH,
--
Charles DeRykus


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

Date: 31 Oct 1997 01:33:15 GMT
From: jgloudon@bbn.remove.com (Jason Gloudon)
Subject: Re: Scalars containing back references and regular expressions
Message-Id: <63bcgr$h6n$1@daily.bbnplanet.com>

Bob Hannaford (bobh@metrica.co.uk) wrote:

: The object of the exercise is to change the character after each
: occurenceof 'BOB' in the scalar text2 to something else.

: # Example 1
: $text2 = 'BOB VHHH   BOB CCCC';
: $var1 = 'BOB ([CV])';
: $var2 = 'BOB_${1}';
: $text2 =~ s/$var1/$var2/eeg;
: print 'after text4 '.$text2."\n";

$var is first evaluated to BOB_${1}, but the 'bareword' BOB_ looks like a 
subroutine call to perl, since there are no quotes around it, so this fails.
"BOB_${1}" is what you want perl to evaluate :
Using  $var2 = '"BOB_${1}"' or the less confusing 'qq(BOB_${1})' would work 
as in

 $var2 = 'qq(BOB_${1})'; # or $var2 = '"BOB_${1})"'
 $text2 =~ s/$var1/$var2/eeg;
 print 'after text4 '.$text2."\n";

Hopefully you should be able to parse the other failed examples now.

: # Example 4
: $text2 = 'BOB VHHH   BOB CCCC';
: $var1 = 'BOB ([CV])';
: $var2 = 'BOB_.${1}';

This works because Perl is interpreting BOB_ as a bareword (no quotes) string 
because of the '.' operator. If you had done 'use strict;' in this script, 
this would have failed to work as well, as this disallows bareword strings.

: $text2 =~ s/$var1/$var2/eeg;
: print 'after text4 '.$text2."\n";

Jason Gloudon


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

Date: Fri, 31 Oct 1997 14:34:02 +1100
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: server side includes
Message-Id: <bigiain-ya02408000R3110971434020001@news.ozemail.com.au>

In article <344B75AA.194C0931@mall.it>, daniele scarpa <scarpa@mall.it> wrote:

> I must pass a parameter to script perl. This script is executed by a
> server side includes istruction:
> <!--#exec cmd="/prova.cgi"-->
> How do I do it?
> Thanks!

hi there,

i use:

<!--#exec cmd="script.pl arg1 arg2 arg3"-->

works fine on both apache/bsd and webstar/macos

cheers

iain

Iain Chalmers
bigiain@mightymedia.com.au


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

Date: 31 Oct 1997 03:10:53 GMT
From: iguthrie@aol.com (IGuthrie)
Subject: Stating File Systems in Perl
Message-Id: <19971031031000.WAA24881@ladder01.news.aol.com>

Is there any way to stat a filesystem in perl? The only way that I have found
 is to embed C in Perl using statfs() or statvfs() or to kick off a shell
 process and use df. I am looking for info like blocks used and inodes free,
 etc. Is there any effcient way to do this in Perl without embedding C?

Thanks



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

Date: Thu, 30 Oct 1997 15:09:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: paul@pkamf.demon.co.uk
Subject: Re: Strings, parameters & Makefiles
Message-Id: <Pine.GSO.3.96.971030150300.5814J-100000@usertest.teleport.com>

On Fri, 31 Oct 1997 paul@pkamf.demon.co.uk wrote:

> What string can I include which when itis array processed and therefore
> passed through the filtering algorithm will get amatch against any other
> possible string each time?

Nobody can say without knowing what your filtering algorithm does. Does it
use regular expressions, substring matching, or something else? Is there a
particular input that will cause it to match anything?

> 2)I want to run the script under UNIX from a Makefile.  I want to put
> parameters in the Makefile that get picked up by the PERL file upon
> execution:
> i.e.
> 
> PARAM1 = NOV
> PARAM2 = MON
> 
> ./myPERLprog using PARAM1 and PARAM2
> 
> ie in the PERL script I want:
> 
> $INTERNALVAR1 = $PARAM1;
> $INTERNALVAR2 = $PARAM2;

If those values are made available by make, your documentation for make
should tell you about where to find them. If not, your documentation for
make should tell you about how to pass them on to other programs. If you
can't find what you want in the docs for make, try asking in a newsgroup
about unix.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 31 Oct 1997 13:21:56 +1100
From: Justin Wills <justin@nectar.com.au>
Subject: Re: Telling Whether a Wildcarded Regular Expression Will Match Any Files
Message-Id: <345940C3.D62CC966@nectar.com.au>


--------------418C37E88DF65EC7CEDE7E85
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Kevin M Simonson wrote:


why don't you just glob the directory ???? ie:

@files=<.*rc>;     # or <$pat>

or see the opendir/readdir functions.




>      I have just written a "perl" script that does a bunch of processing on
> a bunch of files that are determined by an argument passed in on the com-
> mand line.  In order to process all the files I need to process, I do an
> "ls" on a pathname that has a few rigidly defined parts, includes the argu-
> ment passed in, and also includes Unix wildcards.  I take the output of the
> "ls" command into a "foreach" loop, executing the loop once for each file
> that matches the wildcarded expression.
>
>      It has just dawned on me that if the user enters an erroneous argu-
> ment, the "ls" command executed on the mixture of regular characters and
> wildcards might not find a match.
>
>      The default Unix complaint when this happens isn't bad, but I think it
> would be better if, instead of having Unix complain, my "perl" script could
> recognize ahead of time that there is no match for the wildcarded expres-
> sion, and make a statement to that extent without ever executing the "ls"
> command.
>
>      Does anybody know a way to do that?  Any information would be appreci-
> ated.
>
>                                      ---Kevin Simonson
>  -------------------------------------------------------------------------
>      Reverence                   To send me mail, remove "_nospam" and
>      the eternal.                all the vowels from my login name.



--
Regards,

Justin Wills
justin@nectar.com.au



--------------418C37E88DF65EC7CEDE7E85
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Kevin M Simonson wrote:
<BR>&nbsp;

<P>why don't you just glob the directory ???? ie:

<P>@files=&lt;.*rc>;&nbsp;&nbsp;&nbsp;&nbsp; # or &lt;$pat>

<P>or see the opendir/readdir functions.
<BR>&nbsp;
<BR>&nbsp;
<BR>&nbsp;
<BLOCKQUOTE TYPE=CITE>&nbsp;&nbsp;&nbsp;&nbsp; I have just written a "perl"
script that does a bunch of processing on
<BR>a bunch of files that are determined by an argument passed in on the
com-
<BR>mand line.&nbsp; In order to process all the files I need to process,
I do an
<BR>"ls" on a pathname that has a few rigidly defined parts, includes the
argu-
<BR>ment passed in, and also includes Unix wildcards.&nbsp; I take the
output of the
<BR>"ls" command into a "foreach" loop, executing the loop once for each
file
<BR>that matches the wildcarded expression.

<P>&nbsp;&nbsp;&nbsp;&nbsp; It has just dawned on me that if the user enters
an erroneous argu-
<BR>ment, the "ls" command executed on the mixture of regular characters
and
<BR>wildcards might not find a match.

<P>&nbsp;&nbsp;&nbsp;&nbsp; The default Unix complaint when this happens
isn't bad, but I think it
<BR>would be better if, instead of having Unix complain, my "perl" script
could
<BR>recognize ahead of time that there is no match for the wildcarded expres-
<BR>sion, and make a statement to that extent without ever executing the
"ls"
<BR>command.

<P>&nbsp;&nbsp;&nbsp;&nbsp; Does anybody know a way to do that?&nbsp; Any
information would be appreci-
<BR>ated.

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
---Kevin Simonson
<BR>&nbsp;-------------------------------------------------------------------------
<BR>&nbsp;&nbsp;&nbsp;&nbsp; Reverence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
To send me mail, remove "_nospam" and
<BR>&nbsp;&nbsp;&nbsp;&nbsp; the eternal.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
all the vowels from my login name.</BLOCKQUOTE>
&nbsp;
<PRE>--&nbsp;
Regards,

Justin Wills
justin@nectar.com.au</PRE>
&nbsp;</HTML>

--------------418C37E88DF65EC7CEDE7E85--



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

Date: Thu, 30 Oct 1997 22:13:08 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Year2000 problem with localtime();
Message-Id: <1997103020443646020330N@roxboro-170.interpath.net>

Abigail <abigail@fnx.com> wrote:

] Russ Allbery (rra@stanford.edu) wrote on 1519 September 1993 in
] <URL: news:m3n2jttr6b.fsf@windlord.Stanford.EDU>:
] ++ Henry Hartley <HARTLEH1@westatNOSPAM.com> writes:
] ++ 
] ++ > True.  My understanding, however, is that the range for dates in
] ++ > perl is 2038.  Is that not true?
] ++ 
] ++ This is not a problem with Perl, it's a problem with the underlying
] ++ C library.  On systems where the C library uses a 64 bit time_t,
] ++ this isn't a problem, so assuming that all systems will be 64 bit
] ++ by 2038, there won't be a problem.
] 
] Uhm, if I have my application read and write dates, using sizeof
] (time_t) space, I get a problem when sizeof (time_t) isn't constant
] over time.
] 
] One of the subproblems of Y2K is that going from 2 to more bytes to
] store the year gives problems when reading old data, or writing new
] data. 

Actually this isn't a problem at all - the problem is old programs
reading the unchanged file.  Just consider the 2 bytes date as a value
from between 0 and 65535 - with certain values meaning something else -
not even a problem for the first several THOUSAND years.

] That same problem will hit machines when their time_t type goes
] from 32 to 64 bits.

If you're keeping just the year then using a 2 (or even 1) byte date is
better.  In fact, as long as you don't need to keep the date down to the
hour and you don't mind keeping the year within a 256 year range 2 bytes
are all you need.  You have to do some interpretation but it covers all
the bases.

-- 
John Moreno


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

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

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