[8434] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2051 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 8 10:07:17 1998

Date: Sun, 8 Mar 98 07:01:03 -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           Sun, 8 Mar 1998     Volume: 8 Number: 2051

Today's topics:
    Re: Calling a CGI inside another CGI (Brian Lavender)
    Re: Can I open a filehandle on a scalar? schwern@starmedia.net
    Re: Does Perl have equivalents to these C Functions ??? schwern@starmedia.net
    Re: extracting a matched pattern (Jorg Schumacher)
    Re: extracting a matched pattern <ebohlman@netcom.com>
    Re: Good Perl book schwern@starmedia.net
        help file uploading <zero@sg-online.com>
    Re: Help: avoiding eval() on a grep() function. schwern@starmedia.net
        How to check string variable against a number of permis (Terry Carroll)
    Re: How to check string variable against a number of pe <ebohlman@netcom.com>
    Re: is perl 4.0 y2k compliant ? schwern@starmedia.net
    Re: More thoughts on c.l.p.m. <ebohlman@netcom.com>
    Re: multi word unix commands and exec schwern@starmedia.net
    Re: Musings on English.pm schwern@starmedia.net
    Re: Newbies question for Win32 <mahoneys@hunterdon.csnet.net>
        Perl - Beginner question bhendeNOSPAM@ibm.net
    Re: Pw32i302...now this is just plain frustrating! schwern@starmedia.net
    Re: Pw32i302...now this is just plain frustrating! <stackhou@execpc.com>
    Re: Q: obscuring Perl scripts? (John Stanley)
    Re: Q: obscuring Perl scripts? (John Stanley)
    Re: Q: obscuring Perl scripts? <jhi@alpha.hut.fi>
        RegEx help <grimoire@oaktree.net>
    Re: RegEx help (Tom Grydeland)
    Re: RegEx help <Peter.Kruse@psychologie.uni-regensburg.de>
    Re: returning immediately from system call? <ebohlman@netcom.com>
    Re: Tom, grow up [Re: The -w switch (was Re: better way <jbc@west.net>
        Using named array to populate radio group via cgi.pm (keefner)
        Using perl to do what a spreadsheet does but with a pla <oak@crl.OmitThis.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 08 Mar 1998 11:08:28 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: Calling a CGI inside another CGI
Message-Id: <35037aa7.58724376@news.jps.net>

You are going to have to be more specific than that. I have a cgi perl
script which generates html which in turn calls another cgi. CGI is a
gateway and basically it allows you to run another program, PERL,
FORTRAN (Hey there is still a lot of FORTRAN code around), C, or
whatever, and return the results to your web server in a common
format. Check out my mini map server code where you will find what I
am talking about. http://www.brie.com/coinduperl/ as far as one cgi
activating another cgi. Oh yeah, check out
comp.infosystems.www.authoring.cgi . People here don't take too kindly
to a question that has no direct reference to PERL.

Brian
--------------------
Brian Lavender
Sacramento, CA
http://www.brie.com/brian/

"For best results, squeeze from the bottom and flatten as you go up."
             -- Colgate Toothpaste Tube




On Fri, 27 Feb 1998 17:37:28 -0300, fealvar@ctc.cl wrote:

>
>Hi folks.
>I want a CGI in machine X to call a CGI in machine Y.
>
>How is the easiest way to do this?
>
>Please send me e-mail.
>
>Thanks a lot.



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

Date: Sun, 08 Mar 1998 04:18:38 -0600
From: schwern@starmedia.net
To: luis@utdallas.edu
Subject: Re: Can I open a filehandle on a scalar?
Message-Id: <6dtr80$d9l$1@nnrp1.dejanews.com>

Let me see if I read you correctly... you want to do something like...

$string = "Hey!  Wouldn't it be nice if this worked?\nToo bad it doesn't";

string_open( BOGUS_FILE, $string );

print BOGUS_FILE;  # prints "Hey!  Wouldn't it be nice if this worked?"

close BOGUS_FILE;


Guess what.  You can!  Ain't Perl grand?

IO::Scalar (and IO::ScalarArray for arrays) are what you want.
http://www.perl.com/CPAN/modules/by-module/IO/

And yes, I've had reason to do this, too.  Example:

open(FILE, $someFilename) || die $!;

@file = <FILE>;
@processedFile = &DoSomeStuffToFile(@file);

# IO::ScalarArray isn't really called like this, but I don't have the man
# pages handy. :(
$bogus_fh = IO::ScalarArray->new(@processedFile);

# Net::IRC::DCC->send() only accepts filehandles.
Net::IRC::DCC->send($bogus_fh, $someFilename);


In article <6d3u5e$6km@sjx-ixn6.ix.netcom.com>,
  "Luis J. Martinez" <luis@utdallas.edu> wrote:
>
> I want to open a filehandle on a scalar string rather than a file, so I can
> do file operations on it. Is there a way to do this?



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 08 Mar 1998 04:40:23 -0600
From: schwern@starmedia.net
To: mike.schleif@aquila.com
Subject: Re: Does Perl have equivalents to these C Functions ???
Message-Id: <6dtsgo$edg$1@nnrp1.dejanews.com>

Two possiblities.

1)  If RPC is what you're implmenting, there's an example of that in the
"Advanced Perl Programming" book by Sriram.  The example itself is available
from CPAN in Sriram's directory.  http://www.perl.com/CPAN/authors (you're on
your own from there, I can't remember his ID)  The book's worth buying,
though.

2)  Use the POSIX module to gain access to these C functions.  This might
require your running h2ph over your include directories... I'm not sure.  I
haven't meddled in this much.  Something like:

use POSIX qw(htonl getrpcbyname);

$rpc = getrpcbyname($name);

or whatever.  Points you in the right direction, anyway (or maybe just A
direction.)


In article <35022904.6580390@aquila.com>,
  "Michael D. Schleif" <mike.schleif@aquila.com> wrote:
>
> I need to perform the following C functions in Perl:
>
>         htonl()
>
> 	getrpcbyname()
>
> Several other "get ... byname()" functions are mirrored internally to Perl -- I
> can only hope that this is also the case.
>
> Does anybody know of ways to avoid system calls?  If I cannot do getrpcbyname
> internal to Perl, then I will need to make system calls, which almost always
> begs the question, which OS am I on?
>
> For instance, is "rpcinfo," or its equivalent on EVERY system that runs Perl?
> How can I know?  I am building a socket program for a client that must query the
> server, to see which port the rpc registered program is using during this
> session.  The port is dynamically set each time the rpc program starts and is
> different on every server.  Therefore, HOW do I obtain this port information
> dynamically, at the client?
>
> --
>
> Best Regards,
>
> mds
> mds resource
> 888.250.3987
>
> "Dare to fix things before they break . . . "
>
> "Our capacity for understanding is inversely proportional to how much we think
> we know.  The more I know, the more I know I don't know . . . "
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 8 Mar 1998 13:34:45 GMT
From: schumach@uni2a.unige.ch (Jorg Schumacher)
Subject: Re: extracting a matched pattern
Message-Id: <schumach-0803981434300001@129.194.16.70>

In article <350052AB.41C6@btv.ibm.com>, James Crouse <jcrouse@btv.ibm.com>
wrote:

> For some reason I can't find information on extracting a matched pattern
> from a string. With the match operator I get the whole string if the
> pattern matches anywhere. But what if I just want to extract the pattern
> by itself. For instance if there's an integer in a string, how do I get
> that integer into a variable. Any help would be appreciated.
> 
> Thanks,
> 
> James


The system variable $& stores the last match

Jorg Schumacher


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

Date: Sun, 8 Mar 1998 14:20:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: extracting a matched pattern
Message-Id: <ebohlmanEpI7uE.AB9@netcom.com>

Jorg Schumacher <schumach@uni2a.unige.ch> wrote:
: In article <350052AB.41C6@btv.ibm.com>, James Crouse <jcrouse@btv.ibm.com>
: wrote:

: > For some reason I can't find information on extracting a matched pattern
: > from a string. With the match operator I get the whole string if the
: > pattern matches anywhere. But what if I just want to extract the pattern
: > by itself. For instance if there's an integer in a string, how do I get
: > that integer into a variable. Any help would be appreciated.
: > 
: > Thanks,
: > 
: > James


: The system variable $& stores the last match

True, but making use of $& anywhere in a program seriously slows down all 
regexp processing (the interpreter has to do extra bookkeeping every time 
it tries to match a pattern).  Therefore, it's best to avoid $& if 
there's a more efficient way (such as using capturing parens in a pattern).



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

Date: Sun, 08 Mar 1998 03:26:39 -0600
From: schwern@starmedia.net
Subject: Re: Good Perl book
Message-Id: <6dto6i$9r7$1@nnrp1.dejanews.com>

http://perl.ora.com, and the perlbook man page should provide you with some
excellent books.

"Learning Perl" might be a bit too simplistic for you... Nigel Chapman's book,
"Perl: the Programmer's Companion" is held to be the Learning Perl for Real
Programmers (though I haven't read it myself.)

"Effective Perl Programming" is an -excellent- book.  Something of a
combination style/efficiency guide and intermediate tutorial.

"Advanced Perl Programming" is pretty nice... a lot of typos, though.  But it
covers some more obscure areas of perl that don't get properly treated in the
other books.

As for the CGI part, O'Reilly's "CGI Programming on the WWW" is due for a new
edition soon.  That'll cover the CGI & Perl stuff.

"Programming Perl" is basically a hardcopy of the man pages.  A nice
reference, but you can do without it.

On the whole, avoid anything containing the words "Unleashed", "Teach Yourself
X in Y Days" (Tom Gryland has a page devoted to why that book is awful), or
"Special Edition"

In article <6dlf6d$1r04@clnws01.we.highway1.com>,
  oneilt@ucla.edu (Tom O'Neil) wrote:
>
> I've had  a fair amount of experience with Perl, but it was a couple
> of years ago so I'm a little rusty.  I was wondering what a good Perl
> (including CGI) book(s) might be for a good reference and reminder?
>
> Tom O'Neil
> oneilt@ucla.edu


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 08 Mar 1998 17:27:32 +0800
From: zero <zero@sg-online.com>
Subject: help file uploading
Message-Id: <35026484.D76C6D20@sg-online.com>

I'm very new to perl/cgi programming..

I'll be using the library cgi-lib.pl version 2.15, how can i allow my
friends to upload into their respective directories only... (that is I
will create a directory for each of them).

Please help.. thanks



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

Date: Sun, 08 Mar 1998 04:02:34 -0600
From: schwern@starmedia.net
To: tkho@technologist.com
Subject: Re: Help: avoiding eval() on a grep() function.
Message-Id: <6dtq9u$c8m$1@nnrp1.dejanews.com>

To paraphrase perlfaq6...

$pattern = join '&&', map { "m/$_/" } @Pattern;
$matchSub = eval "sub { $pattern }";

@matches = grep {&$matchSub} @Array;

This avoids doing the eval at each iteration of the grep.
(Note:  All errors are left as an excercise for the reader :)


In article <3500811B.A680577@technologist.com>,
  Tommy <tkho@technologist.com> wrote:
>
> Generally, my task is to write a subroutine to grep the list of the
> @Array which contains all the words in @Pattern.
>
> For example:
>   @Array= (001..999);
>   @Pattern= ("12", "3");
>   @ANS= &Search(ARRAY => \@Array, PATTERN => \@Pattern, CONDITION =>
> "AND");
> and it returns
>   312, 123
>
> I have a workable subroutine AndMatch(); however, it is very slow. The
> major problem is the function eval().
>
> grep(/$STR1/i&&/$STR2/i, @Array);
> #  this take only 0.3 sec for 600k records.
>
> grep( eval(/$STR1/i&&/$STR2/i) , @Array);
> #  this take about 10 sec for 600k records.
>
> Does anyone how to do the same task without using eval()?
>
> #Start of Script ---------------------------------
> my ($start, $end, @ANS);
> my @Array= (ABC..IJK);
> my @Pattern= (A, B, C);
>
> $start= time+ times[0];
> @ANS= &AndMatch(ARRAY => \@Array, PATTERN => \@Pattern);
> printf "No of hits (AND)= %.0f\n", $#ANS;
> print join(", ", @ANS), "\n";
> $end= time+ times[0];
> printf "time taken %.2f\n", $end- $start;
>
> ########################
> sub AndMatch {
> # Syntax: = &AndMatch(ARRAY => \@Array, PATTERN => \@Pattern);
>   my %Q= @_;
>   my @PATTERN= @{$Q{PATTERN}};
>   my ($COND);
>   for ($i= 0; $i<= $#PATTERN; $i++) {
>     $PATTERN[$i]= "/".$PATTERN[$i]."/i";
>   }
>   $COND= join("&&", @PATTERN);
>   print "Matching: $COND...\n";
>   return grep(eval($COND), @{$Q{ARRAY}});
> }
> #End of Script ---------------------------------
>
> --
> Tommy Ho
> Email: tkho@technologist.com
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 08 Mar 1998 09:18:52 GMT
From: carroll@tjc.com (Terry Carroll)
Subject: How to check string variable against a number of permissible values, w/o compound IF?
Message-Id: <35026111.25540817@news.ncal.verio.com>

Is there a more perlish way to do something like this:

   if (($color ne 'Red') and
       ($color ne 'Green') and
       ($color ne 'Blue')) {
	print "Error: non-RGB color given\n";
	}

I'd just like to test $color against a list of permissible values.

I'm thinking a regex would be the way to go but am having trouble coming
up with one (I'm still trying to get comfortable with them).


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

Date: Sun, 8 Mar 1998 14:55:08 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: How to check string variable against a number of permissible values, w/o compound IF?
Message-Id: <ebohlmanEpI9Fw.BtA@netcom.com>

Terry Carroll <carroll@tjc.com> wrote:
: Is there a more perlish way to do something like this:

:    if (($color ne 'Red') and
:        ($color ne 'Green') and
:        ($color ne 'Blue')) {
: 	print "Error: non-RGB color given\n";
: 	}

: I'd just like to test $color against a list of permissible values.
                   ^^^^                  ^^^^
: I'm thinking a regex would be the way to go but am having trouble coming
: up with one (I'm still trying to get comfortable with them).

When an experienced Perl programmer thinks of "test" and then thinks of
"list," the next thing he/she thinks of is "hash." 

my %legalcolors=qw(Red => 1,Green => 1, Blue => 1);
 ...
print "Error: non-RGB color \"$color\" given\n" unless exists 
$legalcolors{$color};



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

Date: Sun, 08 Mar 1998 02:57:39 -0600
From: schwern@starmedia.net
To: creed@osd.ulaval.ca
Subject: Re: is perl 4.0 y2k compliant ?
Message-Id: <6dtmg6$8gd$1@nnrp1.dejanews.com>

Larry Wall has no plans to make Perl4 Y2K certified.  Upgrade to Perl5.  Revel
in its quality.  Please don't mind the .pod next to your bed... I mean
zuccini... errr... throw pillow.


Seriously, though.  Y2K bugs are not embedded in the language itself (at least
no language I can think of) but they are created by how a programmer [ab]uses
the language.

Here's a classic:
	&StoreData('Party', 'Dec', '31', '99'); # We'll all party 'til its 1999...

Storing the year as two digits.  Duh.

I still see people doing shit like this even today.  Fortunately, I have to
walk by the Millenium Clock on my way to Penn Station twice a day.  Only 664
days until the Y2K disaster.  Set your clocks back now!

If a program is written in perl4 it means its only a few years old.  If the
programmer was so numb as to code a y2K bug into their code in 1995, then I
wouldn't trust the rest of the program much further than I could throw it.
(Although flinging 3 1/2" floppies out the window is a skill I have learnt to
cultivate.)

Anyhow... to find Y2K bugs, you're going to have to scan the code yourself.
Fortunately, Perl makes this easy(er than a compiled language.  You wonder why
COBOL Y2K programmers get $150/hour... you ever try to read decompiled machine
code?) since the (hopefully well-commented) source is right there.


So, yes, perl4 can go on your y2k-safe list.  But do you have a list of
"things which are horribly insecure and leak memory like Ronald Reagan?"
Since Perl5 is A) free, B) simple to install and C) backwards compatible with
perl4, there's no reason to bother with perl4.

Well... that backwards compatible thing is a not -entirely- true.  This perl4-
ism:

$email = "schwern@starmedia.net";

Won't work under perl5.  However, that 'bug' is easily fixed by doing a:
perl5 -c oldperl4scriptname

And putting a \ in front of every place it tells you to.  Hell, you could
write a perl script to do this. I'd cobble one up for you, but its late.



In article <Pine.SOL.3.91.980306140600.26765A-100000@vert>,
  Carlos Reed <creed@osd.ulaval.ca> wrote:
>
> Hi gang!
>
> I know that perl 5.0 is compliant y2k  and has, such and such,
> but I have to validate a list of sotware, so my
> question is , Does perl 4.0 is y2k compliant ?
>
> thanks in advance, and have a nice suny warmy weekend.
>
> Carlos Reed, from beautiful adn lovely Quebec
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 8 Mar 1998 14:49:03 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: More thoughts on c.l.p.m.
Message-Id: <ebohlmanEpI95r.BI3@netcom.com>

Andy Lester <petdance@maxx.mc.net> wrote:

: I was discussing the last month of hoohah here in c.l.p.m. with a friend
: of mine, and he said "It seems like the newer people see Usenet as chat."
: I think he's dead on.  Look at how this causes many of the problems here:
: * People write very short messages
: * People don't realize that there's a history and reference to this
: * They don't think that we have anything to do besides talk to them.
: * (I suspect) they don't understand why they get yelled at for it all.

And they post a question, and then repost it as a complete new thread a 
few minutes later.  Some multi-posting is simply the result of broken 
newsreaders that don't provide immediate feedback when the user sends an 
article, so if the news server is slow the user clicks the send button a 
second time.  But when the user posts the same question, with slightly 
different formatting or phrasing, twice or more in a short period, it 
suggests that he thinks he's in a chat room and expects an immediate 
response.


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

Date: Sun, 08 Mar 1998 04:08:44 -0600
From: schwern@starmedia.net
To: jkessler@austx.tandem.com
Subject: Re: multi word unix commands and exec
Message-Id: <6dtqle$ckt$1@nnrp1.dejanews.com>

Exact-a-mundo!  set is part of the csh, and thus can't be called by an outside
program.

However, you -can- do exactly what set does, namely set environment variables.
$ENV{'prompt'} = $host;  accomplishes that.  Or rather, it will set
environment variables for the Perl program... if you want to use a perl
program to set -your- environment variables, I don't think its possible.  Use
a shell script (<GASP!>)


In article <7xu39ajxnp.fsf@beavis.vcpc.univie.ac.at>,
  Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
>
> Re: multi word unix commands and exec, Josh
> <jkessler@austx.tandem.com> said:
> This appears to be an attempt to do a csh/tcsh command in
> perl.  Clearly this doesn't work.  "set" is not a "UNIX
> command", it's a command in a shell to set an internal shell
> variable.
>
> You can't do it in perl (unless you re-write tcsh in perl
> :-)
>
> Beat to look in the doc. for your shell for how to set
> prompts.
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 08 Mar 1998 04:56:36 -0600
From: schwern@starmedia.net
To: ilya@math.ohio-state.edu
Subject: Re: Musings on English.pm
Message-Id: <6dttf4$fjs$1@nnrp1.dejanews.com>

Okay, here's the fix to English.pm (sans POD).

use English qw(:NO_MATCH);  will avoid any mention of $&, $', $` or $+ and
will not create the $*MATCH variables.  This will prevent the new English.pm
from breaking old scripts.

Unfortunately, I don't have anything resembling diff currently available, so
I'm going to have to wing it.


-----------------------------English/match.pm-------------------------------
package English::match;

require Exporter;
@ISA = (Exporter);

# Grandfather $NAME import
sub import {
    my $this = shift;
    my @list = @_;
    # IntendedPackage calls English: which calls English::match.  Thus
    # two levels of exportation.
    local $Exporter::ExportLevel = 2;
    Exporter::import($this,grep {s/^\$/*/} @list);
}

@EXPORT = qw(
	*MATCH
	*PREMATCH
	*POSTMATCH
	*LAST_PAREN_MATCH
);

# Matching.

	*MATCH					= *&	;
	*PREMATCH				= *`	;
	*POSTMATCH				= *'	;
	*LAST_PAREN_MATCH		= *+	;

return 42;  # What's six times nine?
------------------------------------------------------------------------------



----------------------Changes to English.pm-----------------------------------
-------------- altered import()----------------
# Grandfather $NAME import
sub import {
    my $this = shift;
    my @list = @_;
    local $Exporter::ExportLevel = 1;
    Exporter::import($this,grep {s/^\$/*/} @list);

    # Check for :NO_MATCH tag and pull it out of the @tags list.
    my $NO_MATCH = 0;
    my @tmpTags = grep /:/, @list;
    @tags = grep !/^:NO_MATCH$/, @tmpTags;
    if( @tags < @tmpTags ) { $NO_MATCH = 1 };

    # Import $MATCH, et. al. unless :NO_MATCH tag is given.
    unless( $NO_MATCH ) {
    	require NewEnglish::match;
    	import NewEnglish::match;
    }

    # import any other tags, too. (For future use)
    if( @tags ) {  # hand any other tags to Exporter
    	Exporter::import(@tags);
    }
}
--------------------------------------------------------

And all references to $MATCH et. al. are removed from @EXPORT and the code.
------------------------------------------------------------------------------

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 7 Mar 1998 07:44:42 -0500
From: "Ron Mahoney" <mahoneys@hunterdon.csnet.net>
Subject: Re: Newbies question for Win32
Message-Id: <6drfm2$hu4$1@news.mhv.net>

This is what I've done on my PC:

for Content Type(Mime) - I've left it blank.
for Actions I've created two actions - Open and Edit.
To create the Open action click on the New button then enter "&Open" for
action and "C:\Perl\bin\Perl.exe" (or whatever your path is) for Application
used to perform action then click OK.

To create the New action click on the New button then enter "&Edit" for
action and "C:\WINNT4\Notepad.exe" (or whatever your path is)for Application
used to perform action then click OK.

Then you'll have to actions to run and edit a perl script from a shortcut
menu.  Hope that helps!

cyber giggy wrote in message <6dpc9u$fve$1@camel29.mindspring.com>...
>Hi
>I have just downloaded Perl for Win32. and successfully installing it.
>I beginning practicing writing in Perl in Notepad. afterward when I try to
>save it with a ".pl" .  Notepad then save this as a ".txt" file.  Example:
>hello.pl.txt
>Question #1. How can I save a file in Notepad with the .pl extension
>I have try going in to my folder option in "My Computer\View\Option\Files
>types\New type." and add a new type of file.
>Question #2. Is what do I fill in the "Content type{MIME}" , "Actions:" & "
>Default extension for content type" field.
>=====Add New Files Type=====
>Description of type: Perl files
>Associated extension: .pl
>Content type {MIME}: ?????
>Default extension for content type:?????
>Actions:??????
>
>Thank Q.
>Ricky37@mindspring.com
>
>




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

Date: Sun, 08 Mar 1998 14:30:53 GMT
From: bhendeNOSPAM@ibm.net
Subject: Perl - Beginner question
Message-Id: <3502a39e.489247711@news-s01.ny.us.ibm.net>


In the following construct, 'while' does not work as I think it
should. Any ideas on why ? Please e-mail the response to
'Arundhati_Bhende@csx.com'  along with the post, if possible.

Thanks

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

#!/usr/bin/perl -w
$secretword = "llama";
print ("What is your name ?");
chomp(($name = <STDIN>));
#$name = <STDIN>;
#chomp ($name);
if ($name eq "Eric"){
    print ("Hello $name! How good of you to be here! \n");
}else{
    print ("Hello, $name!\n");
    print ("Secret word ?");
#    $guess = <STDIN>;
#    chomp $guess;
    while ((chomp ($guess = <STDIN>)) ne $secretword){
         print ("Wrong. Try again.");
#       $guess = <STDIN>;
#       chomp ($guess);
    }
}




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

Date: Sun, 08 Mar 1998 04:31:05 -0600
From: schwern@starmedia.net
To: stackhou@execpc.com
Subject: Re: Pw32i302...now this is just plain frustrating!
Message-Id: <6dtrvj$dsq$1@nnrp1.dejanews.com>

You're using the Eeeevil Microsoft re-write of Perl for Win32 (yes,
ActiveState is owned/funded by Microsoft).  Don't.  It has "Implementation
Quirks" (see section 5 of the Perl for Win32 FAQ) and it cannot use most CPAN
modules.  It is also based on Perl5.003.  The rest of the universe is using
5.004.

Guru Sarathay made a direct port of Perl5.004_02 to Win32.
http://www.perl.com/CPAN/ports/win32/Standard/
use that, instead.  It can use CPAN modules, its exactly the same as the unix
perl (with a few unavoidable quirks due to Windows in general) and it comes
with some nifty pre-installed modules like Data::Dumper, MLDBM, DBI,
DBD::ODBC, libwww, libnet and libwin.

The only compelling reason to use Activestate Perl is if you're planning on
doing alot of work with IIS.  To which my response is:  Don't use IIS, its a
shitty web server and Apache 1.3 for Windows is almost completed.  Of course,
I'd also be the first to say Don't use Windows, its a shitty OS and WINE for
unix is almost completed. :)

And don't use Notepad to write Perl scripts.  Get a Real Editor, like ntemacs.

And stop slouching.  Don't chew your food with your mouth open.  Comb your
hair.


BTW  There's a "Learning Perl for Win32" available.  I don't know if that's
the Llama you have or not.

In article <6dqd0t$r9a@newsops.execpc.com>,
  Mark Stackhouse <stackhou@execpc.com> wrote:
>
> HELP... I downloaded Ps32i302.exe and ran it from my
> Windows95 "run".  The install MS-DOS batch file
> automatically launched and installed Perl.  So far... no
> problem!  I then used "Notepad" to enter the "Hello World"
> program right out of my "Learning Perl" book.  HOW DO I RUN
> THE SCRIPT???  If I try to run it from a DOS prompt, I'm
> told that the program can't be run from DOS.  If I try to
> run it with Windows95 "run", it launches Notebook with my
> source!!!  What gives?  I feel dumber than dirt!
>
> --
> Mark Stackhouse
>
> ***********************************************************************
>
> homepage: http://www.execpc.com/~stackhou
>
> "The best things in life aren't things."
> --Art Buchwald
>
> ***********************************************************************
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 08 Mar 1998 08:11:34 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Pw32i302...now this is just plain frustrating!
Message-Id: <6du96f$dl6@newsops.execpc.com>

Thanks for all the replies.  I finally have thinks working (thanks to all of you).

Now I can start learning!

Mark

schwern@starmedia.net wrote:

> You're using the Eeeevil Microsoft re-write of Perl for Win32 (yes,
> ActiveState is owned/funded by Microsoft).  Don't.  It has "Implementation
> Quirks" (see section 5 of the Perl for Win32 FAQ) and it cannot use most CPAN
> modules.  It is also based on Perl5.003.  The rest of the universe is using
> 5.004.
>
> Guru Sarathay made a direct port of Perl5.004_02 to Win32.
> http://www.perl.com/CPAN/ports/win32/Standard/
> use that, instead.  It can use CPAN modules, its exactly the same as the unix
> perl (with a few unavoidable quirks due to Windows in general) and it comes
> with some nifty pre-installed modules like Data::Dumper, MLDBM, DBI,
> DBD::ODBC, libwww, libnet and libwin.
>
> The only compelling reason to use Activestate Perl is if you're planning on
> doing alot of work with IIS.  To which my response is:  Don't use IIS, its a
> shitty web server and Apache 1.3 for Windows is almost completed.  Of course,
> I'd also be the first to say Don't use Windows, its a shitty OS and WINE for
> unix is almost completed. :)
>
> And don't use Notepad to write Perl scripts.  Get a Real Editor, like ntemacs.
>
> And stop slouching.  Don't chew your food with your mouth open.  Comb your
> hair.
>
> BTW  There's a "Learning Perl for Win32" available.  I don't know if that's
> the Llama you have or not.
>
> In article <6dqd0t$r9a@newsops.execpc.com>,
>   Mark Stackhouse <stackhou@execpc.com> wrote:
> >
> > HELP... I downloaded Ps32i302.exe and ran it from my
> > Windows95 "run".  The install MS-DOS batch file
> > automatically launched and installed Perl.  So far... no
> > problem!  I then used "Notepad" to enter the "Hello World"
> > program right out of my "Learning Perl" book.  HOW DO I RUN
> > THE SCRIPT???  If I try to run it from a DOS prompt, I'm
> > told that the program can't be run from DOS.  If I try to
> > run it with Windows95 "run", it launches Notebook with my
> > source!!!  What gives?  I feel dumber than dirt!
> >
> > --
> > Mark Stackhouse
> >
> > ***********************************************************************
> >
> > homepage: http://www.execpc.com/~stackhou
> >
> > "The best things in life aren't things."
> > --Art Buchwald
> >
> > ***********************************************************************
> >
> >
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading







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

Date: 8 Mar 1998 11:10:56 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <6dtuc0$a49$1@news.orst.edu>

In article <35017756.B3F@nicom.com>,
Steve Palincsar  <palincss@nicom.com> wrote:
>This product could walk on water, double my agency's appropriation and
>be totally free of charge and I wouldn't recommend we even test it.

I notice your article contained the following header:

X-Mailer: Mozilla 3.0 (Win16; I)

This implies that not only do you recommend such code be tested, you
use it. Theoretically, you shouldn't be using it until the end of the
month, assuming that the code Netscape releases isn't as obfuscated.



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

Date: 8 Mar 1998 11:19:17 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <6dturl$fkv$1@news.orst.edu>

In article <oeehg5a2kwo.fsf@alpha.hut.fi>,
Jarkko Hietaniemi  <jhi@alpha.hut.fi> wrote:
>The only thing thusly encrypted software would tell to me is that the
>software vendor does not trust me.  He does not trust me not to leak
>his code and/or he does not trust his own code so much that he could
>show it it plaintext.  

Actually, what it says is that he might trust you, but he doesn't
necessarily trust everyone who has access to your system, whether that
is employees who have no idea or don't care what the license agreement
you signed to get the code said, or crackers who could not care less.

>Therefore, why should I trust him?

You want to use his code? But where exactly is the trust? You buy the
code, you test the wazoo out of it, and refuse to pay if it doesn't
work. 

>Some proponents for such mangling moan that what if the customer
>modifies the code, breaks it, and then sues them for the damages?
>Well, again, that does not sound like trust to me.

Ahhh, if only the whole commercial world could operate on trust. I have
yet to skip out on paying for a tank of gas, but I still get the option
at times of paying in advance or not getting tank of gasoline. They
don't trust me to pay after I pump the gas, then I don't buy from
them.

You have the same option. Please feel free to exercise it.



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

Date: 08 Mar 1998 15:44:03 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <oeeyayls3fg.fsf@alpha.hut.fi>


petdance@maxx.mc.net (Andy Lester) writes:
> It boggles my mind that giving out source code is a condition of doing
> business with someone.  Are you suggesting that you use NO products that
> don't have the full source code given to you?

No.  I am saying that when I have choice I prefer the guy who trusts me.

> It's business, not bar buddies.

Sadly enough.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Sun, 8 Mar 1998 03:10:41 -0500
From: Grimoire <grimoire@oaktree.net>
Subject: RegEx help
Message-Id: <Pine.LNX.3.95.980308022636.25100A-100000@harmony.oaktree.net>

I am in need of help with formating information with a regex.  The data
looks like:
[...]
Name:cor150.anchor.net::199.90.111.102Name:boston-14.cisco.com::171.68.38.14...
[...]


I would like the information to come out like:
[...]
Name:cor150.anchor.net::199.90.111.102
Name:boston-14.cisco.com::171.68.38.14
[...]


I thought the code would go something like this:
	s/::(\d+\.\d+\.\d+\.\d+)/::(\d+\.\d+\.\d+\.\d+)\n/ig;


	Unfortunatly, I was totally wronge in my thinking.  The result had
the right formatting...but the wronge desired effect.  The results where:
[...]
Name:cor150.anchor.net::(d+.d+.d+.d+)
Name:boston-14.cisco.com::(d+.d+.d+.d+)
Name:99.163.17.209.shuttle.net::(d+.d+.d+.d+)
Name:20715980148.bellatlantic.net::(d+.d+.d+.d+)
[...]


	I was hoping that there would be someone on this newsgroup that
would be able to help.  I did look in the Llama and Camel book to no
avail.  If you could help I would appreciate it.  

		Thanks.

                                   """
                                  (o o)
 -------------------------------.uU O Uu.--------------------------------

             I drive way too fast to worry about cholesterol.

 --------------------------------/ /-\ \---------------------------------
                                --     --



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

Date: 8 Mar 1998 11:28:37 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: RegEx help
Message-Id: <slrn6g5075.75r.Tom.Grydeland@mitra.phys.uit.no>

On Sun, 8 Mar 1998 03:10:41 -0500,
Grimoire <grimoire@oaktree.net> wrote:
> I am in need of help with formating information with a regex.


> Name:cor150.anchor.net::199.90.111.102Name:boston-14.cisco.com::171.68.38.14...

> [transformed to]

> Name:cor150.anchor.net::199.90.111.102
> Name:boston-14.cisco.com::171.68.38.14
> [...]

> I thought the code would go something like this:
> 	s/::(\d+\.\d+\.\d+\.\d+)/::(\d+\.\d+\.\d+\.\d+)\n/ig;

Hmm. You seem to be into pain.  Why don't you do simply:

s/(\d)Name/$1\nName/g

(and why do you think you need /i when you're only matching numbers?)

> The results where:
> [...]
> Name:cor150.anchor.net::(d+.d+.d+.d+)
> Name:boston-14.cisco.com::(d+.d+.d+.d+)
> Name:99.163.17.209.shuttle.net::(d+.d+.d+.d+)
> Name:20715980148.bellatlantic.net::(d+.d+.d+.d+)
> [...]

Yup.  You probably want $1 in there.

> 	I was hoping that there would be someone on this newsgroup that
> would be able to help.  I did look in the Llama and Camel book to no
> avail.  If you could help I would appreciate it.  

Hmm. You need to look a little harder.  Hint: capturing parentheses

> 		Thanks.

You welcome.

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: 08 Mar 1998 12:33:34 +0100
From: Peter Kruse <Peter.Kruse@psychologie.uni-regensburg.de>
Subject: Re: RegEx help
Message-Id: <m3vhtpl8mp.fsf@arnulf.de>

In article
<Pine.LNX.3.95.980308022636.25100A-100000@harmony.oaktree.net>
Grimoire <grimoire@oaktree.net> writes: 

> 
> I am in need of help with formating information with a regex.  The data
> looks like:
> [...]
>
> Name:cor150.anchor.net::199.90.111.102Name:boston-14.cisco.com::171.68.38.14.
> [...]
> 
> 
> I would like the information to come out like:
> [...]
> Name:cor150.anchor.net::199.90.111.102
> Name:boston-14.cisco.com::171.68.38.14
> [...]
> 
> 
> I thought the code would go something like this:
> 	s/::(\d+\.\d+\.\d+\.\d+)/::(\d+\.\d+\.\d+\.\d+)\n/ig;
                                 ^^^^^^^^^^^^^^^^^^^^^^^^
				this part is not supposed to be a
				regular expression
how about:

s/:\:((\d+\.){3})(\d+)/:\:$1$3\n/g;

(I remember having trouble with '::' that is where the backslash comes
from.)

> 
> 
> 	Unfortunatly, I was totally wronge in my thinking.  The result had
> the right formatting...but the wronge desired effect.  The results where:
> [...]
> Name:cor150.anchor.net::(d+.d+.d+.d+)
> Name:boston-14.cisco.com::(d+.d+.d+.d+)
> Name:99.163.17.209.shuttle.net::(d+.d+.d+.d+)
> Name:20715980148.bellatlantic.net::(d+.d+.d+.d+)
> [...]
> 
> 
> 	I was hoping that there would be someone on this newsgroup that
> would be able to help.  I did look in the Llama and Camel book to no
> avail.  If you could help I would appreciate it.  

get more info on regular expressions with `man perlre'

	Peter
		

> 
> 		Thanks.
> 
>                                    """
>                                   (o o)
>  -------------------------------.uU O Uu.--------------------------------
> 
>              I drive way too fast to worry about cholesterol.
> 
>  --------------------------------/ /-\ \---------------------------------
>                                 --     --
> 
> 
-- 
__END__


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

Date: Sun, 8 Mar 1998 14:37:22 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: returning immediately from system call?
Message-Id: <ebohlmanEpI8MA.B22@netcom.com>

Erik Johnson <erik@phidias.colorado.edu> wrote:
: I've looked into the FAQ but come up empty handed (perhaps I don't
: know the right question to 'ask'?).

: Is there a way to have perl continue running after making a system
: call to launch another program, without waiting for the other program
: to complete? 

Yes, at least on Unix systems (there may be a way on Win32 or VMS systems 
as well, but they use a completely different process model).

On Unix, system() does a fork() and then the child process does an exec() of
the argument and the parent process does a wait() for the child process. 
In your case, you simply need to do the fork() and exec() yourself and
skip the wait() (well, you'll also have to handle any signals resulting 
from the child process running into trouble).



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

Date: Sun, 08 Mar 1998 06:32:09 -0800
From: John Callender <jbc@west.net>
Subject: Re: Tom, grow up [Re: The -w switch (was Re: better way to do this?)]
Message-Id: <3502ABE9.4106A4@west.net>

twod@not.valid wrote:
> 
> Did you ask Tom for his permission before posting his private email to
> you
> on this newsgroup ?  I see nothing in the alleged email that indicates
> this
> permission was given and it is bad form to post private email to a
> public
> forum without permission.

Mr. Hall presumably was motivated by his frustration at having his mail
bounced. If someone gives you a slap in the face ("You lose. Big.") and
then slams the door on any further communication, posting about it seems
like an understandable, if regrettable, reaction.

In places where it is considered bad form to do such things, by the way,
it is typically considered to be at least an equal offense to flame
people (as in the "I'm *really* tired of whining" post earlier in this
thread), to post lengthy, off-topic rants ("The Young Man and the
Beach..."), or to post commercial ads in a group that doesn't explicitly
allow them (such as John Donnelly's recent post promoting Tom's seminar
in Boulder, CO -- did we *really* need global distribution for that?).

Now, personally, I have no problem with any of that: As I've said
before, I *enjoy* Tom's flames and off-topic excursions, and couldn't
care less if someone getting a cut of his training fees wants to drum up
some business via c.l.p.m. But *I* get kind of tired of third parties
who think he's some kind of angel, and rush to defend him against the
vile heathens who would impugn his sacred honor in this group.

Get real. He brings this stuff on himself -- *on purpose*. He *likes*
the attention it gives him. It's an ego thing. And he's certainly
capable of defending himself -- though I'm sure he gets an extra kick
out of having a personal cheering section.

Sadly, all this will be a moot point if moderation passes, since many of
Tom's most enjoyable postings will be banned under the new group's
charter -- unless Tom's status as a proponent (and his presumed presence
on the moderation panel) means he gets special dispensation. Based on
responses like that of Mr. "twod@not.valid" (who, by the way, probably
knows that posting without a valid E-mail address -- even a munged one
-- is likewise considered bad form), I'm sure the readers of this group
would support such an exemption. I know I would.

--
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Sun, 08 Mar 1998 14:32:04 GMT
From: keefner@visi.com (keefner)
Subject: Using named array to populate radio group via cgi.pm
Message-Id: <3502accb.83785917@news.visi.com>

in the code below, an array is
split it into 2 element lists
and those elements then populate
a radio group.

 for $i (0..$#array) {
  $partno[$i] = substr( $array[$i], -11 );
  $text = substr( $array[$i], 0, -11 );
  $label{$partno[$i]} = $text;
}

print $query2->radio_group('int_num', \@partno, '', 1, \%label);

The file read into the array had basically
2 columns of data and as fixed in position
the substr command worked perfectly.

Now I have a variable file to read into the array
and am looking for advice on best to split that
into 2 or 3 elements and populate the radio group.
There is a "|" delimiter that I can work with.
Sample data

test text1|319-00138|
 more test text2|319-00139|
tssest text3|120-02857C|RL

would generate something like...

<INPUT TYPE=radio NAME=num VALUE="319-00138">test text<BR>
<INPUT TYPE=radio NAME=num VALUE="319-00139>more test text<BR>
<INPUT TYPE=radio NAME=num VALUE="120-02857C|RL>tssest text<BR>

Some fields do have a RL or other characters in that
3rd postion and those myst be passed on.
I've been working with

  foreach $i (@array) {
  ($desc,$partno,$more) = split (/\|/,$i,3);

And I am trying to concatenate the partno and the
more into one and then create named array and label
reference to be used in the radio_group
statement.

Any help/thoughts/references appreciated

Craig




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

Date: 8 Mar 1998 11:36:50 GMT
From: Tony Gonzalez <oak@crl.OmitThis.com>
Subject: Using perl to do what a spreadsheet does but with a plain text file as a source?
Message-Id: <6dtvsi$kmu$1@nnrp1.crl.com>

I'd like to use perl to do what a spreadsheet does but with a plain
text file as a source, for example, if I have a text file like this:


                   Mon.    Tues.    Total
                   ------------------------
Joe Schmoe          5.3     1.2     TOTAL?
John Doe            2.5     4.6     TOTAL?
William Henry       1.3     3.2     TOTAL?

Is there any way I can generate a report like the above with the
totals computed?

Seems to me a more practical and certainly more universal way of doing
things than using a massive spreadsheet overkill GUI application. Ah!,
but I don't know enough about perl to get started....can anyone
suggest a way to get started with this sort of thing, and is it a
feasable approach?

I use unix/linux....seems like the best approach, as with unix, always keep
your data in a plain ascii text file.

Thanks

-Tony


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

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

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