[6266] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 888 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 3 16:28:06 1997

Date: Mon, 3 Feb 97 13:00:22 -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, 3 Feb 1997     Volume: 7 Number: 888

Today's topics:
     Bug in Copy.pm (produces warning message) <mgregory@asc.sps.mot.com>
     Re: Commercial success stories using perl. (Joshua Lerner)
     Re: Creation time and date of file (Mike Stok)
     dropping trailing zeroes when "write (FA).... <jru@gel.com>
     Future release question (Tim Gallagher)
     Re: Grabbing Html via perl from the web (David  Bell)
     Here document.. here... Good boy (Daniel DuBois)
     Re: Here document.. here... Good boy (Joshua Lerner)
     Re: Inverse Letters <rra@cs.stanford.edu>
     Re: Inverse Letters (Nathan V. Patwardhan)
     Re: JAVA-enabled Browser Detection <roberta@cyberramp.net>
     Re: JAVA-enabled Browser Detection (Chris Nandor)
     Re: JAVA-enabled Browser Detection (Nathan V. Patwardhan)
     Re: JAVA-enabled Browser Detection (Abigail)
     Live via satellite, a "Crash Course in JAVA" (Glenn M Brown Jr)
     Re: multi dimensional arrays <jander@jander.com>
     Re: Odd problem with a GD.pm graph script i made ()
     Re: Please help me with this very simple PERL program.. (Adrian Singh)
     PSCOPE - an CSCOPE for perl source (Mark A. Lehmann)
     Re: Reading numbers from file.. (Jon Orwant)
     Re: Security and Password <rootbeer@teleport.com>
     Re: sort routine fails (Joel Earl)
     Re: space stripping (Dennis Marti)
     Re: space stripping (Bennett Todd)
     Re: Substitute with function (Jon Orwant)
     Re: URL Encoding (Abigail)
     Using Perl module installed in personal area lhollman@nicom.com
     Re: Using Perl module installed in personal area (Mike Stok)
     Re: Using Perl module installed in personal area (Nathan V. Patwardhan)
     using putpwent <ez045864@peseta.ucdavis.edu>
     What htm line(s) needed to kick back print "test" from  <keys101@westworld.com>
     Re: What htm line(s) needed to kick back print "test" f (Daniel DuBois)
     Win32::Eventlog.pm write method? (Daniel Huber)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 03 Feb 1997 13:09:25 +1030
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Bug in Copy.pm (produces warning message)
Message-Id: <r8n2tmmx42.fsf@asc.sps.mot.com>


I was really glad when I found that a library for copying files came
with Perl.  It always seems gross to have to use system() for this.
However, Copy.pm seems to be a little flawed.  When I run the
following script:


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

use strict;
require 5.003;


use File::Copy 'cp';

cp("foo.pl", "bar") or die;


I get 

Use of uninitialized value at /app/perl-5.003/lib/perl-5.003/File/Copy.pm line 103.


If I add this:

$\ = ''; # make Copy.pm happy.

after the use File::Copy line, it makes this warning go away.  But
surely I shouldn't have to do that!

What am I missing?

Martin
-- 
-- Martin Gregory <mgregory@asc.sps.mot.com>    |        _--_|\ 
-- Modelling, Design, & Synthesis Team          |       / MASC \
-- Motorola Australia Software Centre           |       \_.-*._/
-- Phone: +61 8 8203 3612, Fax: +61 8 8203 3501 |             v



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

Date: 3 Feb 1997 13:56:22 -0500
From: jlerner@panix.com (Joshua Lerner)
Subject: Re: Commercial success stories using perl.
Message-Id: <5d5ccm$p6t@panix3.panix.com>

In article <32F1BAAF.3FCA@dynamicweb.com>,
Steve Vanechanos  <stevev@dynamicweb.com> wrote:
>I am looking for significant commercial success stories where perl is
>being used.

Excite for Web Servers
(http://www.excite.com/navigate/LOWBAND/download.cgi) uses Perl (version 4
I think).

Joshua Lerner


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

Date: 3 Feb 1997 17:42:41 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Creation time and date of file
Message-Id: <5d582h$krl@news-central.tiac.net>

In article <32F62993.2846@thereel.com>,
Lewis Taylor  <lewis@thereel.com> wrote:

>I have tried to access the modification date in the same way:
>
>$info=(stat($file))[9];
>
> but revtrieve   
> a 9-digit integer. How do I go about converting this into something
>useful of human-readable?

There are a few ways to go about this, you can use localtime to turn the
integer (which is the number of seconds since the beginning of 1 Jan 1970
GMT, the unix epoch, the same encoding as is used by perl's time) into
some more useful numbers. From the man page for perl 5 (more accurately
the perlfunc man page)

  localtime EXPR
          Converts a time as returned by the time function to a 9-element
          array with the time analyzed for the local time zone.  Typically
          used as follows:

              ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                          localtime(time);

          All array elements are numeric, and come straight out of a struct
          tm.  In particular this means that $mon has the range 0..11 and
          $wday has the range 0..6 and $year is year-1900, that is, $yearis
          123 in year 2023.  If EXPR is omitted, uses the current time
          ("localtime(time)").

          In a scalar context, returns the ctime(3) value:

              $now_string = localtime;  # e.g., "Thu Oct 13 04:54:34 1994"

          Also see the Time::Local module, and the strftime(3) function
          available via the POSIX module.
                                                                
The scalar context thing is new in perl 5, oldert perls came with a
library ctime.pl $Date = &ctime(time) would leave a \n terminated string
like the ome produced by the C ctime function in $Date.  I like using the
POSIX strftime routine as it is fairly flexible.

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 03 Feb 1997 11:10:11 -0500
From: John Ulmer <jru@gel.com>
Subject: dropping trailing zeroes when "write (FA)....
Message-Id: <32F60DE3.538@gel.com>

I'm having trouble finding an easy way to write numeric
values to a file and keeping the trailing zeroes needed for
a correct number of significant figures.  The number of
decimal places changes as the program moves from input
record to the next input record.  Consequently, I can not
use a set number of decimals.  My variable carries the
correct number of significant figures until I try to write
it.
The output routine looks like this......
##########
sub output
{
	$~ = "FA";
	$printParameter = 1;

	&crossoverTable();

	if ($printParameter == 1)
	{
	write(FA);
	}
}
#########
format FA = 
@<<<<<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<....and
so on.
#########


If a variable is "2.0" coming from &crossoverTable, the
write (FA) command drops the zero and the decimal and
writes "2" into the output file.  How can I make it keep
the trailing zero and thus keep the correct number of
significant figures?

Thanks,

John Ulmer
jru@gel.com


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

Date: 3 Feb 1997 19:56:51 GMT
From: tagallag@ichips.intel.com (Tim Gallagher)
Subject: Future release question
Message-Id: <5d5fu3$alg@ornews.intel.com>

Does anyone know the status of the perl compiler. Yes
I do mean compiler. Currently only an interpreter is
available. I was told that a compiler was in the 
works. Any info would be apreciated.
-- 
------------------------------------------------------------
Tim Gallagher     206-371-8538     tagallag@iwa.dp.intel.com


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

Date: 3 Feb 1997 10:21:50 -0700
From: dbell@azstarnet.com (David  Bell)
Subject: Re: Grabbing Html via perl from the web
Message-Id: <5d56re$d9i@web.azstarnet.com>

(posted and emailed)

In article <32F0DD05.2781@uscs.com>, Paul Timperio  <ptimperio@uscs.com> wrote:
>Has anyone tried this before??-- Connecting to a website, retrieving
>html and putting it in a file.  This is where my efforts have led me to:

(code deleted)

>Yeah simple right? Just wondering before I reinvent the wheel,  has
>someone- somewhere done this before.  If not *any* suggestions on how to
>do this?

Haven't tried connecting myself, but this has worked just fine (you need
to have lynx on your system, of course):

	$source = `lynx -source $url`;
	print FILE $source;

You might want to put in checks for bad URLs, can't connect, etc.

Dave


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

Date: Mon, 03 Feb 1997 18:34:14 GMT
From: dan@spyglass.com (Daniel DuBois)
Subject: Here document.. here... Good boy
Message-Id: <32f92e00.62808133@news.enteract.com>

I've been trying to teach myself perl the last couple of days, and
naturely, nothing goes without hitch.  I can't seem to get this 'here
document' syntax that I'm seeing in the Camel Book to work.  I've dumbed it
down to this example:

    # Print out thank you to user
    print STDOUT <<'EndOfHtml';

<html>
<head>
<title>SurfWatch Register</title>
</head>
</html>

EndOfHtml


And I get a:
cgi-bin 49>perl -c -w SampsonReg.pl
Can't find string terminator "EndOfHtml" anywhere before EOF at
SampsonReg.pl line 122.

I've tried the double quotes syntax and the identifier syntax with the same
result.  I've also quadruple checked my spelling :)

This is perl, version 5.003 with EMBED
        built under linux at Aug 19 1996 12:22:38
        + suidperl security patch

Is this a case of the book being out of date with perl 5 perhaps?  Am I
missing something obvious?

-----
Daniel DuBois, Traveling Coderman        www.spyglass.com/~ddubois


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

Date: 3 Feb 1997 13:44:05 -0500
From: jlerner@panix.com (Joshua Lerner)
Subject: Re: Here document.. here... Good boy
Message-Id: <5d5bll$nmp@panix3.panix.com>

In article <32f92e00.62808133@news.enteract.com>,
Daniel DuBois <dan@spyglass.com> wrote:

>naturely, nothing goes without hitch.  I can't seem to get this 'here
>document' syntax that I'm seeing in the Camel Book to work.  I've dumbed it
>down to this example:
>
>    # Print out thank you to user
>    print STDOUT <<'EndOfHtml';

[HTML deleted]

>EndOfHtml
>
>
>And I get a:
>cgi-bin 49>perl -c -w SampsonReg.pl
>Can't find string terminator "EndOfHtml" anywhere before EOF at
>SampsonReg.pl line 122.

The code you posted works fine for me.  Remember, 'EndOfHtml' must be the
only thing on the line (if it is to act as the string terminator). Perhaps
you have some trailing spaces...? 

Joshua Lerner


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

Date: 03 Feb 1997 10:52:44 -0800
From: Russ Allbery <rra@cs.stanford.edu>
Subject: Re: Inverse Letters
Message-Id: <qumvi894t8j.fsf@cyclone.stanford.edu>

Nathan V Patwardhan <nvp@shore.net> writes:
> Nathan V. Patwardhan (nvp@shore.net) wrote:
>> Steve Johnson (stevej@wco.com) wrote:

>> How do I print inverse letters in a print statement?

>> If you mean print drow instead of word, try: reverse()

> Forgot to mention it (after reading your other posting), but if you mean
> making the letters appear "highlighted," you might want the Curses
> package available at a CPAN near you!

Massive overkill.  Get Term::ANSIColor instead.  It will be on CPAN
shortly as soon as I finish polishing up the documentation, or you can get
the early alpha release right now from
   <URL:ftp://ftp.eyrie.org/pub/software/modules/ANSIColor-0.08.tar.gz>

Of course, if this is the same person who wants to do full-blown menus,
for that you *will* need Curses....

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: 3 Feb 1997 19:11:26 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Inverse Letters
Message-Id: <5d5d8u$k4k@fridge-nf0.shore.net>

Russ Allbery (rra@cs.stanford.edu) wrote:

: Of course, if this is the same person who wants to do full-blown menus,
: for that you *will* need Curses....

Yep, it's the same person that wants the menus.  Curses, foiled again, eh?
:-)

--
N Patwardhan
nvp@shore.net
[news:alt.fan.jwz]


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

Date: Mon, 03 Feb 1997 12:50:26 -0600
From: Robert Aldridge <roberta@cyberramp.net>
To: mike@stok.co.uk
Subject: Re: JAVA-enabled Browser Detection
Message-Id: <32F63370.54C4@cyberramp.net>

Mike Stok wrote:
> 
> In article <32F566EC.5AA6@cyberramp.net>,
> Robert Aldridge  <roberta@cyberramp.net> wrote:
> >I am looking for a CGI script that will detect if a client browser is
> >capable of displaying a JAVA applet,  the direct the java-enabled
> >browsers to a java savvy page,  and the non-java browsers to a non-java
> >page.
> 
> Please remember that some of us might bu using a browser which is java
> capable but we have the Java (and JavaScript, JScript, whatever...) turned
> off...
> 
> Mike

Oh,  I completely understand this,  but there is no easy way as far as I
know to detect if the browser has java turned on. Or is there?  Either
way,  I'm looking for a way to add a simple java applet to my pages, 
and send those that can't use it to the non-java page.

If anyone knows the user agent types to do this,  please let me know.
Robert




**********************************************************
If you want to fly,  dream high.

http://webflier.com

WebPilot - Your Single Source Guide to the Web!
This is the place youll find most of the interesting and useful pages
on the Web.  You can find topics for kids & teens, parents, business
people and much more.  Youll find links to your favorite sports and to
your favorite TV show.  We have gems of the interent,  even the really
smelly ones (real aroma.com),  and of course news sites galore.   
**********************


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

Date: Mon, 03 Feb 1997 14:30:38 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: JAVA-enabled Browser Detection
Message-Id: <pudge-ya023480000302971430380001@news.idt.net>

In article <32F63370.54C4@cyberramp.net>, roberta@cyberramp.net wrote:
# Oh,  I completely understand this,  but there is no easy way as far as I
# know to detect if the browser has java turned on. Or is there?  Either
# way,  I'm looking for a way to add a simple java applet to my pages, 
# and send those that can't use it to the non-java page.
# 
# If anyone knows the user agent types to do this,  please let me know.
# Robert

I know ... but I won't tell you unless you ask it in the appropriate conference.

comp.infosystems.www.authoring.cgi

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6


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

Date: 3 Feb 1997 19:13:11 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: JAVA-enabled Browser Detection
Message-Id: <5d5dc7$k4k@fridge-nf0.shore.net>

Robert Aldridge (roberta@cyberramp.net) wrote:

: Oh,  I completely understand this,  but there is no easy way as far as I
: know to detect if the browser has java turned on. Or is there?  Either

There's no way a person can know if a browser has Java enabled to my
knowledge, as this is done on the client's side.

--
N Patwardhan
nvp@shore.net
[news:alt.fan.jwz]


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

Date: Mon, 3 Feb 1997 20:03:16 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: JAVA-enabled Browser Detection
Message-Id: <E51MDG.3Lw@nonexistent.com>

On Sun, 02 Feb 1997 22:17:55 -0600, Robert Aldridge wrote in comp.lang.perl.misc:
++ I am looking for a CGI script that will detect if a client browser is
++ capable of displaying a JAVA applet,  the direct the java-enabled
++ browsers to a java savvy page,  and the non-java browsers to a non-java
++ page.
++ 
++ 
++ I have looked all over for something like this,  but I've only found
++ browser detectors that determine Netscape or Explorer.  
++ 

Trivial. Add a <APPLET code = "foo"> and see if the browser
requests for 'foo'. If so, it's Java enabled, if not, it is
most likely not.



Abigail  --  Why would you want this anyway?



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

Date: 3 Feb 1997 12:16:51 -0500
From: itv@Glue.umd.edu (Glenn M Brown Jr)
Subject: Live via satellite, a "Crash Course in JAVA"
Message-Id: <5d56i3$aeq@y.glue.umd.edu>

You and members of your organization are invited to participate in a special seminar titled:
A Crash Course in Java 

Tuesday, March 4 and Wednesday, March 5, 1997 from 11am - 5pm on the NTU 
satellite network and the ITV broadcast network at the ITV building on the
University of Maryland, College Park Campus 

Course description: Java is a new programming language that can be used to 
write programs that can be downloaded and executed on any computer. Among
other applications, Java can be used to write programs that make World
Wide Web pages interactive. 

This course is designed for programmers who are already familiar with 
object-oriented programming in C++ and the basics of the WWW. It will
describe the Java language and run-time system and discuss writing
stand-alone Java programs and Java applets that can be embedded in World
Wide Web pages. Mr. Pugh will walk through a number of examples in
class: students are encouraged (but not required) to arrange to have a 
Java-compatible WWW browser available during the class (either a laptop or
workstation). Examples can be downloaded before or during (or after) the
class. 

Benefits: Upon completion of this course participants will: 

*Learn the important elements of the Java language and system. 
*Be prepared to assess how Java can be used in projects. 
*Be able to write substantial Java programs, both stand-alone programs and
 WWW applets

Intended audience: Software engineers and programmers who wish to learn how to
write software in Java 

For more information about this course, please see our web page at
http://www.glue.umd.edu/itv/javacourse.html or e-mail us at
itv@eng.umd.edu



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

Date: 03 Feb 1997 12:48:20 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: multi dimensional arrays
Message-Id: <iv497pcr.fsf@jander.com>

> In article <32F5E874.41C6@let.kun.nl>, Albert Russel <russel@let.kun.nl> wrote:
> 
> # Hi,
> # 
> # How can I print a multi dimensional associative array
> # with a foreach construction? I think it is something
> # like:
> # 
> #        for ($i=1 ; $i<10 ; $i++) {
> #          foreach $x keys(%aa{}[$i]) {
> #            print $x,$aa{$x}[$i];
> #          }
> #        }

Read the perldsc manpage.

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 3 Feb 1997 19:57:30 GMT
From: gsi@visi.com ()
Subject: Re: Odd problem with a GD.pm graph script i made
Message-Id: <5d5fva$4a0@darla.visi.com>

: Fine. Now if I go *back* and enter in new details and hit submit, the *old*
: graph is still there! Doing a reload on the browser fixes this, and outputs
: the correct graph.

just off the top of my head, if you are generating an HTML document that
contains the graph add something like:

print '<meta http-equiv="expires" content="1 Jan 96">';

-- 
***************************************************************
Disclaimer: You do not exist


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

Date: Mon, 03 Feb 1997 15:12:11 GMT
From: ade.singh@zetnet.co.uk (Adrian Singh)
Subject: Re: Please help me with this very simple PERL program...
Message-Id: <5d4vlk$nv@irk.zetnet.co.uk>

I have never in all my years on newsnet seen a post with
so much know-it-all smug nonsense

--
Adrian Singh	ade.singh@zetnet.co.uk		Freelance Unix SysAdmin


tadmc@flash.net (Tad McClellan) wrote:


>[ comp.lang.perl.modules, comp.lang.perl.tk trimmed from Followups ]

>[ emailed, posted ]



>Whew!

>I have never in my time on Usenet seen a post with more bad manners
>all collected into the same post as yours!

>I'm sure you didn't know that you were exhibiting bad manners, but
>you need to take the time to find out what *is* seen as bad manners
>when using Usenet.

>Read the articles in the     news.announce.newusers    newsgroup.

[ snip ??? lines of elitist crap ]

>--
>   Tad McClellan                          SGML Consulting
>   tadmc@flash.net                        Perl programming





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

Date: 03 Feb 1997 13:04:34 -0600
From: mlehmann@prismnet.com (Mark A. Lehmann)
Subject: PSCOPE - an CSCOPE for perl source
Message-Id: <5bsp3diud9.fsf@smokey.prismnet.com>

I've requested this many times and no one has offered any solution, code, or
really any suggestions for this, so I'm going to write one.  Please email me
requirments you would like to see in the code and any existing
code/algorithms you want to see in this.
-- 
Mark and Kate Lehmann.


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

Date: 03 Feb 1997 18:44:10 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: jhartika@orion.pspt.fi (Juha Hartikainen ia201)
Subject: Re: Reading numbers from file..
Message-Id: <ORWANT.97Feb3134410@fahrenheit-451.media.mit.edu>


jhartika@orion.pspt.fi (Juha Hartikainen ia201) writes:

   I have a huge database which is on my own format. It haves strings, which 
   are easy to read with Perl. It haves also MANY floating point numbers. 
   How can I read these Intel double numbers and convert 'em to string??
   double is 8 bytes long floating point number.

unpack()

-Jon

----------------
Jon Orwant
The Perl Journal
http://tpj.com/



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

Date: Mon, 3 Feb 1997 12:10:44 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Kevin E." <itr@address.net>
Subject: Re: Security and Password
Message-Id: <Pine.GSO.3.95.970203120925.73H-100000@linda.teleport.com>

On Mon, 3 Feb 1997, Kevin E. wrote:

> I'm trying to put a simple security password on my home page.  

Your server's documentation should help you. If you can't find that, ask
your webmaster to help you. If you're still stuck, try a web-specific
newsgroup (or its FAQ) since this question doesn't have to do with Perl.
Good luck! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 03 Feb 1997 19:25:33 GMT
From: earl@shadowfax.rchland.ibm.com (Joel Earl)
Subject: Re: sort routine fails
Message-Id: <EARL.97Feb3132533@shadowfax.rchland.ibm.com>


Hmmm... I don't see anything offhand that would cause your approach to not
work. In general, a comparison routine for sorting should handle undefined
values consistently, which yours appears to do (if $a == $b == undef, then
$one eq $two eq undef). When do you observe that $a is undefined? Do you get a
complaint from -w? Are you sure that all values of @bits are defined? If you
post again, it might help if you included a value of $list that exhibits the
incorrect behaviour.
-- 

   Joel Earl, earl@vnet.ibm.com
   Logic Analysis and Optimization
   IBM Rochester, Minnesota
   (507) 253-2304


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

Date: 2 Feb 1997 01:44:58 GMT
From: marti@netrail.net (Dennis Marti)
Subject: Re: space stripping
Message-Id: <5d0riq$1vm$1@skipper.netrail.net>

Randal Schwartz (merlyn@stonehenge.com) wrote:
: 
: From one of the slides in my class:
: 
: 	while (<>) {
: 		s/#.*//; # kill comments
: 		next if /^\s*$/; # skip blanks
: 		redo if s/\s*\\\s*\n$/<>/e; # fold \
: 		s/^\s*//; # kill prefix whitespace
: 		s/\s*$//; # and suffix whitespace
: 		...
: 	}

Doesn't this mess you up when you have lines like this?

    s/#.*//; # kill comments

Dennis 


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

Date: Mon, 3 Feb 1997 20:32:36 GMT
From: bet@nospam.interactive.net (Bennett Todd)
Subject: Re: space stripping
Message-Id: <slrn5fcir4.fl4.bet@onyx.interactive.net>

On 2 Feb 1997 01:44:58 GMT, Dennis Marti <marti@netrail.net> wrote:
>Randal Schwartz (merlyn@stonehenge.com) wrote:
>: 	while (<>) {
>: 		s/#.*//; # kill comments
>: 		...
>: 	}
>
>Doesn't this mess you up when you have lines like this?
>
>    s/#.*//; # kill comments
>

Nope, does exactly what we want, which is to say it leaves behind "s/".

If you want to honor the quoting rules for some particular programming
language, you'll need some different code. For plain data and config files the
above paragraph works like a champ.

-Bennett


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

Date: 03 Feb 1997 18:39:37 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: grazi@smart.it
Subject: Re: Substitute with function
Message-Id: <ORWANT.97Feb3133937@fahrenheit-451.media.mit.edu>


grazi@smart.it (Alberto Grazi) writes:

   I'd like to perform something like this
     $VAR =~ s/(abc)__(something)__(def)/$1&function($2)$3/eg;
   What's the problem ?

The problem is that /e causes the *entire* replacement string to be
evaluated as an expression, and while &function($2) is a valid
expression, you can bet your last bean that $1&function($2)$3 isn't.

Try 

     $VAR =~ s/(abc)__(something)__(def)/&function($1,$2,$3)/eg;

and then have &function return your desired replacement string.
All will then be happy.


-Jon

----------------
Jon Orwant
The Perl Journal
http://tpj.com/





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

Date: Mon, 3 Feb 1997 17:59:59 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: URL Encoding
Message-Id: <E51Gnz.7EH@nonexistent.com>

On 01 Feb 1997 22:11:22 GMT, Jeffrey wrote in comp.lang.perl.misc:
++ 
++ [mail and post]
++ 
++ Neal Kaiser <icculus@student.umass.edu> wrote:
++ |> How would I ENCODE a URL, much like the way netscape does when your
++ |> form input type is GET??
++ |
++ |> But, I can't seem to reverse this to encode it.  I know how to reverse
++ |> the first step, but the second one is giving me problems.
++ 
++ I use:
++     $text =~ s/([^\w])/sprintf("%%%02x", ord($1))/ge;
++ 
++ It's a bit overzealous in that it encodes things that don't need to be, but
++ it doesn't hurt.

Oh sure it *does* hurt. Some characters do have a special meaning, and
need to be escaped if and only if their meaning is not special. The most
obvious characters which do have a special meaning are / and ?. But also
think about the first : or a #.

++                  To leave other things unencoded, just add them to the
++ negated character class (ease of adding is why I didn't just use \W in the
++ first place).

Please refer to RFC 1738 to see which characters do have a special meaning.



Abigail



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

Date: Mon, 03 Feb 1997 11:51:42 -0600
From: lhollman@nicom.com
Subject: Using Perl module installed in personal area
Message-Id: <854991347.28068@dejanews.com>

I'm attempting to utilize the LWP module, and have installed it in my
personal area since I do not have access to the /usr/local/lib area.  In
order to use this module in a test script, I've tried using each of the 2
following lines to point 'use' directives at my local copy of LWP to no
avail:

1)  push (@INC, $ENV{'HOME'}."/lib");  #c/o Tom Hukins
2) use lib "/home/lhollman/LWP";  #c/o Randal Scwartz in Web Techniques

Both lead to the following error messages:

Can't locate LWP/UserAgent.pm in @INC at test.pl line 8.
BEGIN failed--compilation aborted at test.pl line 8.

Any help is greatly appreciated.

Lance Hollman

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


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

Date: 3 Feb 1997 18:15:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Using Perl module installed in personal area
Message-Id: <5d5a0l$n1p@news-central.tiac.net>

In article <854991347.28068@dejanews.com>,  <lhollman@nicom.com> wrote:
>I'm attempting to utilize the LWP module, and have installed it in my
>personal area since I do not have access to the /usr/local/lib area.  In
>order to use this module in a test script, I've tried using each of the 2
>following lines to point 'use' directives at my local copy of LWP to no
>avail:
>
>1)  push (@INC, $ENV{'HOME'}."/lib");  #c/o Tom Hukins
>2) use lib "/home/lhollman/LWP";  #c/o Randal Scwartz in Web Techniques
>
>Both lead to the following error messages:
>
>Can't locate LWP/UserAgent.pm in @INC at test.pl line 8.
>BEGIN failed--compilation aborted at test.pl line 8.

Where exactly is the file UserAgent.pm?  Assuming that $ENV{'HOME'} is
/home/lhollman then:

  push (@INC, $ENV{'HOME'}."/lib");
  use LWP::UserAgent;

would try to use /home/lhollman/lib/LWP/UserAgent.pm *if* you put the push
in a BEGIN block, as the use happens during the "compile" phase but the
push happens later at runtime...

  use lib "/home/lhollman/LWP";
  use LWP::UserAgent;

would look for /home/lhollman/LWP/LWP/UserAgent.pm, maybe you meant to say

  use lib "/home/lhollman/lib";
  use LWP::UserAgent;

which will get /home/lhollman/lib int @INC before looking for
LWP/UserAgent.pm

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 3 Feb 1997 18:02:12 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Using Perl module installed in personal area
Message-Id: <5d5974$es1@fridge-nf0.shore.net>

lhollman@nicom.com wrote:
: I'm attempting to utilize the LWP module, and have installed it in my
: personal area since I do not have access to the /usr/local/lib area.  In

Did you run perl Makefile.PL and after "making, " run make install 
to put the modules in the correct places?

I use:

BEGIN
{
  unshift(@INC, "/path/to/lib");
}
use lib; ### lib is the name of the module


--
N Patwardhan
nvp@shore.net
[news:alt.fan.jwz]


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

Date: Mon, 3 Feb 1997 10:33:11 -0800
From: "D. M. Johnson" <ez045864@peseta.ucdavis.edu>
Subject: using putpwent
Message-Id: <Pine.GSO.3.95.970203103230.21969A-100000@bullwinkle.ucdavis.edu>

Anyone know the syntax for using putpwent???  The man page is not much
help.  Thanks.



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

Date: 3 Feb 97 17:30:12 GMT
From: "Bruce Tabor" <keys101@westworld.com>
Subject: What htm line(s) needed to kick back print "test" from .pl
Message-Id: <01bc11f6$853b1500$7805d5cf@keys101>

Can't get a message back.  Is there something obvious to your eyes?  

* Is my htm code to kick off the process correct?  Is there another way to
trigger the server based perl program when the only
  thing going to the server is simply a request to spit back a line of
prepared text?
* Is my test.pl correct
* Is my placement of the test.pl in the cgi-bin provided me by the ISP the
correct place... generally is that the correct place?

-- my htm code as it now stands

<FORM ACTION="/cgi-bin/test.pl" METHOD="post">
<INPUT TYPE="submit" VALUE="Request Message">

-- my perlmsg.pl located in the cgi-bin provided by the ISP

#!/usr/bin/perl
# test.pl -- simple print of a phrase to test client / ISP / client loop
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>PERLMSG PAGE</TITLE></HEAD>\n";
print "<BODY><CENTER>This is a test.</CENTER></BODY></HTML>\n";
# end of test.pl

Thanks


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

Date: Mon, 03 Feb 1997 18:50:52 GMT
From: dan@spyglass.com (Daniel DuBois)
Subject: Re: What htm line(s) needed to kick back print "test" from .pl
Message-Id: <32fb3183.63707957@news.enteract.com>

On 3 Feb 97 17:30:12 GMT, "Bruce Tabor" <keys101@westworld.com> wrote:
>print "Content-type: text/html\n\n";
>print "<HTML><HEAD><TITLE>PERLMSG PAGE</TITLE></HEAD>\n";
>print "<BODY><CENTER>This is a test.</CENTER></BODY></HTML>\n";

I'm sure this has nothing to do with your problem, but I thought I'd take
this opportunity to point out that the HTTP spec states you should have
\r\n between each HTTP header line.

Some servers will convert your \n-only Content-Type line before sending it,
or will lose the lack-of-\r when they add it to their internal header
structures, but others I suspect will not, so good practise would be
to print "Content-type: text/html\r\n\r\n";

\n-only in the body of the HTML is a different story.  AFAIK, that's
perfectly acceptable, maybe even preferred.

-----
Daniel DuBois, Traveling Coderman        www.spyglass.com/~ddubois


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

Date: 3 Feb 1997 19:10:17 GMT
From: danielh@hpber002.swiss.hp.com  (Daniel Huber)
Subject: Win32::Eventlog.pm write method?
Message-Id: <5d5d6p$dvl@hpber002.swiss.hp.com>

I recognized that there is no write method in Win32::Eventlog.

What is the reason?
Is there a way to write into the NT eventlog? Doesn't have to be in Perl
though, but I would prefer it..

Thanks for a hint

Regards

Daniel


--
Daniel Huber, OSC, Hewlett Packard Switzerland, HP8702, Telnet: 780 3247
SMTP: danielh@swiss.hp.com (Daniel_Huber@HP-Switzerland-om2.om.hp.com)
TELNET: 780 3247 PHONE: +41 31 980 3247 FAX: +41 31 980 3390
If a train station is where a train stops, then what's a workstation?
--- Opinions Expressed Above Are My Own ---


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 888
*************************************

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