[13843] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1253 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 2 12:05:34 1999

Date: Tue, 2 Nov 1999 09:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941562314-v9-i1253@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 2 Nov 1999     Volume: 9 Number: 1253

Today's topics:
    Re: <STDIN> to a @ <lr@hpl.hp.com>
    Re: <STDIN> to a @ (Peter J. Kernan)
    Re: a tree of subdirectories in perl? (Randal L. Schwartz)
    Re: a tree of subdirectories in perl? <gellyfish@gellyfish.com>
        Capturing data returned after a POST <david@yes.co.th>
    Re: Capturing data returned after a POST <james_peregrino@harvard.edu>
    Re: Card shuffling (Bennett Todd)
    Re: comparing text with words (Bart Lateur)
        DBI error: ORA-06401: NETCMN: invalid driver designator <chris.beels@riskmetrics.com>
        Error: Can't do setuid <leon@pi.informatik.tu-darmstadt.de>
    Re: Extract string ? (Bart Lateur)
        Extracting just the date from a string <jason@netralink.com>
    Re: Extracting just the date from a string <tyndiuk@ftls.org>
    Re: Extracting just the date from a string <matthew@swt.edu>
    Re: Extracting just the date from a string <matthew@swt.edu>
    Re: Extracting just the date from a string <lr@hpl.hp.com>
    Re: Extracting just the date from a string <lr@hpl.hp.com>
    Re: g++ - was Re: Perl disallowed at ACM programming co (Mark W. Schumann)
    Re: help with simple registration CGI script <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
        Hiding Perl Scripts? <webmaster@LorainCounty.com>
    Re: Hiding Perl Scripts? <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
    Re: Hiding Perl Scripts? <matthew@swt.edu>
    Re: Hiding Perl Scripts? <chris.beels@riskmetrics.com>
        I downloaded MacPerl 5.2.Or4 to blue and white G3 <yofang@indiana.edu>
    Re: I'm a bit lost with this LWP problem (Bill Moseley)
    Re: I'm a bit lost with this LWP problem <gisle@aas.no>
    Re: Including modules directly in a script <gellyfish@gellyfish.com>
    Re: It is always like this here? (Chris Nandor)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 2 Nov 1999 07:02:38 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: <STDIN> to a @
Message-Id: <MPG.12889cec6515d7d298a188@nntp.hpl.hp.com>

In article <3821cd6f.413360050@10.0.0.155> on Tue, 02 Nov 1999 11:46:55 
GMT, David Cantrell <NukeEmUp@ThePentagon.com> says...
> On Sat, 30 Oct 1999 01:07:54 -0300, "morpheus" <r00tz@ciudad.com.ar>
> said:
> >I need to get 8 letters from the user and put each one of them in a
> >different part of an array (
> >@array[0] = m;
> >@array[1] = d;
> >...
> 
> print "Please type eight letters followed by the Enter key";
> $letters=<STDIN>;
> $letters=~y/[a-z]//cd;

'[' and ']' are not letters.  But 'A' .. 'Z' are letters.  And then 
there are the locale-dependent letters.  Oh, well...

> @array=split(/.{0}/,$letters) if(length($letters)==8);
               ^^^^^^
Yet another bizarre way of writing // (we've seen /|/ already also in 
this thread).

> print join(',',@array) if(@array); # Just to prove it works

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 2 Nov 1999 04:55:09 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: <STDIN> to a @
Message-Id: <slrn81srld.14ao.pete@theory2.phys.cwru.edu>

On Mon, 01 Nov 1999 21:18:53 GMT, Craig Berry <cberry@cinenet.net> wrote:
 .=I can't defend any alternative, but this special case does bother me.
     or is it simply alternation?
here are some other ways to obfuscate that split

@chars=split /\B|\b/, $ARGV[0];
@chars=split /(?=.)*?/, $ARGV[0];
@chars=split /(?!.)*?/, $ARGV[0];
@chars=split /(?{"leper mushrooms"})*?/, $ARGV[0];           #surprise!
@chars=split /(?<!.)*?/, $ARGV[0];
@chars=split /(?<!=)*?/, $ARGV[0];
@chars=split /(?(?=.))/, $ARGV[0];
@chars=split /|anything/, $ARGV[0];
@chars=split /anything|/, $ARGV[0];

and many much more horrible thingies could be constructed by
guaranteeing matching nothing (i surmise). however
i do not understand why (on my box) the perl-code zero width assertion
sometimes does a substitution-- on the first and fifth char (unless
the fifth is the last apparently, and perhaps again if i feed it
a longer string). (5.005_03, i586-linux)
-- 
  Pete


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

Date: 02 Nov 1999 07:53:17 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: a tree of subdirectories in perl?
Message-Id: <m13duoevpu.fsf@halfdome.holdit.com>

>>>>> "Jaime" == Jaime  <lsprilus@weizmann.weizmann.ac.il> writes:

Jaime> In article <x7zowx8ilx.fsf@home.sysarch.com>, Uri Guttman
Jaime> <uri@sysarch.com> wrote:
>> just a few comments:
>> use my instead of local. this looks like perl4 code.

Jaime> It is. Was coded on July 26 1996

From perlhist:

        Larry   5.002          1996-Feb-29     Prototypes.

Since 5.002 was out six months prior, why did you write it in Perl4?

:-)

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 2 Nov 1999 15:54:18 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: a tree of subdirectories in perl?
Message-Id: <381f092a_1@newsread3.dircon.co.uk>

Jaime <lsprilus@weizmann.weizmann.ac.il> wrote:
> In article <x7zowx8ilx.fsf@home.sysarch.com>, Uri Guttman
> <uri@sysarch.com> wrote:
>>just a few comments:
>>use my instead of local. this looks like perl4 code.
> 
> It is. Was coded on July 26 1996
> 
> I just sent a working code I have. This don't try to be an
> example of perfect programming.
> 
> Use it if you need/like. Leave it if not :)

Nah you post code here it gets 'reviewed' here - I would suggest that most
people in this group would agree that it isnt in anyones interest to allow
questionable or obsolete code to go without any comment - not that I am
suggesting that yours is particularly questionable or obsolete just old.

BTW - you do realise that we were already up to Perl 5.003 by July 1996 ?

/J\
-- 
"You're blowing me off for a monkey?" - Joey, Friends


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

Date: Tue, 2 Nov 1999 22:04:43 +0700
From: "David Taylor" <david@yes.co.th>
Subject: Capturing data returned after a POST
Message-Id: <7vmusp$38q$1@news.ksc.co.th>

Classification: Relative 'newbie' to Perl and this group.
Qualification: Reading all the books, learning, albeit slowly.

Problem with data being returned after some
form-filling and initial processing:

#!/usr/bin/perl -w
use CGI qw/:cgi :html :form/;
$query = new CGI;
### this subroutine validates all the input data
&present_input_data;
### and only if its ok, a 'submit' is presented.
### Pressing 'submit', data is sent to *different*
### server, using POST, processed ok and returned
### to the screen as one line of comma-delimited data.
### So far, so good, all works a treat.
### Problem - cannot 'capture' this data for the next
### stage of the process, tried using:

read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
  @names = split(/\,/,$in);
    print "Content-type: text/html\n\n";
    foreach $name(@names) {
      print "$name<br>" ;
    }

### just to print on screen, for example, but to no avail.
### What am I doing wrong?





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

Date: 02 Nov 1999 11:25:28 -0500
From: James Peregrino <james_peregrino@harvard.edu>
Subject: Re: Capturing data returned after a POST
Message-Id: <x7d7ts5093.fsf@bert.dce.harvard.edu>

"David Taylor" <david@yes.co.th> writes:

> #!/usr/bin/perl -w

	Good.

> use CGI qw/:cgi :html :form/;

	Prefer

  use CGI qw/:standard/;

Your approach, while valid, is attempting to load in portions of CGI.pm so
that the script starts up faster, but you're loading in so much that you might
as well do it all.  The qw/:standard/ way prevents the 'I wonder if I forgot to
load something...?' nagging question.

> $query = new CGI;

	Then you can skip this line all together with qw/:standard/;

> ### this subroutine validates all the input data
> &present_input_data;
> ### and only if its ok, a 'submit' is presented.
> ### Pressing 'submit', data is sent to *different*
> ### server, using POST, processed ok and returned
> ### to the screen as one line of comma-delimited data.

	Are you saying that you are creating this comma-delimited data in
some other part of the program?  Because CGI POST-ed data comes to you in
name=value&name=value&name=value form.

> ### So far, so good, all works a treat.
> ### Problem - cannot 'capture' this data for the next
> ### stage of the process, tried using:
> 
> read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
>   @names = split(/\,/,$in);

	So, if you are attempting to get at the POST-ed data this way, you're
not taking advantage of the fact that CGI.pm already did this for you and
placed everything in the param() function:

	$foo_value = param('foo');

where 'foo' is the NAME= lable in your form.


>     print "Content-type: text/html\n\n";
>     foreach $name(@names) {
>       print "$name<br>" ;
>     }

	and so this becomes:

	print header(), start_html();
	foreach $name (param()) {
	   $value = param($name);
           print "$value<br>\n";
        }
	print end_html();

-James
-- 
James Peregrino
Harvard Div. Continuing Education


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

Date: Tue, 02 Nov 1999 16:47:31 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: Card shuffling
Message-Id: <slrn81u5d1.9ap.bet@localhost.localdomain>

1999-11-01-23:00:06 Larry Rosler:
>1999-11-01-21:31:49 Bennett Todd:
>> for my $i (0..$#deck-1){@deck[$i, $_]=@deck[$_, $i] for $i+rand($#deck-$i+1)}
>> 
>> That shuffles an N-card deck using N-1 calls to rand() and swaps. If the
>> performance edge of doing an in-place swapping shuffle isn't important, it
>> might be more understandable as
>> 
>> 	@shuffled = ();
>> 	push @shuffled, splice(@deck, rand(@deck), 1) while @deck;
>
>What is wrong with the discussion in perlfaq4: "How do I shuffle an 
>array randomly?"  It gives both of these methods (improving on the first 
>one slightly), and describes the latter one as 'bad'.

For the first one, the only slight improvement I see is that it adds a
check to optimize out the case of a null swap. I've no idea whether the
test costs enough to pay for itself. So of course now I have to time
'em..... Meanwhile, the FAQ may call the latter one "bad", but I think it
wins on understandability, and that's sometimes worth sacrificing a little
performance for. So on to the benchmark. Here's the code I used:

#!/usr/bin/perl -w
use strict;
use Benchmark;

timethese(-10, {
	FAQFY  => sub {
		my(@deck) = 0 .. 51;
		my $i;
		for ($i = @deck; --$i; ) {
			my $j = int rand ($i+1);
			next if $i == $j;
			@deck[$i,$j] = @deck[$j,$i];
		}
	},
	BFY => sub {
		my(@deck) = 0 .. 51;
		for my $i (0..$#deck-1) {
			@deck[$i, $_]=@deck[$_, $i] for $i+rand($#deck-$i+1)
		}
	},
	BS => sub {
		my(@deck) = 0 .. 51;
		my @shuffled = ();
		push @shuffled, splice(@deck, rand(@deck), 1) while @deck;
	},
});

Whitespace-squoze results:

Benchmark: running BFY, BS, FAQFY, each for at least 10 CPU seconds...
  BFY: 20 wallclock secs (11.47usr+0.76sys=12.23 CPU)@373.67/s (n=4570)
   BS: 17 wallclock secs (11.46usr+0.31sys=11.77 CPU)@805.44/s (n=9480)
FAQFY: 23 wallclock secs (14.07usr+0.50sys=14.57 CPU)@662.94/s (n=9659)

where BFY is my Fisher-Yates (swapping) shuffle, BS is my splice shuffle, and
FAQFY is the Fisher-Yates from the FAQ. I'm surprised all over. My splice
version is the speed winner. Maybe perl has noticed that I'm not doing
anything with the results and optimizing the whole shuffle out of existence? I
didn't think it was that brilliant. But if so, that says something for going
for the more understandable code:-).

Maybe implementation of rand scaling likes the pattern of rands better?

I'm also kinda surprised at the amount of difference between my formulation
of Fisher-Yates and the FAQ's; as best I can tell, there's an extra test in
the FAQ's that will save a small fraction of the swaps, so it might be a win
or a lose (which costs more, the test or the swaps that it saves); and the
FAQ Fisher Yates counts in the opposite direction, back from the end where
I count forwards. I can't see either of those explaining the factor of 1.77
difference.

-Bennett


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

Date: Tue, 02 Nov 1999 15:46:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: comparing text with words
Message-Id: <382006ca.5759325@news.skynet.be>

Abigail wrote:

>That's why I seldomly use for for such tricks.
>
>       if (/($pat)/) {
>           local $_ = $1;
>           tr/\r\n\t / /s;
>           print;
>       }
>
>
>Takes even less lines.

But if it is the intention to change the original variable, it's a neat
trick.

It more closely resembles the original

	$x =~ s/$pat/$replace/g;

than

	local $_ = $x;
	s/$pat/$replace/g;
	$x = $_;

would.
	
-- 
	Bart.


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

Date: Tue, 2 Nov 1999 11:46:00 -0500
From: "Chris Beels" <chris.beels@riskmetrics.com>
Subject: DBI error: ORA-06401: NETCMN: invalid driver designator
Message-Id: <fzET3.2$vC1.50@news.ais.net>

Hi,

I'm trying to connect to an Oracle DB using DBI (Solaris) and am receiving
the error mentioned above.  I've tried both of the following connection
strings:
$dbh = DBI->connect('dbi:Oracle:','$username@T:$host:$sid','$password')
and
$dbh = DBI->connect("DBI:Oracle:host=$host:sid=$sid", $username, $password)

with the same results.  I've seen this problem referred to a couple of
places on the net,
e.g. http://www.xray.mpe.mpg.de/mailing-lists/dbi/1998-11/msg00152.html and
http://www.minivend.com/minivend/minivend-list/1999/msg01785.html

but no solutions were posted and the people who posted the problem have
failed to respond.  Oracle describes the error rather unhelpfully at
http://www.oracle.com/support/bulletins/o8/nt/html/8002.html as follows:
ORA-06401:  "NETCMN: invalid driver designator"
// *Cause:  The login (connect) string contains an invalid
            driver designator.
// *Action: Correct the string and resubmit.

but I'm not sure what that has to do with DBI.

I appreciate your help.

Thanks,

Chris Beels
RMG Web Services
riskmetrics.com




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

Date: Tue, 2 Nov 1999 15:53:36 +0100
From: "Thomas Leonhardt" <leon@pi.informatik.tu-darmstadt.de>
Subject: Error: Can't do setuid
Message-Id: <7vmtl1$kpf$1@sun27.hrz.tu-darmstadt.de>

Hi,
I got a script which I want to run with setuid.
If I run the program I get the message: Can't do setuid
I read in the pearl documentation/faq that this error might
be caused by a missing sperl program. But I got that
program in /usr/bin and all the rights are set.
Any ideas what else might cause the error??

Thanks Leo




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

Date: Tue, 02 Nov 1999 15:51:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Extract string ?
Message-Id: <382107d5.6026535@news.skynet.be>

Adrian Chin wrote:

>I have :
>
>vol1/extract/inst/sum.C:1:2:3
>vol2/extract/algo.h:2:3:4
>vol3/extr/rol/rojak/bunga/fungi.sh:1:2:3
>
>in a file call file.txt.  How do I extract the colored string out to a
>variable in perl ?

Judging by that HTM part (yuck!), this will do what you want:

	$_ = 'vol1/extract/inst/sum.C:1:2:3';
	($extract) = /.*\/([^:]+)/;
	print $extract;

-- 
	Bart.


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

Date: Tue, 2 Nov 1999 17:26:39 +0200
From: "Jason Rosenkowitz" <jason@netralink.com>
Subject: Extracting just the date from a string
Message-Id: <7vmvpr$l9j$1@ctb-nnrp1.saix.net>

Hi

I am trying to extract just the date from a string which might be of
variable length.

From xyz@abc.com  Wed Oct 20 12:11:58 1999
From xyzacc@abc.com  Mon Aug 30  17:16:24 1999
From xyzadf@abertrec.com  Wed Oct 20 12:12:12 1999
From xyzwer@afdgbc.com  Wed Oct 20 12:12:11 1999
From xyzwerwevcb@abc.com  Fri Oct 22 19:12:40 1999

?

I have tried to use @date = split(/  /,$string) as there is a common split
of two spaces between email address and date but there might be two spaces
somewhere in the date which throws me out!!

I am still grasping programming concepts and am sure that there is an
extremely easy way to do this??

Thanks

Jason
jason@netralink.com




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

Date: Tue, 02 Nov 1999 17:02:32 +0100
From: Frederic TYNDIUK <tyndiuk@ftls.org>
To: Jason Rosenkowitz <jason@netralink.com>
Subject: Re: Extracting just the date from a string
Message-Id: <381F0B18.C7CECDBF@ftls.org>


	You can try :

	$_ = "From xyz\@abc.com  Wed Oct 20 12:11:58 1999";
	s/[^@]*@\w+\.\w+ +//;
	print $_;

	or if you want use split;

	$date = (split(/ +/, $my_string,3))[2]; #split 1 space and more....

	Bye

		FTLS

Jason Rosenkowitz wrote:
> 
> Hi
> 
> I am trying to extract just the date from a string which might be of
> variable length.
> 
> From xyz@abc.com  Wed Oct 20 12:11:58 1999
> From xyzacc@abc.com  Mon Aug 30  17:16:24 1999
> From xyzadf@abertrec.com  Wed Oct 20 12:12:12 1999
> From xyzwer@afdgbc.com  Wed Oct 20 12:12:11 1999
> From xyzwerwevcb@abc.com  Fri Oct 22 19:12:40 1999
> 
> ?
> 
> I have tried to use @date = split(/  /,$string) as there is a common split
> of two spaces between email address and date but there might be two spaces
> somewhere in the date which throws me out!!
> 
> I am still grasping programming concepts and am sure that there is an
> extremely easy way to do this??
> 
> Thanks
> 
> Jason
> jason@netralink.com

-- 
*-----------------------------------------------------------*
|    FTLS    E-Mail: - tyndiuk@ftls.org / tyndiuk@abul.org  |
|(TYNDIUK Frederic)                                         |
|        WWW Perso : - http://www.ftls.org/                 |
*-----------------------------------------------------------*


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

Date: Tue, 02 Nov 1999 09:58:43 -0600
From: Matt Williamson <matthew@swt.edu>
To: Jason Rosenkowitz <jason@netralink.com>
Subject: Re: Extracting just the date from a string
Message-Id: <381F0A33.60653522@swt.edu>

Jason Rosenkowitz wrote:

> I am trying to extract just the date from a string which might be of
> variable length.
>
> ...
> I have tried to use @date = split(/  /,$string) as there is a common split
> of two spaces between email address and date but there might be two spaces
> somewhere in the date which throws me out!!

What would probably be easiest for you to do would be to take that array you
got, and "shift" off the first element, then join what's left back together
with a space like this:

@parts = split(/  /,$string);
shift(@parts);
$Result = join(" ",@parts);

What "shift(@array)" does is to remove the first element of @array. If you
need to hang on to that part, change "shift(@parts);" to "$FromEmail =
shift(@parts);", which accomplishes the same thing but also stores the first
element in "$FromEmail".

"$Result = join(" ",@parts);" does exactly what it looks like, it joins all
the elements in @parts into a string, each element being separated by a space.
NOTE: this will lose that double-space that may sometimes occur in the date.
If that's important to keep, you'll need to do something a bit fancier.

The real way to do this would be with pattern matching, but while I could give
you an operation that would do what you want, it might be difficult to
explain.

-Matt Williamson, Web Developer
 Southwest Texas State University
 Department of Computer Science




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

Date: Tue, 02 Nov 1999 10:03:43 -0600
From: Matt Williamson <matthew@swt.edu>
Subject: Re: Extracting just the date from a string
Message-Id: <381F0B5F.567B11BC@swt.edu>

Jason Rosenkowitz wrote:

> I am still grasping programming concepts and am sure that there is an
> extremely easy way to do this??

Matt Williamson wrote:

> The real way to do this would be with pattern matching, but while I could give
>
> you an operation that would do what you want, it might be difficult to
> explain.

Frederic TYNDIUK wrote:

>         $_ = "From xyz\@abc.com  Wed Oct 20 12:11:58 1999";
>         s/[^@]*@\w+\.\w+ +//;
>         print $_;

See what I mean? ;-)

-Matt Williamson, Web Developer
 Southwest Texas State University
 Department of Computer Science



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

Date: Tue, 2 Nov 1999 08:11:20 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Extracting just the date from a string
Message-Id: <MPG.1288acfe93f08e1498a18a@nntp.hpl.hp.com>

In article <7vmvpr$l9j$1@ctb-nnrp1.saix.net> on Tue, 2 Nov 1999 17:26:39 
+0200, Jason Rosenkowitz <jason@netralink.com> says...
> I am trying to extract just the date from a string which might be of
> variable length.
> 
> From xyz@abc.com  Wed Oct 20 12:11:58 1999
> From xyzacc@abc.com  Mon Aug 30  17:16:24 1999
> From xyzadf@abertrec.com  Wed Oct 20 12:12:12 1999
> From xyzwer@afdgbc.com  Wed Oct 20 12:12:11 1999
> From xyzwerwevcb@abc.com  Fri Oct 22 19:12:40 1999
> 
> ?
> 
> I have tried to use @date = split(/  /,$string) as there is a common split
> of two spaces between email address and date but there might be two spaces
> somewhere in the date which throws me out!!
> 
> I am still grasping programming concepts and am sure that there is an
> extremely easy way to do this??

Yes, there is.  Add a third argument, with value 2, to your split 
statement.  Read about this in `perldoc -f split`.

It could also be done with a regular expression, but the 'split ..., 2' 
approach shold be just fine.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 2 Nov 1999 08:48:48 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Extracting just the date from a string
Message-Id: <MPG.1288b5cf97af88ba98a18b@nntp.hpl.hp.com>

In article <381F0B5F.567B11BC@swt.edu> on Tue, 02 Nov 1999 10:03:43 -
0600, Matt Williamson <matthew@swt.edu> says...
> Jason Rosenkowitz wrote:
> > I am still grasping programming concepts and am sure that there is an
> > extremely easy way to do this??
> 
> Matt Williamson wrote:
> > The real way to do this would be with pattern matching, but while I could give
> > you an operation that would do what you want, it might be difficult to
> > explain.
> 
> Frederic TYNDIUK wrote:
> >         $_ = "From xyz\@abc.com  Wed Oct 20 12:11:58 1999";
> >         s/[^@]*@\w+\.\w+ +//;
> >         print $_;
> 
> See what I mean? ;-)

Oh, come on.  This is such nonsense.  Here's all it takes, and that can 
be explained in very few words:

  $_ = 'From xyzacc@abc.com  Mon Aug 30  17:16:24 1999';

  my ($date) = /  (.*)/;

I answered with split(..., 2) because it was closest to what Jason 
already knew, but the regex solution is even more intuitive, if you have 
even a rudimentary knowledge of pattern matching.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 2 Nov 1999 10:24:20 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: g++ - was Re: Perl disallowed at ACM programming contests?
Message-Id: <7vmvn4$83n@junior.apk.net>

In article <381EEDC4.CB8AD7A4@mail.uca.edu>,
Cameron Dorey  <camerond@mail.uca.edu> wrote:
>"Mark W. Schumann" wrote:
>[cc'd to mws]

Okay, but you didn't have to do that.

>> In article <6y7lk2ed01.fsf@anu.edu.au>,
>> Tim Potter  <Tim.Potter@anu.edu.au> wrote:
>> >bart.lateur@skynet.be (Bart Lateur) writes:
>> >> Mark W. Schumann wrote:
>> >>
>> >> >This is just killing me.  ACM is now handing out Visual C++ as a
>> >> >"prize"?
>> 
>> I suppose it would be weird to give away a copy of g++.
>> 
>
>I haven't heard of g++, although I use G in my work, along with Perl.
>Has M$ sucked this one up, too? :(

GNU C++.



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

Date: Tue, 02 Nov 1999 07:08:24 -0800
From: Mark Bluemel <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
Subject: Re: help with simple registration CGI script
Message-Id: <000b8d9b.d7730d33@usw-ex0102-014.remarq.com>

In article <7vmpbp$sqp$1@nnrp1.deja.com>, muhudin@my-deja.com wrote:
> Hi all perlers:-)
> My teacher gave me an assignment. And I really need help. Please
> help. I
> want a simple CGI registration script
> It should have one text field for name, one for email, one for
> password
> and one more for re-enter password. Also the SQL commands that
> save that
> information in Oracle database. Information on all registered
> members
> are kept in Oracle database NOT in Unix file.
> Thanks in advance
> muhudin-
My rate is $100 per hour - I reckon 4 hours should do it. Is your
homework work worth $400 for someone else to do it for you?

If you have specific problems, its reasonable to post a question. If
you haven't a clue, you can:-
a) do some research - read a book (yes, really!), do some web searches
b) (probably better) talk to your teacher and explain that you need
some more help before you're ready for the assignment.

[Aside: Good God! Yes it is always like this....]

Mark Bluemel



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Tue, 02 Nov 1999 10:17:26 -0500
From: "LorainCounty.com Webmaster" <webmaster@LorainCounty.com>
Subject: Hiding Perl Scripts?
Message-Id: <381F0086.C07A440B@LorainCounty.com>

Hello All,

    How could I hide the source code of a Perl Script so
it can't be modified or viewed?  I might have to place the script on a
server I have no control over but would like to keep the Perl Script
intact.

    I have read the FAQ (3 & 8) about compiling the code but as I read
them
that didn't seem to be the answer.

    Any ideas or suggestions would greatly be appreciated.

Thank you in advance.

Mike Skimin, Webmaster
LorainCounty.com





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

Date: Tue, 02 Nov 1999 08:04:08 -0800
From: Mark Bluemel <mark.bluemelNOmaSPAM@siemens.co.uk.invalid>
Subject: Re: Hiding Perl Scripts?
Message-Id: <0a0133f8.e614ad43@usw-ex0102-014.remarq.com>

In article <381F0086.C07A440B@LorainCounty.com>, "LorainCounty.com
Webmaster" <webmaster@LorainCounty.com> wrote:
> Hello All,
>     How could I hide the source code of a Perl Script so
> it can't be modified or viewed?  I might have to place the script
> on a
> server I have no control over but would like to keep the Perl
> Script
> intact.
Just put it in a directory where the server knows how to invoke it, but
where it cannot be accessed as a document. Exactly how this needs to be
done will depend on the operating system and web server software
involved.

BTW, this is not a Perl question.

HTH

Mark


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Tue, 02 Nov 1999 10:19:33 -0600
From: Matt Williamson <matthew@swt.edu>
Subject: Re: Hiding Perl Scripts?
Message-Id: <381F0F15.D95E7C9D@swt.edu>



Mark Bluemel wrote:

> In article <381F0086.C07A440B@LorainCounty.com>, "LorainCounty.com
> Webmaster" <webmaster@LorainCounty.com> wrote:
> > Hello All,
> >     How could I hide the source code of a Perl Script so
> > it can't be modified or viewed?  I might have to place the script
> > on a
> > server I have no control over but would like to keep the Perl
> > Script
> > intact.
> Just put it in a directory where the server knows how to invoke it, but
> where it cannot be accessed as a document. Exactly how this needs to be
> done will depend on the operating system and web server software
> involved.

Hmm...that will hide the source from web users, but it sounds like to me that
you want to also keep the code invisible even to, say, other server users and
perhaps even the server administrators?  I don't know if it's possible to
permanently compile (as opposed to run-time compiling) a perl program, but even
if you did, if the system administrators wanted to see the code, they'd have a
right to (it could potentially be posing security risks).  And if it's a UNIX
(or Linux or BSD) server, I wouldn't worry too much about people other than the
sysadmins being able to look at your code. Most of them have the OS-level
security set up correctly so that only authorized people on the server can
access your files.

-Matt Williamson, Web Developer
 Southwest Texas State University
 Department of Computer Science




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

Date: Tue, 2 Nov 1999 11:36:13 -0500
From: "Chris Beels" <chris.beels@riskmetrics.com>
Subject: Re: Hiding Perl Scripts?
Message-Id: <0qET3.1$vC1.101@news.ais.net>

Mike,

If your server allows executables, try perl2exe from Mercury Systems at
http://www.perl2exe.com/

Let me know if that works for you.  I haven't gotten around to trying it
myself.

Chris
RMG Web Services
riskmetrics.com

LorainCounty.com Webmaster <webmaster@LorainCounty.com> wrote in message
news:381F0086.C07A440B@LorainCounty.com...
> Hello All,
>
>     How could I hide the source code of a Perl Script so
> it can't be modified or viewed?  I might have to place the script on a
> server I have no control over but would like to keep the Perl Script
> intact.
>
>     I have read the FAQ (3 & 8) about compiling the code but as I read
> them
> that didn't seem to be the answer.
>
>     Any ideas or suggestions would greatly be appreciated.
>
> Thank you in advance.
>
> Mike Skimin, Webmaster
> LorainCounty.com
>
>
>




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

Date: Tue, 02 Nov 1999 10:17:33 -0500
From: Youyi Fong <yofang@indiana.edu>
Subject: I downloaded MacPerl 5.2.Or4 to blue and white G3
Message-Id: <381F008C.4699BBF4@indiana.edu>

Hi there,

I downloaded MacPerl 5.2.Or4 to blue and white G3 and experienced two
problems beyond my comprehension. I apprieciate your oppinion very much!

1) I wrote a program to extract a line "ORIGIN" from a file.

Perl -Sx "{0}" {"Parameters"}; Exit {Status}
#!perl

open (IN, $ARGV[0]) or die "can't open input file: $!\n";
open (OUT, ">".$ARGV[0]."new") or die "can't open output file: $!\n";
while (<IN>){
    print OUT if /ORIGIN/ ;
}

But the if condition always evaluates to true, no matter what the input
is. I moved the same code (the first two lines are replaced by
#!/usr/bin/perl -w) to a Unix machine and it runs just fine. I couldn't
figure out why.


2) When I double clicked on "Install.MPW_Perl", I was told that MPW is
not found. Isn't that what I try to install?

Thanks in advance for any input!

Youyi



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

Date: Tue, 2 Nov 1999 06:06:48 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: I'm a bit lost with this LWP problem
Message-Id: <MPG.12888fd33222b49d98982f@nntp1.ba.best.com>

Gisle Aas (gisle@aas.no) seems to say...
> A URI like "www.test.com:44991/test" parsed such that "www.test.com"
> end up as the scheme part.  Then the URI module will then encode "."
> as "_O" in order to get a valid perl identifier and then try to load
> the module "URI/www_Otest_Ocom.pm" to see if it has something to say.
> When this does not work URI should just silently assume generic URI
> syntax.  You should not see the message above at all.  Perhaps there
> is some evil $SIG{__DIE__} handler playing some tricks here?

That's exactly correct.  I do have an evil $SIG{__DIE__} that was 
created when I switched over to mod_perl.  I'll clean that up.

Why does www.test.com end up in the scheme part?  Are not the "://" 
considered an indicator of the scheme part, or is is just looking for 
the ":"?


> If you want to use shorthand URIs like the one above then you need to
> use the URI::Heuristic module.

Well, the problem is I'm using user supplied URLs.  I'll move to 
URI::Heuristic.

Since the scheme is used as part of a file name are there any security 
concerns?  Or does the dot-to-"_O" conversion resolve that.

Thanks very much,


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 02 Nov 1999 17:04:41 +0100
From: Gisle Aas <gisle@aas.no>
Subject: Re: I'm a bit lost with this LWP problem
Message-Id: <m3puxsswva.fsf@eik.g.aas.no>

moseley@best.com (Bill Moseley) writes:

> Why does www.test.com end up in the scheme part?  Are not the "://" 
> considered an indicator of the scheme part, or is is just looking for 
> the ":"?

Consider the URI that you have in your own signature.  It does not
have "://".

RFC 2396 tells us that:

      scheme        = alpha *( alpha | digit | "+" | "-" | "." )

in the beginning of a URI followed by ":", and this is the RE that
URI.pm use to find schemes /^([a-zA-Z][a-zA-Z0-9.+\-]*):/.

> > If you want to use shorthand URIs like the one above then you need to
> > use the URI::Heuristic module.
> 
> Well, the problem is I'm using user supplied URLs.  I'll move to 
> URI::Heuristic.
> 
> Since the scheme is used as part of a file name are there any security 
> concerns?

It should not be any security concerns with this.  Only schemes that
match the RE above is turned into module names to load.  URI.pm should
already be taint clean when dealing with external URI strings.

> Or does the dot-to-"_O" conversion resolve that.

I don't think it does much security wise, but it helps to avoid a perl
syntax error when we load the module with "require $ic".

-- 
Gisle Aas


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

Date: 2 Nov 1999 14:29:10 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Including modules directly in a script
Message-Id: <381ef536_2@newsread3.dircon.co.uk>

In comp.lang.perl.misc Peter Sundstrom <send@no.junk.mail> wrote:
> I know this seems a totally crazy thing to do, but I have reasons for doing
> it.
> 
> What I want to know is how can I directly include a perl module in my perl
> script.  Obviously I can't just plonk in the module code without some mods.
> What modifications would I generally need to make, or is it too difficult?
> 

What happened when you tried ?

/J\
-- 
"As usual I'm the price you have to pay for the funny bits" - Denis Norden


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

Date: Tue, 02 Nov 1999 14:41:15 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: It is always like this here?
Message-Id: <pudge-0211990941200001@192.168.0.77>

In article <MPG.128389a13eb7ea6e98a15c@nntp.hpl.hp.com>, Larry Rosler
<lr@hpl.hp.com> wrote:

# In article <pudge-2910991143560001@192.168.0.77> on Fri, 29 Oct 1999 
# 15:44:58 GMT, Chris Nandor <pudge@pobox.com> says...
# > That is why comp.lang.perl.moderated was created.
# 
# And has almost no traffic, hence almost no information.

Since when?  Almost no traffic?  Perhaps you have a bad feed.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 1253
**************************************


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