[9881] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3474 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 18 12:04:46 1998

Date: Tue, 18 Aug 98 09:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 18 Aug 1998     Volume: 8 Number: 3474

Today's topics:
    Re: Another invocation problem (_does_ seem to be a per (Quentin Fennessy)
    Re: CGI on Browser <ssteward@dreamscapedesign.com>
    Re: Converting to lowecase (Andrew M. Langmead)
    Re: Deleting records from a DB_File. (Greg Bacon)
    Re: Easy one for you. <upsetter@ziplink.net>
    Re: Error output problem. (Tad McClellan)
    Re: exception handling (Greg Bacon)
    Re: exception handling <spencer@umich.edu>
    Re: exception handling (Greg Bacon)
        http://www.nt.person.dk : ALL ABOUT HACKING!!! erasia@my-dejanews.com
    Re: I don't know a mean of script. <jdporter@min.net>
        Inplace Editing <ashley@austin.ibm.com>
    Re: Inplace Editing (Greg Bacon)
        Javascript 2 Perl <mokarram@nauta.es>
        Julian Date ywang@maingate.net
    Re: Julian Date <burt@netonecom.net>
        LWP::UserAgent and Cookies (Christian Lackas)
    Re: MD5 and perl <jdporter@min.net>
        need help in using perl in windows for the first time. <padjo@nirvanet.fr>
    Re: NT: redirect stdout to file (Gerhard Wrodnigg)
    Re: pattern matching with uc and lc <jdporter@min.net>
    Re: Pattern substitution using perl (Tad McClellan)
    Re: PERL Problem (//ryb)
    Re: Perl version dave@mag-sol.com
        print "Content-type:text/html\n\n"; and redirection... <simon@new-mediacom.com>
        quotemeta (Patrick Clauberg)
    Re: quotemeta (Greg Bacon)
    Re: Recommend a good editor <timn3508@aol.com>
        regexp does'nt work <m.kaiser@sz-sb.de>
    Re: regexp does'nt work (Greg Bacon)
        request for comments... <webmaster@fccjmail.fccj.cc.fl.us>
    Re: Socket buffering problem (Andrew M. Langmead)
    Re: Strange behavior with 'use' <jdporter@min.net>
    Re: Substituting patterns using perl 5 (Tad McClellan)
        taint and debug <spencer@umich.edu>
        Taught Perl <dgris@rand.dimensional.com>
    Re: Trouble with perl invocation line (from Camel) (Clinton Pierce)
    Re: Win32::Console For Password Entry <aperrin@mcmahon.qal.berkeley.edu>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 18 Aug 1998 14:51:54 GMT
From: qpf@pentagon.io.com (Quentin Fennessy)
Subject: Re: Another invocation problem (_does_ seem to be a perl problem!)
Message-Id: <6rc4ea$at3$1@hiram.io.com>

In article <r8iujrnow5.fsf@asc.sps.mot.com>,
Martin Gregory  <mgregory@asc.sps.mot.com> wrote:
> [snip]
>The first one executes as I would expect: it echoes -w -S and the invocation.
>
>The second one says:
> -w: bad option(s)
>
>Why is this so?  It appears that the fact that perl is on the
>invocation line causes something strange to happen?

Martin, your second script is not being run by your perl interpreter.
>From perlrun(1):
   
       #!/bin/sh -- # -*- perl -*- -p
       eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
           if $running_under_some_shell;
   
   to let Perl see the B<-p> switch.
   
   If the #! line does not contain the word "perl", the program named after
   the #! is executed instead of the Perl interpreter.  This is slightly
   bizarre, but it helps people on machines that don't do #!, because they
   can tell a program that their SHELL is /usr/bin/perl, and Perl will then
   dispatch the program to the correct interpreter for them.
   
See perlrun(1) for more details.
   
-- 
Quentin Fennessy
'94 R BS 66


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

Date: Tue, 18 Aug 1998 09:48:37 -0500
From: Steve Steward <ssteward@dreamscapedesign.com>
Subject: Re: CGI on Browser
Message-Id: <35D99445.83C6CEF6@dreamscapedesign.com>

Geez, Bob.  It looks like you need to learn your tech terms.  Technically, while not
totally accurate, the ikarydis@my-dejanews.com is right.  Perl scripts don't run
client side when you refer to client/server side relationships.  Granted, Perl can
run on almost any platform but if you run it locally, it's no longer considered a
client.  Before you go off on someone, make sure you know your terminology.

However, you are correct in that you don't need a server to run Perl, but again he
was correct when he said you need a server to run CGI.  If you run Perl locally, it
isn't really CGI now, is it?

Bob Trieger wrote:

> [ posted and mailed ]
>
> ikarydis@my-dejanews.com wrote:
> -> Perl Scripts do not run on the client side, i.e Netscape Navigator or
> -> Explorer but on the server side.
>
> The above is false! Perl scripts run fine on just about any client.
>
> -> What you need to do is either i)send the
> -> script to your ISP to install it in the cgi-bin directory or ii) install a
> -> web server on your machine, such as Peer Web Services or Internet Information
> -> server if you use Windows NT, or Apache if you use Unix. You can also try the
> -> Personal Web Server on Windows 95 but I'm not sure if it supports CGI.
>
> Once again false. If you use CGI.pm (as everyone that knows what they are
> doing, does) you can test your cgi scripts without using a browser and web
> server.
>
> HTH
>
> Bob Trieger
> sowmaster@juicepigs.com
> " Cost a spammer some cash: Call 1-800-400-1972
>   Ext: 1949 and let the jerk that answers know
>   that his toll free number was sent as spam. "



--
---------------------------------------
Steve Steward
Technical Director
ssteward@dreamscapedesign.com
---------------------------------------
http://www.dreamscapedesign.com
---------------------------------------




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

Date: Tue, 18 Aug 1998 14:28:01 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Converting to lowecase
Message-Id: <Exw2uq.L2n@world.std.com>

rjk@coos.dartmouth.edu (Ronald J Kimball) writes:

>Grant Griffin <grant.griffin@nospam.com> wrote:

>> There once was a park [...]

>Hey, forget this stupid park, who wants to go to the beach?

C'mon Ronald. At the beach there is sun. You wouldn't want to lose
that pale complexion that you've worked so hard to achieve. (After
all, you were the one who shot down the idea of a Boston Perl Mongers
cookout.)
-- 
Andrew Langmead


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

Date: 18 Aug 1998 14:13:54 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Deleting records from a DB_File.
Message-Id: <6rc272$rfm$11@info.uah.edu>

In article <01bdcaaf$a82c3940$3f8a63a1@amervw29436.clv.am.bp.com>,
	"Joe Foose" <foosejm@bp.com> writes:
: delete $hash{key1}{key2}{key3};
[where %hash is tied to MLDBM]

Read the BUGS section of the MLDBM manpage.

Greg
-- 
Sam:  What's new, Normie? 
Norm: Terrorists, Sam. They've taken over my stomach. They're demanding beer. 


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

Date: 18 Aug 1998 15:34:12 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Easy one for you.
Message-Id: <6rc6tk$31q@fridge.shore.net>

Kelly Hirano <hirano@Xenon.Stanford.EDU> wrote:
: In article <6raop4$rq2$1@client3.news.psi.net>,
: Abigail <abigail@fnx.com> wrote:
:>
:>That won't work.
:>

: whoops, my bad. should be:

: my @array = split(/\|/, $line);

Yet another reason why it's better to read the docs than post to Usenet.

--Art

--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Tue, 18 Aug 1998 09:47:47 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Error output problem.
Message-Id: <j64cr6.ch3.ln@metronet.com>

Jason Murray (jmurray@tibco.com) wrote:
: I am writing a script to log in to a list of machines on my network and
: execute a command.  Some machines are a diffrent flavor of unix and
: fail.  When the command succeds I use:

: $results = `rsh $machine  <command>` and get the results in the variable
: $results.

: When the command fails I don't get the error in $results.  Can anyone
: tell me how I can get the error.  So I can rexecute the command with
: diffrent options.


   Yes, the documentation that you got along with the perl
   distribution can tell you.

   Backticks are an I/O operator, so the section "I/O Operators"
   in the perlfunc man page would be a good place to check...


   ... sure enough, there it is:

   "The status value of the command is returned in ..."


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 18 Aug 1998 14:10:45 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: exception handling
Message-Id: <6rc216$rfm$10@info.uah.edu>

In article <6rbulm$vme$1@nnrp1.dejanews.com>,
	huntersean@hotmail.com writes:
: You want to look at using eval { } and die to catch and throw exceptions
: respectively.

This isn't what he wants.  He's after a means of exception handlers
automatically being invoked.  Perl doesn't (yet) have this capability.

I wonder if you could do it with a $SIG{__DIE__} handler...

Greg
-- 
Just because I don't care doesn't meant I don't understand. 
    -- H.J.S.


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

Date: Tue, 18 Aug 1998 11:33:43 -0400
From: Spencer W Thomas <spencer@umich.edu>
Subject: Re: exception handling
Message-Id: <35D99ED7.2D69ECFE@umich.edu>

Greg Bacon wrote:

> : You want to look at using eval { } and die to catch and throw exceptions
> : respectively.
>
> This isn't what he wants.  He's after a means of exception handlers
> automatically being invoked.  Perl doesn't (yet) have this capability.
>

It is (probably) what he wants, assuming he wants processing in the module to
be interrupted when the exception occurs (whether because of a perl run-time
error or because an exception is thrown by "die").

"eval "returns undef if there was an error executing the expression, then you
can look at $@ to get the error message.  The hard part is figuring out from
the error message just *what* it was that happened.

For example, I have code that emulates the Java ResourceBundle class.  It
first attempts to load a package of the appropriate name.  If this fails
because the ".pm" file does not exist, it then looks for a ".properties" file
and loads it with the PropertyResourceBundle class.  Here's the relevant
piece of code.


    # Try to load it as a module.
    # Use eval to catch "not found" error.
    # Need to translate "slash" notation of path into "::" notation of packages.
    my $basePkg = $basePath;
    $basePkg =~ s@/@::@g;
    eval "require " . $basePkg . $localeExt;
    my $err = $@;    # Copy error message so debugger won't stomp on it

    if ( $err eq "" )
    {
        # Success, instantiate an instance of the object.
        $obref = eval $basePkg . $localeExt . "->new()";
    }
    elsif ( $err =~ /Can\'t locate \Q$basePath/ )
    {
        # Search for the file in @INC.
        my $inc;

        foreach $inc ( ".", @INC )
        {
            if ( open(PROP, $inc . "/" . $basePath . $localeExt . ".properties") )
            {
                $obref = PropertyResourceBundle->new(\*PROP);
                close(PROP);
                last;
            }
        }
    }

--
=Spencer W. Thomas      |  JSTOR, 301 E. Liberty, Suite 310
 School of Information  |  Univ of Michigan, Ann Arbor, MI 48104-2262
spencer@umich.edu       |  313-998-9104, FAX 313-998-9113





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

Date: 18 Aug 1998 15:52:35 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: exception handling
Message-Id: <6rc803$rfm$14@info.uah.edu>

In article <35D99ED7.2D69ECFE@umich.edu>,
	Spencer W Thomas <spencer@umich.edu> writes:
: It is (probably) what he wants, assuming he wants processing in the
: module to be interrupted when the exception occurs (whether because of
: a perl run-time error or because an exception is thrown by "die").

You fail to understand.  In the example you gave, no code is being
called by perl.  Yes, it is possible to catch and throw exceptions
with eval and die, but this is not the same as exception handlers
being called automatically.  In that sort of situation, you'd define
some sub and somehow indicate that it handles certain exceptions.
If perl were to encounter that type of exception, it would stop and
call the handler.

This is not the way things work now, although there have been proposals
to bring this sort of functionality into Perl.

Greg
-- 
The surest sign that intelligent life exists elsewhere in the universe is that
it has never tried to contact us. 
    -- Calvin


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

Date: Tue, 18 Aug 1998 14:36:48 GMT
From: erasia@my-dejanews.com
Subject: http://www.nt.person.dk : ALL ABOUT HACKING!!!
Message-Id: <6rc3i1$6j4$1@nnrp1.dejanews.com>

The new plaza with over 750 files and in the end of the week, more than
1000!!!!

http://www.nt.person.dk the place where BLaZTeRZ stay with EWF!!!!

CYA
BLaZTeRZ

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


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

Date: Tue, 18 Aug 1998 10:46:36 -0400
From: John Porter <jdporter@min.net>
Subject: Re: I don't know a mean of script.
Message-Id: <35D993CC.4BBD@min.net>

Cabin Drop wrote:
> 
> Explain the following scriptor;
>[snip]

'Fraid not.

A. You didn't write it.
B. It's bogus, and doesn't do anything anyway.
C. Learn Perl.  We'll help.

-- 
John Porter


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

Date: Tue, 18 Aug 1998 09:55:47 -0500
From: Ashley Rosilier <ashley@austin.ibm.com>
Subject: Inplace Editing
Message-Id: <35D995F3.87FF20F1@austin.ibm.com>

Ok, I'm having a heck of a time finding the documentation
on how to do inplace editing of a file. I left my good
book at home :-/

can anyone point me to some doucmentation (other than the
$^I predefined variable!) or better yet, an example?

Many thanks,
Ashley

-- 

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Ashley Rosilier				IBM Microelectronics
ashley@austin.ibm.com			World Wide Design Center
(512) 838-8391
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>


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

Date: 18 Aug 1998 15:55:59 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Inplace Editing
Message-Id: <6rc86f$rfm$15@info.uah.edu>

In article <35D995F3.87FF20F1@austin.ibm.com>,
	Ashley Rosilier <ashley@austin.ibm.com> writes:
: Ok, I'm having a heck of a time finding the documentation
: on how to do inplace editing of a file. I left my good
: book at home :-/

    % perl -i.bak -pe 's,\bfile\.gif\b,dir/file.gif,g' \
      `find . -name '*.html' -print`

Greg
-- 
I considered atheism but there weren't enough holidays.


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

Date: Tue, 18 Aug 1998 17:32:33 +0200
From: mario mokarram <mokarram@nauta.es>
Subject: Javascript 2 Perl
Message-Id: <35D99E91.CB77A79A@nauta.es>

Hi everyone,

                    Can anybody tell me if there is a way to pass a
Javascript variable to a perl script. By a variable, I mean for
example for the perl script to be able to display (from the Jscript)
$VARIABLE=HISTORY.GO(-3) and then (to the Perl)
PRINTF " BEFORE COMING HERE YOU WERE IN $VARIABLE.";  I would be
greatfull if someone can save me frrom
reinventing the wheel.

Cheers,

                                    Mario
(PS, please email me at mokarram@nauta.es)



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

Date: Tue, 18 Aug 1998 14:35:03 GMT
From: ywang@maingate.net
Subject: Julian Date
Message-Id: <6rc3en$633$1@nnrp1.dejanews.com>

Hi,

Could anyone please tell me how to generate the Julian Date in Perl?

Thanks a lot. Please cc your answer to ywang@maingate.net.

Y. Wang

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


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

Date: Tue, 18 Aug 1998 11:04:03 -0400
From: Burt Adsit <burt@netonecom.net>
Subject: Re: Julian Date
Message-Id: <35D997E3.5C86C19B@netonecom.net>

$current_century=20;

# Usage:  $julian_day = &jday($month,$day,$year)
# Takes m,d,y and returns a julian
#
sub jday
{
  local($m,$d,$y) = @_;
  local($ya,$c,$cc);

  return ("") if ($y eq "");

  if (length($y)!=4)
  {
    $cc=$current_century-1;
    $y="$cc"."$y";
  }


  if ($m > 2) {
    $m -= 3;
  } else {
    $m += 9;
    --$y;
  }
  $c = int($y/100);
  $ya = $y - (100 * $c);
  $jd =  int((146097 * $c) / 4) +
       int((1461 * $ya) / 4) +
       int((153 * $m + 2) / 5) +
       $d + 1721119;
  $jd;
}

ywang@maingate.net wrote:
> 
> Hi,
> 
> Could anyone please tell me how to generate the Julian Date in Perl?
> 
> Thanks a lot. Please cc your answer to ywang@maingate.net.
> 
> Y. Wang
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 18 Aug 1998 16:33:00 +0100
From: Christian.Lackas@POST.rwth-aachen.de (Christian Lackas)
Subject: LWP::UserAgent and Cookies
Message-Id: <6-4BU4l7DZB@delta.post.rwth-aachen.de>


Hello,

I want to send a cookie via LWP::UserAgent to a server.

I've tried to load some cookies from my netscape cookie-file and to  
generate one on my own.
But I don't know how to use the method cookie_jar from UserAgent.
Can someone please give me a short example?


#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use HTTP::Cookies;
# Cookies:
my $cookie_jar = HTTP::Cookies::Netscape->new (
                   File     => "./cookies"
                 );
my $target_uri = "http://willow.lns/cgi-bin/printenv";
my $ua  = new LWP::UserAgent;
$ua->agent("dbot ".$ua->agent);
$ua->cookie_jar($cookie_jar);
my $req = new HTTP::Request(GET => $target_uri);
$cookie_jar->add_cookie_header($req);
$cookie_jar->set_cookie(3,"DUMMY","DUMMYDATA","/","localhost",
             "",0,0,2000,0,undef);
$cookie_jar->save("./dummy.tst"); # This file is alway empty :-(

my $res = $ua->request($req);
if ($res->is_success) {
  print $res->content;
} else {
  print "Bad luck this time\n";
}


Dewa mata
 Christian

p.s. printenv prints all elements of %ENV. But there is never a  
HTTP_COOKIE...
---
http://come.to/delta
Jeder kann denken - aber vielen bleibt es erspart.



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

Date: Tue, 18 Aug 1998 10:38:12 -0400
From: John Porter <jdporter@min.net>
Subject: Re: MD5 and perl
Message-Id: <35D991D4.7F89@min.net>

Brian Tiemann wrote:
> 
> I'm kind of surprised that MD5.pm is as prevalent as it is, since
> it seems to me that perl's entire philosophy is oriented towards
> platform-independence and no precompiled code. 

No, that isn't Perl's entire philosophy.
Part of Perl's philosophy is to be able to glue together
bits of code written in other languages.
And C is rather portable too, so it makes a natural choice
for writing the bits of code that need to be fast.

-- 
John Porter


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

Date: Tue, 18 Aug 1998 16:55:35 +0100
From: Pat Collins <padjo@nirvanet.fr>
Subject: need help in using perl in windows for the first time.
Message-Id: <35D9A3F7.FB7@nirvanet.fr>

Hi there people. I installed perl on my laptop. I have a book on Perl 
programming that seems to be good but it does not tell me how
to write a file in win 95 save it as .what and how to run it. I'd really
appreciate some help.
 
pat;
Ireland


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

Date: Tue, 18 Aug 1998 14:08:32 GMT
From: ghw@gmx.net (Gerhard Wrodnigg)
Subject: Re: NT: redirect stdout to file
Message-Id: <36358ada.455388804@news.tu-graz.ac.at>

HaY!

On Tue, 18 Aug 1998 10:48:43 +0200, Ian Maloney <ian.maloney@ubs.com>
wrote:

>Try this, it works for me:
>perl sample.pl >output.txt

Yea4h! It works! ;)

TX 4 help!!! ;)

> - but if you do find out let me know.

ok, promised ;)

 -mfg-ghw-
-- 
In a world without walls and fences, who needs windows and gates?


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

Date: Tue, 18 Aug 1998 10:56:02 -0400
From: John Porter <jdporter@min.net>
Subject: Re: pattern matching with uc and lc
Message-Id: <35D99602.17CB@min.net>

julzrulz@my-dejanews.com wrote:
> 
> if (!open(LIST, "../list.pl")){
>     print "can't open file";
>    }

Bug. You should have an exit (or return, or goto, or 
something) in the block that gets executed if the file 
doesn't open.
You should also always include $! in the error message,
so you get some idea why the open failed.  And include
the file name too.  (No point in being cheap.)

	if (!open(LIST, "../list.pl")){
		print "can't open file  ../list.pl: $!";
		exit 1;
	}

Of course, the standard perl idiom for opening files is:

	$file = '../list.pl';
	open(LIST,$file) or die "can't open $file: $!";

-- 
John Porter


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

Date: Tue, 18 Aug 1998 09:55:50 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Pattern substitution using perl
Message-Id: <ml4cr6.5l3.ln@metronet.com>

[ Please don't post the same question more than once ]


zaxaz@my-dejanews.com wrote:
: I am trying to substitute leading and trailing double quotes from each line in
: a numbe of files. Is this something easily accomplished using perl. 


   Yes. [ I assume that is a question. You left off the question mark. ]


: I would
: like to substitute the pattern then rewrite each file in sequence.


   No problem. Just go ahead and write a program to do that.


   For how to use regular expressions, see the 'perlop' and 'perlre'
   man pages that you got along with your perl distribution.


   For rewriting the files see the Perl FAQ, part 5:

      "How do I change one line in a file/
       delete a line in a file/
       insert a line in the middle of a file/
       append to the beginning of a file?"

   Note also the -i switch documented in the 'perlrun' man page.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas

perl -w -p -i.bak -e 's/^"//; s/"$//;' filenames...



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

Date: Tue, 18 Aug 1998 15:29:30 GMT
From: mike@@@masterlinkREMOV.com (//ryb)
Subject: Re: PERL Problem
Message-Id: <753CBFDB125E79FE.49C3CCCD6AF73865.38324CD37C2D8DA5@library-proxy.airnews.net>



Only PERL stops.  All other processes on the machine continue to run.
I'll look deeper into the programs.

Thanks for your suggestions.


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

Date: Tue, 18 Aug 1998 15:29:06 GMT
From: dave@mag-sol.com
Subject: Re: Perl version
Message-Id: <6rc6k2$as3$1@nnrp1.dejanews.com>

In article <35D930D5.5BC70783@wanadoo.fr>,
  cogelog@wanadoo.fr wrote:
> I don't know exactly my Perl version. Where can I find it?

perldoc perlrun


--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

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


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

Date: Tue, 18 Aug 1998 14:52:27 +0100
From: Simon Wistow <simon@new-mediacom.com>
Subject: print "Content-type:text/html\n\n"; and redirection...
Message-Id: <645CAC0140CED111AF1500805FEDDB8A97F8@ns.new-mediacom.co.uk>

IIS is very picky, try putting this in instead

print "HTTP/1,0 200 OK\n";
print "Content-type: text/html\n\n";

> -----Original Message-----
> From:	Wouter Hermans [SMTP:whermans@mail.dma.be]
> Posted At:	Tuesday, August 18, 1998 10:53 AM
> Posted To:	misc
> Conversation:	print "Content-type:text/html\n\n"; and redirection...
> Subject:	print "Content-type:text/html\n\n"; and redirection...
> 
> hi
> 
> for some weird reason "Content-type:text/html" shows up in my browser
> when i
> run a perl script on a microsoft iis3 server.  don't know if it
> happens on
> unix servers...
> 
> also: i'm trying to read in a value (=url) from a form, and then let
> the cgi
> relink the user through to that url.  any ideas?
> 
> heh ok i admit i'm new at this...
> 
> wouter hermans
> 



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

Date: Tue, 18 Aug 1998 15:09:09 GMT
From: pat@uni.de (Patrick Clauberg)
Subject: quotemeta
Message-Id: <35da9581.24997327@news.nef.wh.uni-dortmund.de>

Hi everybody,

my problem:

I want to analyse filenames and build a database with certain
information.
acually I have mp3 files like artist # song.mp3 and want to get artist
and song into my database

therefore I use a regexp to split the filenames

if ($file =~ /^(\w+\s+.*)+\s*#\s*(\w+\s*.*).mp3/) {

unfortunately, some filenames contain (, {, ), } , which sometimes
kills my regexp (something with "unmatched ( ...." )

Now, I found the quotemeta function and at least my regexp is not
being smashed by some files.

Unfortunately, the regexp doesn't seem to match any longer.

If it would, I still had the names with all the \ in it.

Is there anything like unquotemeta? (well, there isn't, but how can I
do it? )


Thanx

Patrick





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

Date: 18 Aug 1998 15:58:56 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: quotemeta
Message-Id: <6rc8c0$rfm$16@info.uah.edu>

In article <35da9581.24997327@news.nef.wh.uni-dortmund.de>,
	pat@uni.de (Patrick Clauberg) writes:
: I want to analyse filenames and build a database with certain
: information. acually I have mp3 files like artist # song.mp3 and want
: to get artist and song into my database

Just use split:

    $_ = "NWA # Straight-Outta-Compton.mpg";
    my($artist,$file) = split /\s*#\s*/, 

Greg
-- 
Convictions are more dangerous enemies of truth than lies.
    -- Nietzsche


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

Date: Tue, 18 Aug 1998 10:56:28 -0400
From: "Tim Nicholson" <timn3508@aol.com>
Subject: Re: Recommend a good editor
Message-Id: <35d9976c.0@news>

And there's the best editor in the whole wide world - Slick Edit.  Worth the
price.

http://www.slickedit.com


Allan Chandler wrote in message <35D91B80.D8FB723D@nowhere.com>...
>Tom Christiansen wrote:
>> In comp.lang.perl.misc, "Steve Bohler" <skbohler@sprynet.com> writes:
>> :I've searched through previous posts, but am not finding a
recommendation
>> :for an easy-to-use Perl editor that runs on Windows.  I've used emacs
>> :before, but was wondering if there was something better.
>
>You probably won't find anything 'better' than emacs since it's
>everything you need in a editor/wordprocessor/newsreader/psychoanalyst.
>I'm not sure how cut-down the versions would have to be to run under
>Windows.
>
>>
>> Probably not, but you could try vi(m).  It's easier in some ways,
>> harder in others.
>
>Yes, this is probably my first choice for a text editor.  And you'll be
>able to re-use the skills you'll learn when you upgrade from Windows to
>an operating system :-).
>
>>
>> But don't expect to find a `Windows product' that can compare with
>> either of them.
>
>Actually, vim runs fine under Win32 (and the gvim has syntax
>highlighting as well).
>
>AllanC.




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

Date: Tue, 18 Aug 1998 16:53:42 +0200
From: "Markus Kaiser" <m.kaiser@sz-sb.de>
Subject: regexp does'nt work
Message-Id: <6rc4i2$4b7$1@hades.rz.uni-sb.de>

Hello out there,

can anyone tell me why the following
regexp won't work ?

Thanks a lot in advance
Markus

Markus Kaiser (mak@dfki.de)
Malstatter Str. 4, 66117 Saarbruecken, Germany
Phone +49 681 92630-0, Fax +49 681 92630-15

--
s{ <
    (
       [^>'"] *  |  # anything but >, ', "
        ".*?"    |  # section between double quotes
        '.*?'       # section between single quotes
    ) +
   >
}{}gsx;

Perl stops executing and displays
"s/: regexp *+ operand could be empty at ./stripHTML.pl
line 44."

(Yes, you guessed right. It's a piece of Tom Christians
(sample) code.)





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

Date: 18 Aug 1998 15:24:54 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: regexp does'nt work
Message-Id: <6rc6c6$rfm$12@info.uah.edu>

In article <6rc4i2$4b7$1@hades.rz.uni-sb.de>,
	"Markus Kaiser" <m.kaiser@sz-sb.de> writes:
: can anyone tell me why the following
: regexp won't work ?

[snip]

: s{ <
:     (
:        [^>'"] *  |  # anything but >, ', "
:         ".*?"    |  # section between double quotes
:         '.*?'       # section between single quotes
:     ) +
:    >
: }{}gsx;
: 
: Perl stops executing and displays
: "s/: regexp *+ operand could be empty at ./stripHTML.pl
: line 44."

You should be able to just take out the star, or you could add
pluses to the subpatterns like

    s{ <
        (
          [^>'"] +  |  # anything but >, ', "
          ".*?"  +  |  # section between double quotes
          '.*?'  +     # section between single quotes
        )
       >
     }{}gsx;

The reason Perl warns about possibly empty subpatterns is because
they can take forever (or at least a very long time) to fail.  jfriedl
goes over this in his book, _Mastering Regular Expressions_.  Perl
regular expression engines haven't always spotted this, and Tom's code
probably predates those checks.

Greg
-- 
Artifical insemination is when the farmer does it to the cow instead of the
bull. 
    -- Funny Answers to Science Test Questions


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

Date: Tue, 18 Aug 1998 11:42:46 -0400
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccjmail.fccj.cc.fl.us>
Subject: request for comments...
Message-Id: <35D9A0F6.16953101@fccjmail.fccj.cc.fl.us>

A random password genrator...
(More or less...)

#!/usr/bin/perl -w

use strict;
use diagnostics;

# Digit Place...
my $first;
my $second;

# General Counters...
my $x;
my $y;

# Test Password
my $pw = "Password";

# Program control...
while(1) {
  $first  = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));
  $second = (((rand(time)) >> (11 + 1 - 8)) & ~(~0 << 7));

  last if ($x++ > (16*((2**31)-1)));
  # print "$first $second\n";

  next unless chr($first)  =~ /^-?[a-zA-Z0-9]+$/;
  next unless chr($second) =~ /^-?[a-zA-Z0-9]+$/;
  
  print "Trying: ", crypt($pw, ("".chr($first).chr($second)."")), "\n";
}

Comments welcome,
-Sneex-  :]
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
http://www.fccj.org/cgi/mail?webmaster | http://webmaster.fccj.org/Webmaster


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

Date: Tue, 18 Aug 1998 14:31:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Socket buffering problem
Message-Id: <Exw30z.1KB@world.std.com>

Low Cheng Hong <chlow@crtc.corp.mot.com> writes:

>print NEW_SOCKET "prompt > ";
>...

>However the second print message wasn't delivered to the client since it
>doesn't contains "\n".
>How do I turn off socket buffering?

Are you sure that the buffering that you are seeing isn't on the side
reading the socket? (Are you using the readline operator <> on the
other side? Maybe you should try fcntl() with O_NONBLOCK and
sysread())

-- 
Andrew Langmead


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

Date: Tue, 18 Aug 1998 11:34:36 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Strange behavior with 'use'
Message-Id: <35D99F0C.1FD2@min.net>

Martien Verbruggen wrote:
> 
> [use Module] is exactly equivalent to
> 
>     BEGIN { require Module; import Module LIST; }
> ...
> Otherwise, demands that a library file be included if it
> hasn't already been included.
> 
> 'if it hasn't already been included.'

My understanding is that only applies to the require, not to the
import.  And evem when I tried adding an explicit call to import,
it made no difference: package b still didn't get the exports 
from package a.  I know the import was getting called; it just 
didn't seem to do its job right.
OTOH, if I put the import call *inside* sub testb, then it
worked.

-- 
John Porter


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

Date: Tue, 18 Aug 1998 09:57:53 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Substituting patterns using perl 5
Message-Id: <hp4cr6.5l3.ln@metronet.com>

zaxaz@my-dejanews.com wrote:
: I am attempting to replace leading and trailing double-quotes in a series of
: files. I would like to use a regular expression like s/^\"//g and s/\"$//g to
: remove these quotes from each line.


   If you have not changed the $/ special variable, then you don't
   need the 'g' modifier...

   And in either case, you do not need to escape the double quotes.



: Is this easily accomplished by opening reading and rewriting each file?


   What happened when you tried it?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 18 Aug 1998 11:41:01 -0400
From: Spencer W Thomas <spencer@umich.edu>
Subject: taint and debug
Message-Id: <35D9A08D.4233AEE0@umich.edu>

Is there any way to reasonably debug a taint-checked program?  Since the
perl debugger runs within the perl interpreter, any tainted reference
stops the whole thing, without even the opportunity to print a stack
trace.  What a *pain*!  The debugger functionality is severely
compromised, since command line input is considered tainted.  You can't
even print the value of a variable without getting a taint exception!
Sheesh!

--
=Spencer W. Thomas      |  JSTOR, 301 E. Liberty, Suite 310
 School of Information  |  Univ of Michigan, Ann Arbor, MI 48104-2262
spencer@umich.edu       |  313-998-9104, FAX 313-998-9113





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

Date: Tue, 18 Aug 1998 14:59:31 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Taught Perl
Message-Id: <6rc43n$1m1$1@rand.dimensional.com>

Hey, all.  A couple of weeks ago I asked for some advice
and input on effective ways to go about teaching perl.
Wow, the response was amazing.  In addition to the
discussion on the newsgroup I received more than 300
messages via email.

I'd just like to report that I taught my first class
yesterday, and that it went very well.  My students
left feeling that they had learned something and
displaying an obvious interest in learning more
perl.  My boss has already asked my to teach the
class again to a bunch of other people from outside
our team.

I couldn't have done it with the help of clpm, and
I just wanted to say thank you, all.

dgris
- Had no idea how _hard_ it could be to try and explain
regular expressions :-).
-- 
Daniel Grisinger           dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
                           Dave Clark


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

Date: 18 Aug 1998 14:25:58 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Trouble with perl invocation line (from Camel)
Message-Id: <199808181426.KAA21898@mailfw1.ford.com>

In article <r8pve0nip5.fsf@asc.sps.mot.com>,
	Martin Gregory <mgregory@asc.sps.mot.com> writes:
>
>In the Blue Camel, under the -S option, it suggests an invocation
>method in place of a #! that should survive most vagaries of operating
>systems.  It looks like this:
>
> eval '(exit $?0)' && eval 'exec /usr/binperl -S $0 ${1+"$@"}' 
>    & eval 'exec /usr/bin/perl -S $0 $argv:q'
>      if 0; 
>
>We have been using a modified version, like this:
>
> eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'  # -*- Perl -*-
>    & eval 'exec perl -w -S $0 $argv:q'
>      if 0; 

[...]

>Unfortunately, this does not work under HPUX's "brilliant" new
>Posix-compliant shell on HPUX 10.20.
>
>Under this shell, when a script containing this invocation method is
>invoked via perl's system() call with metacharacters in the command
>line (hence via an exec, I guess), the resulting sh ends up executing
>the second line and complaining about the & character.

At one point in its life, we actually saw this nonsense with Solaris.
The change occurred when the shell was altered so that the script
to be interpreted came in on a file handle, instead as a reference to 
a file on disk.  (To help get rid of race-conditions.)

#include "fuzzy_flashback.h"

The script was getting exec'd, re-exec'd and in the process the shell
"ate up" the first line of the input (the #! line).  So the subsequent
interpreter was denied the #! line.  For a while, our set-uid perl 
scripts looked like:

	#!/ford/thishost/unix/bin/perl -w
	#!/ford/thishost/unix/bin/perl -w

	print "Hello, world!\n";

And this worked.  We didn't try following the cause to the bitter end
(we had a deadline).  But this fixed it.


-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*


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

Date: Tue, 18 Aug 1998 08:00:30 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: Win32::Console For Password Entry
Message-Id: <35D9970E.CC8665B2@mcmahon.qal.berkeley.edu>

Shawn, I think what's going on amounts to a parentheses problem. You're assigning
the expression:

(($Console->InputChar(1)) OR (die "Error reading character"))

to $key.

Because InputChar() returns the value that was typed on the console, that side
returns 0, which is treated as False by Perl.  Since the first section of the
expression is false, the system is reading to the second half in order to evaluate
your OR (||) expression. I THINK what you really want is this, although I haven't
used the Console module so I'm not entirely sure you'll be able to test for
successful assignment at all:

($key = $Console->InputChar(1)) || die "Error reading character";

shawn_campbell@my-dejanews.com wrote:

> I went to the archives for this solution.  It is exactly what I need.  One
> problem however; if the user
> enters a zero, the line-
>    $key = $Console->InputChar(1) || die "Error reading character";
> fails.  What if my user has a zero in their username or password?
> Note- I have tried every other character on the keyboard, and only the zero
> fails.
>
> Any help would be greatly appreciated.  Also, I am using ActiveState's vs.
> 5.00501, but have also tried it with the GS port.
>
> Thanks,
>
> Shawn Campbell
> shawn.campbell@janus.com (please respond via e-mail, thanks)
>
> >                            Thanks, Aldo!
> >
> >                             That did the trick. Thanks also to everyone else
> that helped. Here's
> >                               my working result:
> >
> >                              use Win32::Console;
> >                               $Console = new Win32::Console(STD_INPUT_HANDLE)
> || die "Error creating
> >                               console";
> >                               $Console->Mode(ENABLE_PROCESSED_INPUT) || die
> "Error setting console
> >                               mode";
> >                               $username = "";
> >                               print("Enter your username: ");
> >                               while(1) {
> >                               $key = $Console->InputChar(1) || die "Error
> reading character";
> >                               if ($key ge "!" and $key le "~") { # ! to ~
> legal
> >                               $username .= $key;
> >                               print("$key");
> >                               } elsif (($key eq "\t" || $key eq "\r") &&
> length($username) > 0) { #
> >                               Tab or Enter
> >                               print "\n";
> >                               last;
> >                               } elsif ($key eq "\b") { # ^H/backspace
> >                               print "\b \b";
> >                               chop $username;
> >                               } elsif ($key eq "\cu") { # ^U/clearline
> >                               print "\b \b" x length $username;
> >                               $username = "";
> >                               } elsif ($key eq "\e") { # escape
> >                               exit 0;
> >                               } else {
> >                               ; # illegal
> >                               }
> >                               }
> >                               $password = "";
> >                               print("Enter your password: ");
> >                               while(1) {
> >                               $key = $Console->InputChar(1) || die "Error
> reading character";
> >                               if ($key ge "!" and $key le "~") { # ! to ~
> legal
> >                               $password .= $key;
> >                               print("*");
> >                               } elsif (($key eq "\t" || $key eq "\r") &&
> length($password) > 0) { #
> >                               Tab or Enter
> >                               print "\n";
> >                               last;
> >                               } elsif ($key eq "\b") { # ^H/backspace
> >                               print "\b \b";
> >                               chop $password;
> >                               } elsif ($key eq "\cu") { # ^U/clearline
> >                               print "\b \b" x length $password;
> >                               $password = "";
> >                               } elsif ($key eq "\e") { # escape
> >                               exit 0;
> >                               } else {
> >                               ; # illegal
> >                               }
> >                               }
> >                               print("Username is $username and Password is
> $password.\n");
>
>   Aldo Calpini wrote:  >  > Tom Cameron wrote:  > >[...]  > >I'm having
> trouble with various aspects of this, mainly the strange  > >behavior of the
> InputChar() function and how it handles a <TAB>. I've  > >written a small
> loop around it, but I'm getting what I expect:  > >  > >use Win32::Console;
> > >  > >$Console = new Win32::Console(STD_INPUT_HANDLE) || die "Error
> creating  > >console";  > >$Console->Mode(ENABLE_LINE_INPUT) || die "Error
> setting console mode";  >  > just add this:  >  >
> $Console->Mode(ENABLE_PROCESSED_INPUT) || die "Error setting console mode";
> >  > (pls don't ask me why, the gory details are in the Microsoft's SDK
> docs).  >  > Bye,  > Aldo Calpini  > <dada@romagiubileo.it>  >  > "Out the
> 10Base-T, through the router,  > down the T1, over the leased line,  > off
> the bridge, past the firewall,  > ...nothing but Net."  > -- (Author unknown)
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum



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




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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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