[7802] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1427 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 6 09:28:32 1997

Date: Sat, 6 Dec 97 06:01:21 -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           Sat, 6 Dec 1997     Volume: 8 Number: 1427

Today's topics:
     Re: ... rumours run amok <merlyn@stonehenge.com>
     Re: eval and open: append vs new, i.e. >> vs > <ajh@rtk.com>
     Re: evaluating $var within files? (Tushar Samant)
     Re: evaluating $var within files? <merlyn@stonehenge.com>
     Re: Forced to use brain-dead perl 4 -- how do I accompl (Eric)
     Re: Forced to use brain-dead perl 4 -- how do I accompl (Eric)
     FORM MAIL for Novell Web Server <gdoucet@ait.acl.ca>
     Re: FORM MAIL for Novell Web Server <gdoucet@ait.acl.ca>
     Re: graphic file dimensions in PERL? <jaydee@worsdall.demon.co.uk>
     Re: graphic file dimensions in PERL? (brian d foy)
     Re: graphic file dimensions in PERL? <jaydee@worsdall.demon.co.uk>
     Re: Help with VERY simple problem (brian d foy)
     Re: How to create reference to anonymous scalar variabl <zenin@best.com>
     inexact matches <rfp@erienet.net>
     Re: inexact matches <mwrostron@imation.com>
     Re: Matching lowercase letter in regexp (brian d foy)
     Re: need help with concatenation operation (brian d foy)
     Re: Odd minus/modulus behavior <beans@bedford.net>
     Re: oraperl <daftary@_remove_to_send_email_.cisco.com>
     Re: oraperl twod@not.valid
     Re: PERL Backticks and Non-parsed Headers (NPH) (brian d foy)
     PERL Frusterations (semi-newbie) (blacktape)
     Perl web chatroom, Chinese and Japanese code conversion (Gil)
     Re: Perl4 is not Y2K (was Re: Forced to use brain-dead  (brian d foy)
     Re: Perl4 is not Y2K (was Re: Forced to use brain-dead  (Abigail)
     Re: PERL<-->databases ???(newbie) (brian d foy)
     perlsec setuid and my confusion and security issues ple <jaydee@worsdall.demon.co.uk>
     Re: problem with my() and s// (Tushar Samant)
     Re: problem with my() and s// (brian d foy)
     Re: searching indexed file (Tushar Samant)
     Re: size of a DB (Gurusamy Sarathy)
     Re: sub in .pm!!!!! (brian d foy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 05 Dec 1997 20:53:15 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: bsa@kf8nh.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: ... rumours run amok
Message-Id: <8cpvnbktzo.fsf@gadget.cscaper.com>

>>>>> "Brandon" == Brandon S Allbery KF8NH; to reply, change "void" to "kf8nh" <bsa@void.apk.net> writes:

Brandon> In <8c90u0pqqx.fsf@gadget.cscaper.com>, on 12/04/97 at 05:39 PM,
Brandon>    Randal Schwartz <merlyn@stonehenge.com> said:
Brandon> +-----
Brandon> | On IRC-EFNET #perl the other day, we came up with some more precisely
Brandon> | accurate, but scary phrases:
Brandon> +--->8

Brandon> Waitaminute... you guys decided to get away from the trials of the noisegroups
Brandon> by moving to EFNet IRC?

Brandon> *boggle*

Actually, we take great pleasure in *immediately* informing people
that their question is a FAQ or can be found in the online
documentation.  Some of us even have aliases to do that. :-)

Also, to keep the gurus from leaving the EFNET-#perl channel, about
four months ago it was declared a "web free" zone.  No web questions
*at all* are permitted.  We send them to #cgi or #cgiperl instead,
which *we* don't monitor.

And every so often, someone comes along and says "why do you have
#perl as web-free?" So, we offer as proof a temporary suspension of
the ban, and to *answer* the next web question that comes along.
Invariably, it's something directly from a FAQ or from Tom's "Idiot's
Guide to CGI" or something that doesn't even involve Perl.  It makes a
quick believer out of them.  Too many people on IRC (like a number of
first-time posters here) somehow have the mistaken idea that "hacking
HTML" is only one small step below "hacking Perl".  Sorry... they
aren't even on the same continuum.

And I probably shouldn't tell you that we now auto-detect anyone that
joins #perl with an IRC client that's running on a Prisoner-of-Bill[1]
machine, and brace ourselves for questions that quickly demonstrate
how the person is unwilling/unable to do their homework first.  And
we're rarely disappointed.  <sigh>

[1] You know, stuff like Quake Loader 95, or Quake Loader NT, and
other pointy-hair-manager[2]-satisfying-but-technically-useless stuff
like that.

[2] Obligatory Dilbert[3] Reference

[3] Dilbert[4] is a trademark of somebody, not me.

[4] Dilbert[5] is a trademark of somebody, not me.

[5] Dilbert[5] (aha!) is a trademark of somebody, not me.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 269 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Fri, 5 Dec 1997 18:06:22 -0800
From: "Aaron Harsh" <ajh@rtk.com>
Subject: Re: eval and open: append vs new, i.e. >> vs >
Message-Id: <66absm$6b7$1@brokaw.wa.com>

Darwin O.V. Alonso wrote in message <669upe$j5a$1@nntp6.u.washington.edu>...
>
>Under some conditions I want to open a new file for writing,
>and under other conditions for appending to an existing file. I.E.:
>
>   open OUT,   "> $newfile"; vs open OUT,   ">> $file";


my $funnel = $condition ? ">" : ">>";
open(OUT, $funnel . $file);

Aaron Harsh
ajh@rtk.com




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

Date: 5 Dec 1997 20:08:57 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: evaluating $var within files?
Message-Id: <66ac3p$1bt@tekka.wwa.com>

erixred@idt.net writes:
>This has got to be so elementary that it escapes me.
>
>I've got a file with several variables in it
>(ie. $var1, $var2, etc..) that i would like to have evaluated
>by a PERL program like this:
>
>#!/usr/local/bin/perl
>$file = 'file2';
>
>        open(INPUT, "$file"); {
>             while (<INPUT>) {
>        print $_;
>        }
>         close (INPUT);
>        }
>
>
>But my $var's just don't get evaluated,

They won't. You need to "evaluate" them yourself. What does your
file look like?

Also, why have you enclosed the while statement in a block? (I am
asking because that might shed some light too).



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

Date: 05 Dec 1997 20:57:39 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: eric bucher <erixred@IDT.NET>
Subject: Re: evaluating $var within files?
Message-Id: <8clnxzktsc.fsf@gadget.cscaper.com>


<rootbeer_mode>

>>>>> "eric" == eric bucher <erixred@IDT.NET> writes:

eric> This has got to be so elementary that it escapes me.

[FAQ removed]

eric> What am I doing wrong?

You aren't reading the FAQ!

</rootbeer_mode>

:-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 269 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 6 Dec 1997 01:19:42 GMT
From: pojo@gte.net (Eric)
Subject: Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?
Message-Id: <66a97e$435$1@gte2.gte.net>

On Wed, 3 Dec 1997 13:56:55 GMT, swmcd@world.std.com (Steven W
McDougall) wrote:

>bart.mediamind@tornado.be (Bart Lateur) writes:
>
>>Or, change from provider. ;-)
>
>No smileys.
>If it's your ISP, get a new one.
>If it's your school, just grab Perl5 and install it yourself.
>If it's your employer, tell them you can't do the job without Perl5.

It's for a client that is getting free server space from a different
organization.

Cannot change ISP.

Can't install it myself. (or CAN I into a different dir ? Hmmm, wonder
if we have compiler access?)

Not my employer who owns the computer.


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

Date: 6 Dec 1997 01:21:03 GMT
From: pojo@gte.net (Eric)
Subject: Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?
Message-Id: <66a99v$435$2@gte2.gte.net>

>
>$b = $config{fields};
>local(*a) = $b;
>$a[$r];
>

This seems simple enough for my purposes.  Thank you!

-- Eric


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

Date: Sat, 06 Dec 1997 02:08:22 GMT
From: Guy Doucet <gdoucet@ait.acl.ca>
Subject: FORM MAIL for Novell Web Server
Message-Id: <3488B34F.D96C3871@ait.acl.ca>

I am not a network administrator, and not an experienced Perl
programmer.

I found a Form Mail Perl program but it was written for UNIX which is
obviously where Perl is most run. But we have a Web Server running by
Novell on a PC and was wondering if there is a way to send a form to an
email address in a similar way as to rid the text of &+etc...

I do know that our email is run by mercury or something and if it helps,
I know for sure that we can send commands to it by sending emails to
maiser@...

All help appreciated, Guy Doucet



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

Date: Sat, 06 Dec 1997 05:06:10 GMT
From: Guy Doucet <gdoucet@ait.acl.ca>
Subject: Re: FORM MAIL for Novell Web Server
Message-Id: <3488DD00.8367857A@ait.acl.ca>

Well, I found a SENDSMTP.PL script (part of a Toolkit v.2) from Novell's web
site at:

  http://support.novell.com/Ftp/Updates/nwos/nwebs30/Date0.html

The script asks for a MAILHOST that will accept and forward SMTP mail. The
script apparently uses the basic SMTP (HELO) as opposed to the enhanced
(EHLO). Don't ask me what all that means. But nonetheless when I enter the
IP address of my internet provider's MAIL server here in Canada (iStar), the
script comes back and says "Error: Mail command failed sending: HELO"  and
also "501 syntactically invalid HELO argument(s)". Apparently the istar mail
server is a POP3 Server if that means anything. I don't expect anyone to
download the script and troubleshoot it, but if any of the above means
anything to you, would you shed some light on me.

Thank you
Guy Doucet




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

Date: Sat, 6 Dec 1997 02:59:35 +0000
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: graphic file dimensions in PERL?
Message-Id: <Itw$7IAX+Li0EwKF@worsdall.demon.co.uk>

In article <3484D548.5081@aol.com>, ?@?.? writes
>Is there any way to determine the WIDTH and HEIGHT of a gif file using
>PERL?
>
>Thanks.
It's alright you lot constantly saying use this module, use that module,
but I cannot get the modules installed into my local-cgi-bin and my
administrator hasn't done it either so I always end up with permissions
problems.

So how about other ways of doing things? Please...

Mark.
-- 
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydeeATworsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk    WEB site:- http://www.shadow.org.uk


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

Date: Fri, 05 Dec 1997 23:20:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: graphic file dimensions in PERL?
Message-Id: <comdog-ya02408000R0512972320130001@news.panix.com>

In article <Itw$7IAX+Li0EwKF@worsdall.demon.co.uk>, Mark Worsdall <jaydee@worsdall.demon.co.uk> wrote:

>In article <3484D548.5081@aol.com>, ?@?.? writes
>>Is there any way to determine the WIDTH and HEIGHT of a gif file using
>>PERL?
>>
>>Thanks.
>It's alright you lot constantly saying use this module, use that module,
>but I cannot get the modules installed into my local-cgi-bin and my
>administrator hasn't done it either so I always end up with permissions
>problems.
>
>So how about other ways of doing things? Please...

how about downloading the module and installing it in your own directory?
it doesn't need to be installed in the cgi-bin directory.

or downloading the module and looking at the source for the function
that gives you the GIF size data?

or reading the GIF specification to see how the size information is
stored then writing a script to get it?

or several other ways to figure things out.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 6 Dec 1997 04:58:50 +0000
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: Re: graphic file dimensions in PERL?
Message-Id: <c73aOZAKuNi0EwpN@worsdall.demon.co.uk>

In article <comdog-ya02408000R0512972320130001@news.panix.com>, brian d
foy <comdog@computerdog.com> writes
>In article <Itw$7IAX+Li0EwKF@worsdall.demon.co.uk>, Mark Worsdall 
><jaydee@worsdall.demon.co.uk> wrote:
>
>>In article <3484D548.5081@aol.com>, ?@?.? writes
>>>Is there any way to determine the WIDTH and HEIGHT of a gif file using
>>>PERL?
>>>
>>>Thanks.
>>It's alright you lot constantly saying use this module, use that module,
>>but I cannot get the modules installed into my local-cgi-bin and my
>>administrator hasn't done it either so I always end up with permissions
>>problems.
>>
>>So how about other ways of doing things? Please...
>
>or downloading the module and looking at the source for the function
>that gives you the GIF size data?
>
Ok, I knew that, I thought of that already:-) hu:)
-- 
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydeeATworsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk    WEB site:- http://www.shadow.org.uk


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

Date: Fri, 05 Dec 1997 23:36:19 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help with VERY simple problem
Message-Id: <comdog-ya02408000R0512972336190001@news.panix.com>

In article <EKq5yr.6A9@boss.cs.ohiou.edu>, jhitesma@oucsace.cs.ohiou.edu (Jason Thomas Hitesman) wrote:


>(just the snippet of code I'm having problems with is included)
>
>while (<PFILE>) {
>        $rows[$i] = <PFILE>;
>        $i++;
>        }

you are only getting every other line of input that way.  perhaps
you wanted to do something like

   @rows = <PFILE>;

?  good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 6 Dec 1997 02:26:32 GMT
From: Zenin <zenin@best.com>
Subject: Re: How to create reference to anonymous scalar variable ?
Message-Id: <881375402.62270@thrush.omix.com>

Andrew M. Langmead <aml@world.std.com> wrote:
: make a local variable with my() inside your while loop. Assing to that
: local variable and make a reference to it. In the next iteration of
: the block, you will get a new local.

	Yes, but you don't need the extra variable, just my() the
	$line variable itself for the loop block.  On each iteration of
	the loop you'll get a new copy:

	while (defined (my $line = <FH>)) {
	    $hash{ $key1 } = \$line;
	    $hash{ $key2 } = \$line;
	}

	Just make sure you have a recent perl (5.004+) before trying this.

-- 
-Zenin
 zenin@best.com


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

Date: Fri, 05 Dec 1997 22:38:13 -0500
From: Kurt Schreiber <rfp@erienet.net>
Subject: inexact matches
Message-Id: <3488C8A5.B7D4AAB3@erienet.net>

I am having a hard time making a regular expression that matches almost
matches. For example, say the keyword is Kurt. I want Curt, Kirt, or
Cirt to match. How do I do this?

Thanks,
Kurt



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

Date: Fri, 5 Dec 1997 22:16:58 -0600
From: "Mark Rostron" <mwrostron@imation.com>
Subject: Re: inexact matches
Message-Id: <66ajlm$ooi2@zinc.imation.com>

Look into soundex. - there is a perl package I think which does this for you
mr.

Kurt Schreiber wrote in message <3488C8A5.B7D4AAB3@erienet.net>...
>I am having a hard time making a regular expression that matches almost
>matches. For example, say the keyword is Kurt. I want Curt, Kirt, or
>Cirt to match. How do I do this?
>
>Thanks,
>Kurt
>




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

Date: Fri, 05 Dec 1997 23:52:10 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Matching lowercase letter in regexp
Message-Id: <comdog-ya02408000R0512972352100001@news.panix.com>

In article <adelton.881315894@aisa.fi.muni.cz>, adelton@fi.muni.cz (Honza Pazdziora) wrote:

>Tom Phoenix <rootbeer@teleport.com> writes:
>
>> On Thu, 4 Dec 1997, Honza Pazdziora wrote:
>> 
>> > how do I match lowercase letter (locale-smart, of course)?

>So, the only way to do it currently is to match something and then
>check if after conversion to lowercase it's the same as before,
>right?

well, i can think of other ways, but they require lots o' code and
wasted time.  so it's not the "only" way, but it's a lot better than
some of the others :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 05 Dec 1997 23:26:15 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: need help with concatenation operation
Message-Id: <comdog-ya02408000R0512972326150001@news.panix.com>

In article <01bd01d6$40e63620$255583d0@lbowen.vic.com>, "Aqua Fantasies" <webmaster@aquafan.com> wrote:

>Could someone please explain what line 5 does in this little snippet of
>code?  It is derived from the Camel book and just doesn't make sense to me.

>05  $totals{$referer}  .= $total . " ";

what did it do when you tried it?

or when you made a simple test program that isolated that feature?

   #!/usr/bin/perl

   $_ = 'just another';
   
   $_ .= ' new york' . ' perl hacker';
   
   print;
   
   __END__

   just another new york perl hacker

based on that output, you could guess that the right hand side was
evaluated giving ' new york perl hacker', then concatenated to
the left hand side. :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 6 Dec 97 01:47:39 GMT
From: Tom <beans@bedford.net>
Subject: Re: Odd minus/modulus behavior
Message-Id: <3488aebb.0@news3.paonline.com>

mcafee@breakout.rs.itd.umich.edu (Sean McAfee) writes: > > perl -e 'print -3 % 4'
> 1
> > perl -e '$a = "xyz"; print -length($a) % 4'
> -3
> > perl -e '$a = "xyz"; print ((-length($a)) % 4)'
> -3
> > perl -e 'print ((-3) % 4)'
> 1
> > perl -e '$a = "xyz"; $b = length($a); print -$b % 4;'
> 1
> 
> Huh?
> 
> --
> Sean McAfee | GS d->-- s+++: a25 C++ US+++$ P+++ L E- W+ N++  |
>             | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+   | mcafee@
>             | R+ tv+ b++ DI++ D+ G e++>++++ h- r y+>++**      | umich.edu

Its not modulo, its the precedence between 
print, length, unary minus, and %

# Test script follows:

$\ = "\n";

$junk = "abcd";

$x = print length($junk);
print $x, "\n";

print length($junk)     % 3;
print (length($junk))   % 3;
print -length($junk)    % 3;
print -(length($junk)   % 3);
print (-length($junk))  % 3;
(print (-length($junk)))% 3;
print (-length($junk)   % 3);


# Produces:
#> 4
#> 1
#>
#> 1
#> 4
#> -1
#> -1
#> -4
#> -4
#> -1


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

Date: Fri, 05 Dec 1997 17:59:53 -0800
From: Kuntal Daftary <daftary@_remove_to_send_email_.cisco.com>
Subject: Re: oraperl
Message-Id: <3488B199.28E228F0@_remove_to_send_email_.cisco.com>

twod@not.valid wrote:
> 
> Kuntal Daftary (daftary@_remove_to_send_email_.cisco.com) wrote:
> : using sqlplus, i login using the following:
> : % sqlplus user/pass@db
> 
> Try doing:
> 
> $lda = &ora_login('', 'user/pass@db', '') ....

this worked. thank you very much.
(would had sent an email, but not a valid address :-))twod@not.valid
wrote:


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

Date: 6 Dec 1997 04:49:21 GMT
From: twod@not.valid
Subject: Re: oraperl
Message-Id: <66algh$nit$3@vnetnews.value.net>

Kuntal Daftary (daftary@_remove_to_send_email_.cisco.com) wrote:
: this worked. thank you very much.

Thanks for the thanks, not many people seem to bother these days.

: (would had sent an email, but not a valid address :-))twod@not.valid
: wrote:

See my signature.

Anyways, for an explanation of the difference please read the oraperl
documentation and, perhaps more importantly, have a dig through the 
Oraperl.pm module.

IAP

--
I am using anti-spam measures, please replace 'not.valid' with 'value.net'


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

Date: Fri, 05 Dec 1997 23:33:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL Backticks and Non-parsed Headers (NPH)
Message-Id: <comdog-ya02408000R0512972333560001@news.panix.com>

In article <19971205172600.MAA28425@ladder01.news.aol.com>, scriptman@aol.com (Scriptman) wrote:

>The following code CORRECTLY generates a non-parsed header (NPH) and allows me
>to see its output from my browser as it executes:

[snip]

>However, what I need to be able to do is to invoke an EXTERNAL script and have
>it work the same way.  The following code DOES NOT work:

[snip]

>print `/home/p_sattle/cgi-bin/nphcall.pl`;

[snip]

>Some type of buffering must be going on somewhere!  How do get the second 
>senerio to work like the first???

have you considered some of the options in the perlipc manual page.
perhaps IPC::Open2 instead of backticks.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 06 Dec 1997 03:04:39 GMT
From: mocat@NOSPAM.best.com (blacktape)
Subject: PERL Frusterations (semi-newbie)
Message-Id: <3488bef9.9286001@nntp.best.com>

I wrote a simple script for my friend, who is creating an extensive
music database, and doesn't want to type in all of the html for a 1+
meg file... what it does is this:

takes a tab delimited file:
genre	group	url
rock	aerosmith	http://www.aerosmith.com
etc etc..

and turns it into this:
<I>genre</I><B>group</B><A HREF="url">url</A>
<I>rock</I><B>aerosmith</B><A
HREF="http://www.aerosmith.com">www.aerosmith.com</A>

simple enough.

what i want to do with this script, is have it add in an <A
NAME="letter"> for the first occurance of each letter, a-z, in the
group name.

ie:

<A NAME="a"><I>rock</I><B>aerosmith</B><A
HREF="http://www.aerosmith.com">www.aerosmith.com</A>
<I>rock</I><B>anthrax</B><A
HREF="http://www.anthrax.com">www.anthrax.com</A>
etc etc for the A's, then onto the B's, C's... etc

how would i go about doing this?  i've tried a do {} until, read the
perlfaq and manpages, tried everything... but all i come up with is a
bunch of errors.

thanks for any help...

j


-j
the dumber a person is, the longer it will take for them to find out that you're killing them


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

Date: Sat, 06 Dec 1997 03:09:29 GMT
From: mingtian@hotmail.com (Gil)
Subject: Perl web chatroom, Chinese and Japanese code conversion available
Message-Id: <3489c1b6.1162510@news.kornet.nm.kr>

Chat with your honey :)

http://soback.kornet.nm.kr/~chlang/cutechat

 ...
Gil
Homepage: http://soback.kornet.nm.kr/~chlang/
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
!F 1W4k 3*?!0T4B >pA&3* GQ<[@L 2I@L?4@84O 0q8q1f 59>F3*?@4B  !F
">   594c ?6?!<- H/Hw 9L<RA~0m @V4B 5i2I GQ<[@L?M55 00>F    ">
!F     H%@Z@V>n >5>5GQ 3*@G 0!=??! Hq8A@; @|GXAV4x 2I        !F
!F                  "4^7!<- >HAV8i ;/>n6s"                   !F
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">


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

Date: Fri, 05 Dec 1997 23:54:11 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl4 is not Y2K (was Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?)
Message-Id: <comdog-ya02408000R0512972354110001@news.panix.com>

In article <Pine.GSO.3.96.971205131905.29415Q-100000@usertest.teleport.com>, Tom Phoenix <rootbeer@teleport.com> wrote:

>On Fri, 5 Dec 1997, Bart Lateur wrote:
>
>> So what will people think of Perl4 once we get to, say, Perl9?
>
>That's an idea: Make the next version of Perl have a number that's so
>large that nobody will want to keep using Perl4.
>
>    Perl98!

why not Perl2000?  then Perl would really have a 2000 problem.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
the was some marketing drivel the dealt with the Product2000 trick
   disappearing, and 3000 being to far way.


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

Date: 6 Dec 1997 05:41:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl4 is not Y2K (was Re: Forced to use brain-dead perl 4 -- how do I accomplish task that is simple in perl 5 ?)
Message-Id: <slrn68hpfb.175.abigail@betelgeuse.wayne.fnx.com>

Tom Phoenix (rootbeer@teleport.com) wrote on 1557 September 1993 in
<URL: news:Pine.GSO.3.96.971205131905.29415Q-100000@usertest.teleport.com>:
++ 
++     Perl98!
++ 
++ Hmmm... On the other hand...

On the other hand is Visual Perl ++ with Javabeans!



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Fri, 05 Dec 1997 23:40:28 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL<-->databases ???(newbie)
Message-Id: <comdog-ya02408000R0512972340280001@news.panix.com>

In article <669b6q$og5@bagan.srce.hr>, dboraska@jagor.srce.hr (Damir Boraska) wrote:

>HI there..I hope that there should be someone outhere who will help me with
>this *problem*...
>I'm using perl just ocasionally,so my knowledge of it is not really  
>impressive..however I find perl great for writing cgi scripts.
>I need to write web form-data into a database,and also to offer a search
>of the same database...

if you are new to databases, you might want to read a database book
to get the general idea of how databases work and what to watch
out for.  there might even be something like this on the net.

then you need to find a database product to use, or develop one yourself
(perhaps a flat file database?). if you choose a third party product, the
documentation should have  everything you need to know to work with it.

from the Perl side, you can look at the Database section of CPAN [1] to 
see what is available (lots and lots and lots) for interfaces and so
on.

good luck :)

[1] 
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Sat, 6 Dec 1997 02:32:18 +0000
From: Mark Worsdall <jaydee@worsdall.demon.co.uk>
Subject: perlsec setuid and my confusion and security issues please
Message-Id: <R9p5vGAykLi0EwI1@worsdall.demon.co.uk>

Hi,

I have a program that has become necessary to start from a setuid wrap
program. This is working fine and the tainted data is flinging stuff
out:-)

My problem id a lcak of truely  understanding what is happening.

This variable has been set at the beginning of the script;-
# Path of servers mail program
$mailprog = '/usr/sbin/sendmail';


Now later on (thanks Mat), I open the program by:-
# Open The Mail Program
open(MAIL,"|$mailprog -t") or die "Error opening $mailprog: $!";
select(MAIL);

So how has $mailprog become tainted? it was set within the program. Is
it because I am calling an external program? as stated in the perlsec
man. I do not quite get how the example works from the man.

Can I just replace the 2 lines above with:-

$ENV{PATH} = '/usr/sbin/sendmail';
open(MAIL,"|$_ -t") or die "Error opening $_: $!";
select(MAIL);

The other confusion is that there is data from the outside world that is
to be simply passed onto the mail program for mailing, so tainted no
action will be initiated upon the data, so why worry? (Though I am).

The only external data which actions will be taken upon are:-

$ENV{'HTTP_X_FORWARDED_FOR'}

What I do is drop all spaces.
Seperate out multiple IP's
the dns a single one
(Not implemented yet but a search for a webpage done on dns result is
resolved)
mail program opened (ran)
all external data sent to it
if dns failed then traceroute is ran on original IP number given by
$ENV{'HTTP_X_FORWARDED_FOR'}
mail program is closed.

Now this has been working fine but I am altering the program to monitor
more effectively since our bandwidth has gone up. Using the setuid
wrapper program to call the perl script (the wrapper program is called
via an SSI and the program exists in a home directory NOT www
directory), the script will create a file called by the IP number passed
by $ENV{'HTTP_X_FORWARDED_FOR'}, unless it exists in a specified
directory and then write the necessary data to it.

So what are the problems if any and how best to get my program running
safely?

Mark.

-- 
Mark Worsdall - Oh no, I've run out of underpants :(
Home:- jaydeeATworsdall.demon.co.uk  WEB site:- http://www.worsdall.demon.co.uk
Shadow:- webmasterATshadow.org.uk    WEB site:- http://www.shadow.org.uk


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

Date: 5 Dec 1997 19:44:03 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: problem with my() and s//
Message-Id: <66aal3$svo@tekka.wwa.com>

mreimer@vpop.net writes:
>I'm trying to do variable substitution on a scalar with s//, but
>apparently it won't work with my variables. Is this a bug? Anybody have
>a workaround?

The problem is not with s//, it's just that a my variable is not
available as ${$1}. What you are trying to do is approximately
what's done by double quotes. The difference is you seem to want
to do variable substitutions only on \$\w+ patterns. If so, my
(silly) solution is:

	s/(\$\w+)/$1/gee;

	
>#!/usr/local/bin/perl5
>
>my $SOME_VAR = "ABCD";  # take out my and it will work
>my $string = 'the variable is $SOME_VAR';
>
>$string =~ s/\$(\w+)/${$1}/g;
>print "string: $string\n";
>
>exit;



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

Date: Fri, 05 Dec 1997 23:29:28 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: problem with my() and s//
Message-Id: <comdog-ya02408000R0512972329280001@news.panix.com>

In article <34888C91.BABA9887@vpop.net>, Matthew Reimer <mreimer@vpop.net> wrote:

>I'm trying to do variable substitution on a scalar with s//, but
>apparently it won't work with my variables. Is this a bug? Anybody have
>a workaround?

>$string =~ s/\$(\w+)/${$1}/g;

the main problem (not the only one), is that symbolic references don't
work with my() variables.  it's not a bug.  for the details, you might
look into the first few chapters of the panther book [1].

[1] 
Advanced Perl Programming
Sriram Srinivasan
ISBN 1-56592-220-4
<URL:http://www.oreilly.com>

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 5 Dec 1997 19:51:01 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: searching indexed file
Message-Id: <66ab25$5n@tekka.wwa.com>

smith@twsuvm.uc.twsu.edu writes:
>I am looking for a more efficient way of searching an indexed file
>than using regular expressions.  I am using Perl for Win32.  Any help
>would be much appreciated.

"Indexed file" isn't enough information. What's the format of the file
and of the index?



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

Date: 6 Dec 1997 02:42:45 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: size of a DB
Message-Id: <66ae35$58k@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <3483D8BF.7E42@mch.sni.de>,
Harald Joerg  <Harald.Joerg@mch.sni.de> wrote:
>...and be aware that SDBM_File is broken on FAT (i.e. non-NT) file
>systems, and hence on Windows95. The activeware release notes said
>so, but the problem apparently persists with 5.004.
>Try the following code:
[..code gone..]
>This code should run forever, but it doesn't on Win95: On
>my PC it terminates with "429 keys added, 377 keys found".
>You don't actually *lose* the records, just the keys() and
>values() function returns wrong values.

Just to provide another data point, the code runs fine (2560 keys and
counting) on NTFS, but fails with "429 keys added, 377 keys found"
on a Samba-exported directory, on Windows NT 4.0(SP3).  I don't have
FAT volumes under NT to test.

Looks like MS have yet another bug to fix in their filesystem code, eh?
Pitiful.

 - Sarathy.
   gsar@umich.edu


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

Date: Fri, 05 Dec 1997 23:48:18 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: sub in .pm!!!!!
Message-Id: <comdog-ya02408000R0512972348180001@news.panix.com>

In article <667flr$rri$1@its.hooked.net>, james@zaire.hooked.net (James Dornan) wrote:

>I created my first sub in a pm file and I wanted to use it to set all
>kinds of variables. Unlike a sub from withing the script, it does not
>share variale space. How do I change this?

do you really want to do such a thing?

i won't mention anything like fully qualified variable names
because you might actually use them.  oops, kinda slipped out... :)

at least Perl doesn't have a shotgun.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

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

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