[7704] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1330 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 17 14:17:35 1997

Date: Mon, 17 Nov 97 11:00:57 -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           Mon, 17 Nov 1997     Volume: 8 Number: 1330

Today's topics:
     Re: "perl aware" vi editor? (Keith Willis)
     @ARGV not read on NT. <rajagopm@kochind.com>
     Re: @ARGV not read on NT. (Brian Wheeler)
     Re: A Very Simple Perl Script (Brock Sides)
     Accessing /usr/adm/binary.errlog from Perl stockman@rdbewss.redstone.army.mil
     Available modules to check script performance <cdm2@formalsys.ca>
     Re: calendar code <rootbeer@teleport.com>
     Certificating users in a WWW page (Roberto Lopes)
     Re: cgi help <rootbeer@teleport.com>
     Re: CGI Script Output....help. (Jeremy D. Zawodny)
     Re: CGI Script Output....help. (Tad McClellan)
     Re: CGI Script Output....help. (Matt Dowell)
     Re: CPAN confusion lvirden@cas.org
     Re: Error 500 on server??? (I R A Aggie)
     Re: exclusive file rights (Tad McClellan)
     Re: exclusive file rights (Matt Dowell)
     Re: Help: problem about sendmail <usenet-tag@qz.little-neck.ny.us>
     Re: How to determine absolute file path on UNIX (Alfred von Campe)
     Re: How to determine absolute file path on UNIX <usenet-tag@qz.little-neck.ny.us>
     Re: is h2xs supposed to do this? (Ilya Zakharevich)
     Re: Matching a literal "interrobang" ?? <rootbeer@teleport.com>
     Re: Multi-line substitution (adding newlines and global <rootbeer@teleport.com>
     Re: need script to strip html tags from file (Gabor)
     Re: Newbie Q. How to flush print output mid-script? <rootbeer@teleport.com>
     nt build of perl5.004_04 <tlockney@tivoli.com>
     Re: Passing Variables <scrimsher@wvmg.com>
     Perl related URLs (Sami Lyytinen)
     Re: Perl related URLs (Jeremy D. Zawodny)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 17 Nov 1997 16:40:44 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: "perl aware" vi editor?
Message-Id: <34707295.1836913622@elf.bri.hp.com>

On Tue, 11 Nov 1997 22:43:53 -0500, , snailgem@aol.com wrote:

>I'm not sure what I mean, but this is what got me curious:
>
>In "Programming Perl", on p.24 there's an example of a foreach statement
>that goes like this:
>
>foreach $user (@users) {
>	if (-f "$home{$user}/.nexrc") {
>		print "$user is cool ... they use a perl-aware vi!\n";
>	}
>}

By a process of deduction:

 .exrc is the resource configuration file that 'vi' uses.  It is
likely, therefore that .nexrc is the equivalent file used by some
vi-like editor.

A Web search on 'nexrc and vi' gives me (amongst other locations):
http://www.bostic.com/vi from which I quote:

Nvi is an implementation of the ex/vi text editor originally
distributed as part of the Fourth Berkeley Software Distribution
(4BSD), by the University of California, Berkeley. The source code to
nvi is freely available, and nvi may be freely redistributed and used
under some conditions (please refer to the license for specific
details). 

yadda yadda....

Features:

Nvi supports all the historic ex/vi features except for open mode and
the lisp edit option (e.g., it has a fully implemented underlying ex
mode). It has a number of additional features as well: 

8-bit clean data, lines and files limited by available memory 

Multiple edit buffers 

Colon command-line editing and path name completion 

Tag stacks (including support for Cscope databases) 

Extended Regular Expressions 

Infinite undo 

Horizontal scrolling 

Message catalogs (Dutch, English, French, German, Russian, Spanish,
Swedish) 

Preliminary support for Perl and Tcl/Tk scripting languages 

----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: 17 Nov 97 16:28:27 GMT
From: "Koch" <rajagopm@kochind.com>
Subject: @ARGV not read on NT.
Message-Id: <01bcf375$95498d80$121ad192@kii-197990>

When I execute a Perl program from the command line, the arguments
following the command name are not being read into the @ARGV array, unless
I source the script in explicitly to Perl.  Here's an example:
The script argtest.pl reads:
print @ARGV ;
if ($ARGV[2] eq "") 
{
	print "Not reading third argument!" ;
}

When I type
> argtest.pl 3 4 5 6

I get 
> Not reading third argument!

Whereas, 
> perl argtest.pl 3 4 5 6
gives
> 3456

This is important to me since I use perl programs which call other perl
programs, and rely on the search path to find them.  As far as I know, 
>perl argtest.pl
will only work if argtest.pl is in the current directory (Perl will be
found acc. to the path.

This problem is not universal (problem exists on 2 out of 3 computers I
use), or stable (problem did not exist on one computer one morning, then
showed up in the afternoon with no change to the system, as far as I know.)
 

Any help (and reply to e-mail) will be appreciated!

Thanks,
Mohan Rajagopal
rajagopm@kochind.com
  


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

Date: 17 Nov 1997 16:45:26 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: Re: @ARGV not read on NT.
Message-Id: <64psb6$ag1$1@dismay.ucs.indiana.edu>

	Sounds like NT's retarded file extension associations are biting you.
check using ftype and assoc what the association for .pl is.  It may be that
on some machines you're passing parameters and on some you're not.  

	Brian

In article <01bcf375$95498d80$121ad192@kii-197990>,
	"Koch" <rajagopm@kochind.com> writes:
> When I execute a Perl program from the command line, the arguments
> following the command name are not being read into the @ARGV array, unless
> I source the script in explicitly to Perl.  Here's an example:
> The script argtest.pl reads:
> print @ARGV ;
> if ($ARGV[2] eq "") 
> {
> 	print "Not reading third argument!" ;
> }
> 
> When I type
>> argtest.pl 3 4 5 6
> 
> I get 
>> Not reading third argument!
> 
> Whereas, 
>> perl argtest.pl 3 4 5 6
> gives
>> 3456
> 
> This is important to me since I use perl programs which call other perl
> programs, and rely on the search path to find them.  As far as I know, 
>>perl argtest.pl
> will only work if argtest.pl is in the current directory (Perl will be
> found acc. to the path.
> 
> This problem is not universal (problem exists on 2 out of 3 computers I
> use), or stable (problem did not exist on one computer one morning, then
> showed up in the afternoon with no change to the system, as far as I know.)
>  
> 
> Any help (and reply to e-mail) will be appreciated!
> 
> Thanks,
> Mohan Rajagopal
> rajagopm@kochind.com
>   


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

Date: Mon, 17 Nov 1997 11:31:08 -0600
From: cbks@NOSPAM.magibox.net (Brock Sides)
Subject: Re: A Very Simple Perl Script
Message-Id: <cbks-1711971131080001@dave.magibox.net>

In article <64nvbk$p63$1@agate.nbnet.nb.ca>, Mike Butler <mgb@nbnet.nb.ca>
wrote:

> Hello All,
> I'm attempting to use Perl as a CGI script to do a very simple thing and I
> was wondering if someone could help. I'm currently running RedHat Linux
> on a standalone Apache Web server. I access the server from a browser
> like so: http://localhost. Lets say I want to write a web page to take 
> some text input from the client and when I press the submit button the 
> CGI script simply echoes the text back at me. Sounds trivial I know but 
> I'm just trying to get the hang of the HTML and CGI communication. 
> Anyone out there that might be able to jot down a little code for me that
> will accomplish this? I have written some perl scripts and HTML but I am
> new to CGI and need a little boost to get me going.
> 
> Thanks
> Mike Butler
>  

You should be able to figure out what's going on from this. 
Or just re-use the code. This prints out the value of the form
field named "input" on a new page.

#!/usr/local/bin/perl

if ($ENV{'REQUEST_METHOD'} eq 'GET') {

   # Split the name-value pairs
   @pairs = split(/&/, $ENV{'QUERY_STRING'});

}

if ($ENV{'REQUEST_METHOD'} eq 'POST') {
   
    # Get the input
   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

   # Split the name-value pairs
   @pairs = split(/&/, $buffer);
}

foreach $pair (@pairs) {

   # Split the pair up into individual variables.                       
   local($key, $value) = split(/=/, $pair);

   # Decode the form encoding on the name and value variables.          
   $key =~ tr/+/ /;
   $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

   # Read the key and value into a hash
   $hash{$key} = $value;

}

print "Content-type: text/html\n\n";
print <<"END";
<HTML>
<HEAD>
<TITE>Feedback from Form</TITLE>
</HEAD>
<BODY>
END

print $hash{'input'}, "\n";

print <<"END";
</BODY>
</HTML>
END

exit(0);

Brock Sides
cbks@NOSPAM.magibox.net
http://www.magibox.net/~brock/
To reply by email, remove the string "NOSPAM." from reply address.


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

Date: Mon, 17 Nov 1997 12:53:14 -0600
From: stockman@rdbewss.redstone.army.mil
To: stockman@rdbewss.redstone.army.mil
Subject: Accessing /usr/adm/binary.errlog from Perl
Message-Id: <879792237.2643@dejanews.com>

Hello,

 Using DU 4.0B and Perl5.004_04.

 I will be posting to the perl newsgroup also.

 I am trying to learn Perl and am trying to access
a filed called /usr/adm/binary.errlog. The file
has bootup information that is retrevied via
uerf -R. What I am wanting to do is write a Perl
script that will extract information from that
file and display it in a SGI hinv type of format.

 The SGI hinv command displays information about the
system such as OS Version, disk drives and their SCSI
ID, graphics device and etc.. This binary.errlog has
most of the information that I need. I am just having
trouble accessing it. Has anyone written or accessed this
file via Perl before ?? Has anyone written anything along
this line before ?? If so - care to share it ??

 Can someone provide an example of how to access this
file from perl ?? This is what I am doing thus far, but
none of the records are being printed. Just a first start
to make sure that I can get at the information.

#!/usr/local/bin/perl
$file1 = "/usr/adm/binary.errlog";
$size = -s $file1;      # remember how big this file is


print STDERR "$file1 is $size bytes long\n";

die "\a$file1 does not exist or has no data\n" unless $size;
open (IN, $file1) || die "Can't open $file1, $!\n";
while (<IN>) {
   print "REC $IN \n";
}

close (IN) || die "Can't close $file1, $!\n";


 Thanks,

 Gaylon Stockman

 stockman@rdbewss.redstone.army.mil

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


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

Date: Mon, 17 Nov 1997 11:42:05 -0400
From: Craig Morris <cdm2@formalsys.ca>
Subject: Available modules to check script performance
Message-Id: <347065CD.4E72@formalsys.ca>

Hello,

Does anyone know of any Perl packages, modules, etc...
that can be used to scan a script for performance bottlenecks.
I seem to recall hearing about one but I can't remember the
name.  Any help would be appreciated.


Regards,


Craig Morris
cdm2@formalsys.ca


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

Date: Mon, 17 Nov 1997 10:19:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Todd Wallace <twallace@zippy.icma.org>
Subject: Re: calendar code
Message-Id: <Pine.GSO.3.96.971117101818.12318S-100000@usertest.teleport.com>

On 14 Nov 1997, Todd Wallace wrote:

> Can someone point me to some calendar code in Perl?
> I need something that does something like the "cal" command in UNIX.

    print `cal`;		#  :-)

You could probably code up something of your own with the help of one of
the many Date modules on CPAN. 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: Mon, 17 Nov 1997 19:20:11 GMT
From: rctlopes@uol.com.br (Roberto Lopes)
Subject: Certificating users in a WWW page
Message-Id: <64q1fl$m7j@srv4-poa.nutecnet.com.br>

Please, anyone know how to access the .htaccess and .htpasswd via WWW?

It's without show the message box asking to the Username and Password.
I have one directory for each user. I want to create a form with
UserName and UserPassword and submit it to a perl cgi.
The cgi will check the username and the password with the .htaccess
and .htpasswd. If match, show the main page inside of the directory.
If you send me the source code I'll be very glad....
Thank you.


Roberto Lopes
rglopes@uol.com.br



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

Date: Mon, 17 Nov 1997 10:17:41 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: David Jacoby <jacoby@harbor.ecn.purdue.edu>
Subject: Re: cgi help
Message-Id: <Pine.GSO.3.96.971117101501.12318R-100000@usertest.teleport.com>

On 14 Nov 1997, David Jacoby wrote:

> $SearchFor =~ /=/;
> $SearchFor = $';

The magical $' variable is usually to be avoided, for efficiency reasons. 
This code is probably better written as follows, or (even better) with
substr and index. 

    $SearchFor =~ s/^.*?=//s;

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: Mon, 17 Nov 1997 16:02:22 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: CGI Script Output....help.
Message-Id: <34706a6c.321401801@igate.hst.moc.com>

[original author automagically cc'd via e-mail]

On Sun, 16 Nov 1997 18:26:45 -0400, Michael Butler <mgb@nbnet.nb.ca>
wrote:

>Hi, I'm new to CGI and Perl and need a little help. I've written a very
>simple HTML document and Perl script. The HTML document consists of a
>text box into which the user types some information. After pressing the
>submit button  the Perl script will simply print out some stuff to the
>client.

You'd be saving yourself lots of time by picking up a copy of CGI.pm
from CPAN and using it for your CGI development. Trust me.

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


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

Date: Mon, 17 Nov 1997 10:05:36 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: CGI Script Output....help.
Message-Id: <g0qp46.t01.ln@localhost>

Michael Butler (mgb@nbnet.nb.ca) wrote:
: Hi, I'm new to CGI and Perl and need a little help. I've written a very

[snip]

: Why don't I get a return document to my browser? 

Your _server_ is misconfigured, or you are not invoking it the way
the server wants you to.

It has nothing to do with Perl, and is therefore off-topic for this
newsgroup.


: If anyone can help I'd
: appreciate it.


The administrator of the server you are using should be able to help.

Or, ask in a newsgroup that has some connection to HTTP servers, such as:

   comp.infosystems.www.servers.mac
   comp.infosystems.www.servers.misc
   comp.infosystems.www.servers.ms-windows
   comp.infosystems.www.servers.unix


And/or, see the Perl FAQ, part 9:

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


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Mon, 17 Nov 1997 11:10:35 -0600
From: mdowell@mmm.com (Matt Dowell)
Subject: Re: CGI Script Output....help.
Message-Id: <34707A8B.2FBF@mmm.com>

Michael Butler wrote:
> 
> Hi, I'm new to CGI and Perl and need a little help. I've written a very
> simple HTML document and Perl script. The HTML document consists of a
> text box into which the user types some information. After pressing the
> submit button  the Perl script will simply print out some stuff to the
> client. As you may have guessed I'm just trying to do something simple
> to get the hang of things. Here'e the script:
> 
> #!/usr/bin/perl
> 
> print "Content-type: text/html/n/n";
> 

Try \n\n instead...

Matt Dowel



Opinions expressed herein are my own and may not represent those of my employer.



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

Date: 17 Nov 1997 17:16:34 GMT
From: lvirden@cas.org
Subject: Re: CPAN confusion
Message-Id: <64pu5i$eq9$1@srv38s4u.cas.org>


According to Jarkko Hietaniemi  <hietanie@koah.research.nokia.com>:
:hermit@cats.ucsc.edu (William R. Ward) writes:
:> True, but I still find the web interface to CPAN confusing (I was the
:
:And I still repeat that there is none.  You must mean by "web interface"
:that you open up http://www.perl.com/CPAN/.  Well, that is not a web

Hmm - when I open up <URL: http://cpan.perl.org/> it sure _looks_ like
a web interface to me - an HTTP connection gets me there, and all the
links at the URL are HTTP links...

-- 
Larry W. Virden                 INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.


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

Date: Mon, 17 Nov 1997 11:34:31 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Error 500 on server???
Message-Id: <-1711971134310001@aggie.coaps.fsu.edu>

In article <19971117093600.EAA06289@ladder02.news.aol.com>,
hstudiosny@aol.com (HSTUDIOSNY) wrote:

+  to netscape and ran the script I got Error 500, Internal error.  
+ The path for the perl interpreter is correct:

+ Any other suggestions on what is causing this error?

Try:

perl -c cgi_script

and see if it passes the syntax checker.

James

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Mon, 17 Nov 1997 10:17:12 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: exclusive file rights
Message-Id: <8mqp46.r21.ln@localhost>

Jeremy D. Zawodny (jzawodn@wcnet.org) wrote:
: [original author automagically cc'd via e-mail]

: On Mon, 17 Nov 1997 08:10:40 -0600, tadmc@flash.net (Tad McClellan)
: wrote:

: >Jeremy D. Zawodny (jzawodn@wcnet.org) wrote:
: >: [original author automagically cc'd via e-mail]
: >
: >: On Mon, 17 Nov 1997 01:20:02 GMT, syarbrou@ais.net (Steve) wrote:
: >
: >: >from multiple writes and reads at once.  How do you go about locking
: >: >access to the file so nothing else can access it while reading and
: >                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
: >
: >Note that flock()ing does not ensure this.
: >
: >It ensures that 'no cooperating programs' can access the file.
: >
: >Even when locked, any (uncooperative) process can modify the file...

: Correct. And the flock() documentation in Perl referrs to the flock()
: Unix manpage. On one of my systems, that says:

[snip man page snippet]

: Assuming that the poster follows my suggestion, that will become
: clear.

: However, it may be worth patching the docs to make this explicit in
: the Perl documentation so that nobody gets a false sense of security.


This question has come up at least twice in the last month or so.

Patching the docs would be a Good Idea.


[ the 'exclusive' in the Subject: led me to believe that the original
  poster may have a misconception about what locking does. I should
  have responded to the original article in this thread instead, but 
  my news software deletes any postings from the original author.
]


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Mon, 17 Nov 1997 11:20:48 -0600
From: mdowell@mmm.com (Matt Dowell)
Subject: Re: exclusive file rights
Message-Id: <34707CF0.F50@mmm.com>

We are running HP-UX and for some reason flock is not in the OS. So here
is what I did to get around this. I think it's better anyways.

I first lock the file, and I do that by creating a file with the same
name, just a .LOCK on the end.

When someone tried to access the file, i check for the filname.LOCK
first, if there then loop. Contantly checking.

When the file is done being used, unlock it. : unlink (file.LOCK)

Works for me.

Matt dowell
p.s. I don't check for spelling mistakes, if 
they are there, don't waste our bandwidth by showing
how good of a speller you are.



Tad McClellan wrote:
> 
> Jeremy D. Zawodny (jzawodn@wcnet.org) wrote:
> : [original author automagically cc'd via e-mail]
> 
> : On Mon, 17 Nov 1997 01:20:02 GMT, syarbrou@ais.net (Steve) wrote:
> 
> : >from multiple writes and reads at once.  How do you go about locking
> : >access to the file so nothing else can access it while reading and
>                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Note that flock()ing does not ensure this.
> 
> It ensures that 'no cooperating programs' can access the file.
> 
> Even when locked, any (uncooperative) process can modify the file...
> 
> : >writing?  The program does the following and I would like it locked
> : >for the entire process(any other suggestions are welcom):
> 
> : This is covered in the Perl documentation. Search for the work 'lock'
> : and you're bound to find it.
> 
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@flash.net                        Perl programming
>     Fort Worth, Texas



Opinions expressed herein are my own and may not represent those of my employer.



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

Date: 17 Nov 1997 18:12:16 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Help: problem about sendmail
Message-Id: <eli$9711171305@qz.little-neck.ny.us>

Posted and mailed.

ChuoSenko <thada@chuosenko.th.com> wrote:
> I write perl the follow this
> #!/usr/local/perl
                   ^^^
                    \ Where's the -w?

> open(SENDMAIL, "|/usr/lib/sendmail -t") ;
                                         ^^^
 Where are you testing for open failing? /

> print SENDMAIL <<EOF;
> From: user@domain1.com
> To: thada@chuosenko.th.com
> Subject: Daily status message
> Message

You should have a blank line between headers and body.

> EOF
> close(SENDMAIL)

> If i submit from html, the result has nothing.

Submit from html? What are you talking about? CGI? Is sendmail available
on that machine? Does "result has nothing" mean there is no body? Maybe
you are running it with two different versions of "sendmail", one of
which fixes your missing blank line problem.

> Please send me e-mail, I will thank a lot.

Please don't send the same thing three times.

Elijah
------
consider also using "|/usr/lib/sendmail -t -oi" in your open


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

Date: 17 Nov 1997 16:24:02 GMT
From: alfred@hw.stratus.com (Alfred von Campe)
Subject: Re: How to determine absolute file path on UNIX
Message-Id: <64pr32$gm8@transfer.stratus.com>

In the original post I wrote:
|>Before I reinvent the wheel, is there a way in Perl to determine
|>the absolute path to a given filename?  The File::Basename module
|>doesn't do what I need, and I haven't found anything else that
|>comes close.
|>
|>Here are some examples of what I need assuming that my current
|>working directory is ~/bin (at our site, all user directories
|>are accessible as /h/user):
|>
|>  foo                    -> /h/alfred/bin/foo
|>  sub/foo                -> /h/alfred/bin/sub/foo
|>  ./sub/foo              -> /h/alfred/bin/sub/foo
|>  ../tools/../bin/foo    -> /h/alfred/bin/foo
|>  ../tools/foo           -> /h/alfred/tools/foo
|>  ~user/foo              -> /h/user/foo
|>  /usr/local/scripts/foo -> /usr/local/scripts/foo
|>
|>Also, if there are any symbolic links along a path, I need to get
|>the final (real) path.  Basically, what I need is what $ENV{'PWD'}
|>is set to if I were to "cd" to the directory that contains the file
|>in question.  There must be an easy way to do this in Perl, but I
|>have not found it (yet! :-).

I guess this wheel hasn't been invented yet (which surprises me).
I'll probably hack something together myself for now, and then
think about an "elegant" solution later.  My first thought is to
append the given filepath to the path returned by cwd() (unless
the filepath starts with "/" of course), and then reduce any "."
and ".." in the resulting path (and any path that starts with "~"
is also treated as a special case).

Alfred
-- 
+------------------------------------------------------------+
| Phone: H: 978.448.6214, W: 508.490.6306, fax: 508.460.2888  \
|  Mail: Alfred von Campe, 402 Lowell Road, Groton, MA 01450   \
| Email: alfred@hw.stratus.com                                  \
+----------------------------------+-----------------------------+
| Why is common sense so uncommon? | I'd rather be flying N4381Q |
+----------------------------------+-----------------------------+


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

Date: 17 Nov 1997 18:36:33 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: How to determine absolute file path on UNIX
Message-Id: <eli$9711171314@qz.little-neck.ny.us>

Alfred von Campe <alfred@hw.stratus.com> wrote:
> In the original post I wrote:
> |>Before I reinvent the wheel, is there a way in Perl to determine
> |>the absolute path to a given filename?  The File::Basename module

No.

> |>Also, if there are any symbolic links along a path, I need to get
> |>the final (real) path.  Basically, what I need is what $ENV{'PWD'}
> |>is set to if I were to "cd" to the directory that contains the file

It may lie to you.

> I guess this wheel hasn't been invented yet (which surprises me).

Because it can't be done right. In the below '$' is the ksh prompt,
'#' is the superuser for all shells, '%' is the csh prompt.

$ su -
Password:
# exec ksh
# mount /dev/bigdisk1 /mnt
# cd /mnt
# mkdir foo
# ln -s /tmp foo/demo
# cd foo/demo
# env | grep PWD
PWD=/mnt/foo/demo
# /bin/pwd
/tmp
# umount /dev/bigdisk1
# mount /dev/bigdisk2 /mnt
# mkdir /mnt/foo
# mkdir /mnt/foo/demo
# chmod 111 /mnt/foo
# su nobody
% exec ksh
$ cd /mnt/foo/demo
$ env | grep PWD
PWD=/mnt/foo/demo
$ /bin/pwd
pwd: cannot determine current directory!
$

> I'll probably hack something together myself for now, and then
> think about an "elegant" solution later.  My first thought is to
> append the given filepath to the path returned by cwd() (unless
> the filepath starts with "/" of course), and then reduce any "."
> and ".." in the resulting path (and any path that starts with "~"
> is also treated as a special case).

# cd /mnt
# mkdir ~foo
# cd ~foo
# pwd
/mnt/~foo

Beware that `/bin/pwd`/.. and $PWD/.. can be different directories, when
/bin/pwd can figure out the current directory. And a command like
"cd /tmp/../../../tmp/" might take to /tmp or somewhere else entirely.
And then there is chroot....

Elijah
------
not to mention many other filesystem weirdnesses


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

Date: 17 Nov 1997 18:40:46 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: is h2xs supposed to do this?
Message-Id: <64q33e$33b$1@agate.berkeley.edu>

In article <64pil7$c1n$1@taliesin.netcom.net.uk>,
Des Herriott <des@corp.netcom.net.uk> wrote:
> In article <64i6n0$c5i$1@agate.berkeley.edu>,
> 	ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> > I repeated what you did with
> > 	h2xs -x -n foo H:/get/perl/tmp/blah.h
> > and got a correct result.  5.004_01 + jumbo-re-v1 + jumbo-malloc here,
> > C::Scan is dated 9/26/97 (latest release by me).

Sorry, finger slip.  It is 9/26/96.

> Hmm, where I can get this latest version?  The newest I could find on
> CPAN is 0.4, which is dated Aug 25th 1997 (I notice now that that version
> appears to have been released by JASONS).  Should I be using 0.3?

I would try it.  Please report.  Jason could have broken things - I
did not check.

Ilya


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

Date: Mon, 17 Nov 1997 09:53:25 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Pete Holsberg <pjh@mccc.edu>
Subject: Re: Matching a literal "interrobang" ??
Message-Id: <Pine.GSO.3.96.971117095309.12318O-100000@usertest.teleport.com>

On 14 Nov 1997, Pete Holsberg wrote:

> but I haven't been able to figure out how to make that "?"
> literal. I've tried "\?" but that didn't work.

Try again. :-)

-- 
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: Mon, 17 Nov 1997 10:27:53 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Steven Tolkin <steve.tolkin@fmr.com>
Subject: Re: Multi-line substitution (adding newlines and global replace)
Message-Id: <Pine.GSO.3.96.971117102308.12318T-100000@usertest.teleport.com>

On Fri, 14 Nov 1997, Steven Tolkin wrote:

> I am having a hard time figuring out how to do a global replace that
> adds newlines, but not in front of an existing newline.  

> s/(\. +)(?!\n)/$1\n/g;

I'd try this:

    s/(\.[^\S\n]+)(?!\s)/$1\n/g;

 ...But remember that not every sentence ends with period (some end in a
quote mark, a bang, or a question mark, among other endings). Does that do
anything good? 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: 17 Nov 1997 17:55:45 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: need script to strip html tags from file
Message-Id: <slrn6710rh.1ls.gabor@vinyl.quickweb.com>

In article <346FFF99.31DF@iil.intel.com>, Bekman Stanislav wrote:
>g@world.std.com wrote:
>> 
>> Can anyone help a beginner out there?  I'm looking for a script that will strip
>> html tags from a file. Note: the tags might cross lines.
>> 
>> Thanks,
>> Gary Jutras
>
>http://www.eprotect.com/stas/TULARC
>[My Perl Scripts Section] ->tagstrip.pl

How about
lynx -dump URL

gabor.
--
    Tactical?  TACTICAL!?!?  Hey, buddy, we went from kilotons to
    megatons several minutes ago.  We don't need no stinkin' tactical
    nukes.  (By the way, do you have change for 10 million people?)
        -- lwall
mharris@gov.on.ca he, he, he


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

Date: Mon, 17 Nov 1997 10:44:12 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John <webmaster@visionary-western.co.uk>
Subject: Re: Newbie Q. How to flush print output mid-script?
Message-Id: <Pine.GSO.3.96.971117103803.12318V-100000@usertest.teleport.com>

On Fri, 14 Nov 1997, John wrote:

> I have a dumb question. I have a script which replies to a simple web
> site form submission. The chunk I'm having problems with is near the end
> of the script and runs something like... 
> 
> 	print "...some html...\n";
> 	sleep (300);
> 	exit;
> 
> Question. Why does the script not return its html output to the browser
> until 300 seconds are up?

Bigger question: Does your sysadmin like the idea of your script hanging
around uselessly hogging system resources for five minutes? A CGI script
should be made to get the job done and clear out quickly, since it may be
called again several times per _second_ on a busy server, or when your URL
just appeared on the Today show. :-) 

If I were your sysadmin, I'd disable that script on sight. Even if it did
return the html to the browser at once. :-)

What are you trying to accomplish by a five-minute sleep? If you're hoping
that this will prevent someone from repeatedly triggering your script,
you're going down the wrong road. 

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: Mon, 17 Nov 1997 09:21:51 -0600
From: Thomas Lockney <tlockney@tivoli.com>
Subject: nt build of perl5.004_04
Message-Id: <3470610F.3D365E6F@tivoli.nospam>

Ok, supposedly perl5.004_04 should build on an nt box with cygnus' gnu
utilities, right?

Well, everytime I try to build it, the configure script fails out when
it tries to test gcc. I copied the wrappers that are in the cygwin32
directory to my bin directory, but still no luck.

Anybody else have any success with this?

Thanks in advance,
Thomas Lockney
Tivoli Systems
tlockney@tivoli.com



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

Date: Mon, 17 Nov 1997 09:44:57 -0800
From: John Scrimsher <scrimsher@wvmg.com>
Subject: Re: Passing Variables
Message-Id: <34708298.7CA9088@wvmg.com>

>

   Actually,  those 'add to shopping cart' sites use Cookies to maintain
state rather than hidden fields.  The cookie is set using the 'SET
COOKIE:' statement right after the 'Content Type=' statement.  Netscapes
web site has some good documentation about this.  The cookies are then
passed by the Header to the script every time it is invoked.

JPS.




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

Date: 17 Nov 1997 16:30:42 GMT
From: 0100291@sah.tec.puv.fi (Sami Lyytinen)
Subject: Perl related URLs
Message-Id: <64prfi$a75$1@ex.puv.fi>

Hi! I'm collecting webpage design related links to my homepages and would
like to add something concerning Perl. Any related URLs would be highly
appreciated!

	- Petteri

 ------------------------------------------------------------------------------
                "Communication, keyword for success in life"
 ------------------------------------------------------------------------------
 Address: Petteri Lyytinen, Ahventie 22 B 20, 65200 VAASA
     GSM: +358-50-5671376
  E-mail: 0100291@sah.tec.puv.fi
          petteri@modeemi.cs.tut.fi
 Webpage: http://www.tec.puv.fi/~0100291/index1.html
 ------------------------------------------------------------------------------
                     A member of the HTML Writers Guild
                            http://www.hwg.org/
 ------------------------------------------------------------------------------


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

Date: Mon, 17 Nov 1997 17:14:06 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Perl related URLs
Message-Id: <34707b2d.325689957@igate.hst.moc.com>

[original author automagically cc'd via e-mail]

On 17 Nov 1997 16:30:42 GMT, 0100291@sah.tec.puv.fi (Sami Lyytinen)
wrote:

>Hi! I'm collecting webpage design related links to my homepages and would
>like to add something concerning Perl. Any related URLs would be highly
>appreciated!

Perl has traditionally had little to do with web page "design", but
I'll suggest that http://www.perl.com/ is the best starting point that
you're likely to find.

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


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

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

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