[13527] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 937 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 28 23:07:17 1999

Date: Tue, 28 Sep 1999 20:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938574309-v9-i937@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 28 Sep 1999     Volume: 9 Number: 937

Today's topics:
    Re: Advice wanted: Creating an .exe (Abigail)
    Re: Advice wanted: Creating an .exe (Abigail)
    Re: array & textfield??! (Abigail)
    Re: cgi calendar (Abigail)
    Re: Checking disk space with this script sends unknown  (Abigail)
    Re: Database Help needed (Mark A. Hershberger)
    Re: Database Help needed (Abigail)
    Re: Do you now an affordable Perl editor for Windows NT (Mark A. Hershberger)
    Re: Expert question: wrapping a subroutine (Abigail)
    Re: How to append an extension to a value in a variable (Abigail)
    Re: Looking for Downloadscript (Abigail)
    Re: LOST NEWBIE (Randal L. Schwartz)
    Re: Pathetic Question for the Newbie <danestrom@poppulse.com>
        Perl - SQL examples (Jason Q.)
    Re: Perl Question (Larry Rosler)
        Perl, HTML to Sendmail... <myriad@erols.com>
    Re: Please compare and contrast C and Perl. (Abigail)
    Re: Please compare and contrast C and Perl. (Mathew A. Hennessy)
        Putting SSI's into perl scripts undersail@hotmail.com
    Re: Putting SSI's into perl scripts <arunas@an!m.org>
    Re: qx// and here doc puzzle (Ilya Zakharevich)
    Re: Randomize array..... (Abigail)
    Re: Regex == Turing? (was remove the html tag in the fi (Randal L. Schwartz)
    Re: Sorting weird numeric data (Larry Rosler)
    Re: Suggestion - comp.lang.perl.flame (was Re: You shou <mpersico@erols.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 28 Sep 1999 21:17:53 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Advice wanted: Creating an .exe
Message-Id: <slrn7v2u50.9kl.abigail@alexandra.delanet.com>

William (bivey@teamdev.com) wrote on MMCCXVIII September MCMXCIII in
<URL:news:01bf0932$c83207c0$3527e1ce@bill.jump.net>:
^^ 
^^ Problem2: Some of customer's installations use an older
^^ 		Perl (5.003_07) and don't appear to have LWP
^^ 		installed.
^^ 
^^ Solution2: Create a stand-alone executable using a script
^^ 		that does what's needed and perlapp or some such.
^^ 

Wrong. Solution2 is to ship LWP as well. No Perl distribution comes
with LWP anyway.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 21:19:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Advice wanted: Creating an .exe
Message-Id: <slrn7v2u8g.9kl.abigail@alexandra.delanet.com>

Eric The Read (emschwar@rmi.net) wrote on MMCCXVIII September MCMXCIII in
<URL:news:xkf905shshu.fsf@valdemar.col.hp.com>:
[] 
[] Solution3: Get customer to install a version of perl that's not several
[] years old, and not ridden with CERT advisories, bugs, and other, um,
[] "hidden features".  As a side effect, this will include the LWP module,
[] thus saving you much time & effort.  If customer is recalcitrant, mention 
[] liability incurred by running software with known bugs and security
[] problems.  Also mention happy-fun-nifty new features included in modern
[] Perls.


Really? Which Perl distribution comes with LWP? Not 5.005_03.



Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 21:23:03 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: array & textfield??!
Message-Id: <slrn7v2uem.9kl.abigail@alexandra.delanet.com>

HKS (hks3@usa.net) wrote on MMCCXIX September MCMXCIII in
<URL:news:37f03933.0@news.highway1.com.au>:
<>
<>    i had a hidden textfield in the form, and i want to print all elements in
<> the array which i created using perl(e.g @num = 1,2,3,4) to that textfield.
<> Is that a way to do it?


print @num;



Abigail
-- 
sub J::FETCH{Just   }$_.='print+"@{[map';sub J::TIESCALAR{bless\my$J,J}
sub A::FETCH{Another}$_.='{tie my($x),$';sub A::TIESCALAR{bless\my$A,A}
sub P::FETCH{Perl   }$_.='_;$x}qw/J A P';sub P::TIESCALAR{bless\my$P,P}
sub H::FETCH{Hacker }$_.=' H/]}\n"';eval;sub H::TIESCALAR{bless\my$H,H}


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 21:43:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi calendar
Message-Id: <slrn7v2vka.9kl.abigail@alexandra.delanet.com>

Yutung Liu (ytliu@cgi-factory.com) wrote on MMCCXIX September MCMXCIII in
<URL:news:7sqlom$gna$1@jetsam.uits.indiana.edu>:
** How do we define the date in a cgi calendar? Is there any special formula
** for doing it?


Yeah. CGI calendars have 23 months, each having 7 weeks of 13 days each.
Except the blue months, they have 11 weeks of 5 days each.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 21:47:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Checking disk space with this script sends unknown error
Message-Id: <slrn7v2vrj.9kl.abigail@alexandra.delanet.com>

Christopher Smiga (csmigaNOcsSPAM@yahoo.com.invalid) wrote on MMCCXIX
September MCMXCIII in <URL:news:283beef1.e97ac348@usw-ex0108-060.remarq.com>:
,, When I use this PERL script on a Sun system.  I get an
,, error message that I do not understand.

Did you check 'perldiag' ?



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 21:03:39 -0500
From: mah@everybody.org (Mark A. Hershberger)
Subject: Re: Database Help needed
Message-Id: <49so3ya2ys.fsf@playpen.baileylink.net>

"David Scally" <scall@scallynet.co.uk> writes:

> We currently use a method of plain HTML editing and FTPing to update the
> site, but I was hoping to add make the news section database-driven.

> How hard would it be to do something like this? Would anyone be able to give
> me the coding or something to do this?

Solutions for this already exist.  They are known as Content
Management Systems.  Cameron Barrett (http://www.camworld.com) is
currently looking to find a new one for his site.  The most promising
from a perl/dbi and cost standpoint looks to be MasonHQ
(http://www.masonhq.com/).  You can find his complete comparison chart
at <http://www.camworld.com/misc/cms.html>.

Hope this helps.

Mark.


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

Date: 28 Sep 1999 21:50:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Database Help needed
Message-Id: <slrn7v302p.9kl.abigail@alexandra.delanet.com>

David Scally (scall@scallynet.co.uk) wrote on MMCCXIX September MCMXCIII
in <URL:news:7sr8rk$bee$1@gxsn.com>:
// 
// I help run a website, which has news which has to be updated nearly daily.
// We currently use a method of plain HTML editing and FTPing to update the
// site, but I was hoping to add make the news section database-driven.

Even if it's "database driven" (I wonder what kind of database that is...)
someone has to type in the news....  Or do you mean that the database
makes and types in the news?

// I've seen site which have news items at say:
// 
// www.domain.com/news/view_article?32.asp
// 
// How hard would it be to do something like this?

Djee. What kind of answer do you expect? What might be hard for someone,
is trivial for someone else. There's no absolute scale of difficultness.

//                                                 Would anyone be able to give
// me the coding or something to do this?

Well, wouldn't that be easy.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 21:31:45 -0500
From: mah@everybody.org (Mark A. Hershberger)
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <49puz2a1ny.fsf@playpen.baileylink.net>


[mailed and posted]

> >I just installed Perl on my PC (Windows NT) and would like to get a
> >nice editor to edit my Perl code. I looked at a few commercials
> >ones but they are too expensive (and have way too many features for
> >myt needs anyway).
> >
> >I just need cheap, freeware or chareware editor that could do code
> >identing and/or keywords coloring and stuff like that.  I'm looking
> >for an editor that would be just a little more programmer friendly
> >that Wordpad...
> 

Look at NTEmacs.  It is free, it is written for programmers and it is
more powerful than any proprietary editor you could find.  The
included cperl-mode is better than the default perl-mode.  The latest
cperl-mode can be found on CPAN (http://www.cpan.org/).

To find it, do a search on google (http://www.google.com) for
"ntemacs".

Oops, I just did that in emacs (the Unix version).  Here is the URL:
http://www.cs.washington.edu/homes/voelker/ntemacs.html

Some people find emacs bloated.  For them, I would recommend vim
(http://www.vim.org/).

Both of these editors will do what you want and a lot more.  Both are
free.  Both have complete source available.

Good luck,

Mark.


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

Date: 28 Sep 1999 20:20:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Expert question: wrapping a subroutine
Message-Id: <slrn7v2qpn.9kl.abigail@alexandra.delanet.com>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCCXIX September
MCMXCIII in <URL:news:7sqm85$80h$1@lublin.zrz.tu-berlin.de>:
<> Johan Vromans <JVromans@Squirrel.nl> wrote in comp.lang.perl.misc:
<> >A problem I recently encountered and haven't been able to solve yet...
<> >
<> >I use a module, but I'd like to change one of its subroutines.
<> >Basically, I want to redefine the subroutine (that's no problem) but
<> >then call the original subroutine from the new one. This way I can
<> >prepare subroutine parameters and manipulate the subroutine result
<> >without the need to change the calls everywhere.
<> 
<> Sure.  You can alias the given sub to a typeglob:
<> 
<> *given_orig = \&given;
<> 
<> You may want to do this in a begin block to make sure it has
<> happened before it is called.  Then redefine
<> 
<> sub given {
<>   my @param = @_;
<>   # Prepare stuff, modifying @param (say)
<>   my $result = given_orig( @param); # Call the original
<>   # modify $result
<>   return $result;
<> }

That doesn't work. All it does is *aliasing* &given_orig and &given. If
you then redefine &given, &given_orig changes as well (-w will issue a
warning). The above example leads to infinite recursion.

However, the following ought to work:

    #!/opt/perl/bin/perl -w

    use strict;

    sub given {
        print "$_[0]: In old sub given\n";
    }

    given 1;

    {no strict 'refs';
     *{'given_orig'} = *{'given'};
     *{'given'}      = *{'given_new'};
    }

    sub given_new {
        print "$_[0]: In new sub given\n";
        &given_orig (@_);
    }

    given 2;

    __END__
    1: In old sub given
    2: In new sub given
    2: In old sub given


<> >Hypothetical example:
<> >
<> >  use File::Basename;
<> 
<> You probably meant to say File::Spec here.

Actually, File::Spec::Functions;



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 20:30:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to append an extension to a value in a variable
Message-Id: <slrn7v2rd2.9kl.abigail@alexandra.delanet.com>

David (yngwie@home.com) wrote on MMCCXIX September MCMXCIII in
<URL:news:37F0F7F4.814666E1@home.com>:
== I need to add an extension (.wav) to a scaler variable value.


Did you try reading the manual?



Abigail
-- 
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
 |perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
 |perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
 |perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 20:32:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Looking for Downloadscript
Message-Id: <slrn7v2rf2.9kl.abigail@alexandra.delanet.com>

Ilia Benderski (bendersk@in.tum.de) wrote on MMCCXVIII September MCMXCIII
in <URL:news:37EF268E.E2991560@in.tum.de>:
//
// I want, that script downloads files from Internet to my Computer

And why do you ask here?


Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 18:51:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: LOST NEWBIE
Message-Id: <m1hfkebi2y.fsf@halfdome.holdit.com>

>>>>> "Mathew" == Mathew A Hennessy <hennessy@cloud9.net> writes:

>> Don't try this on a large directory, say 1000 files or more, without 
>> being prepared to go out for a cup of coffee while it churns away stat-
>> ting each of those files far too many times.

Mathew> 	does find2perl / File::Find optimize this?  (probably..)

No.  find2perl and File::Find do no sorting.  You get things in
internal directory order.

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: Tue, 28 Sep 1999 19:47:59 -0700
From: Dane Strom <danestrom@poppulse.com>
Subject: Re: Pathetic Question for the Newbie
Message-Id: <37F17DDF.77A83D56@poppulse.com>


> CGI.pm is included with the standard distribution of
> Perl, and has been since-- hey, does anybody know?  Well, it's been in
> there since 5.004 for sure.  

5.004 it is.

> > Example (all be it pathetic):
> 
> That's "albeit".  Not a spelling flame, just thought you'd care.
> 
> -=Eric

Or, "albite" if you're ysdexic.

Cheers,
Dane the Strom

-- 
danestrom@poppulse.com
http://www.popppulse.com

"Suppose you were an idiot. And suppose you were a member
of Congress. But I repeat myself."
--MARK TWAIN, a Biography

How come dumb stuff seems so smart while you're doing it? 
--DENNIS THE MENACE 
        
It is difficult to produce a television documentary that is 
both incisive and probing when every twelve minutes one is 
interrupted by twelve dancing rabbits singing about toilet paper. 
--R. SERLING


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

Date: Wed, 29 Sep 1999 02:38:57 GMT
From: jason@generationterrorists.com (Jason Q.)
Subject: Perl - SQL examples
Message-Id: <37f479dc.2094102@news.cyberway.com.sg>

Hi

Where on to net can I find examples/tutorials on using Perl together
with SQL commands?

In particular, I'm looking to query a database with multiple keywords
using SQL and Perl.

Thanks



JQ


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

Date: Tue, 28 Sep 1999 18:07:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl Question
Message-Id: <MPG.125b06312f17cf29989ff7@nntp.hpl.hp.com>

In article <37F15987.55AF676@mail.cor.epa.gov> on Tue, 28 Sep 1999 
17:12:55 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Dheera wrote:
> > $test_proj_n_page="gridSearch/pgHomeDefault?";
> > 
> > if($test_proj_n_page=~/([^\/]*)\/([^\/]*)\?/){
> >   $test_proj_n_page=~s/([^\/]*)\/([^\/]*)\?/
> > $test_projectname=$1;$test_pagename=$2/e;
> > }
> > print "$test_projectname\n$test_pagename;"

This snippet is extraordinarily painful to read.

Is that last semicolon supposed to be printed, or to terminate the 
statement?

> Yes, it is a very good idea to test that the match has been
> successful before assigning using $1, $2, etc.

And how about not printing garbage if the test fails?

Doing those assignments in the eval'ed RHS of a substitution, destroying 
the input value for no purpose, is very weird. 

> ...  And you don't need to backwhack
> a slash *inside* a character class, you know.

You do when the slash is foolishly used as the regex delimiter, as in 
this case.

I guess one could rewrite that mess this way:

    if (($test_projectname, $test_pagename) =
            $test_proj_n_page =~ m%(.+)/(.+)\?%) {
       print "$test_projectname\n$test_pagename\n";
    }

But splitting on m%[/?]% is surely cleaner.

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


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

Date: Tue, 28 Sep 1999 22:39:26 -0400
From: "Myriad" <myriad@erols.com>
Subject: Perl, HTML to Sendmail...
Message-Id: <7sru2f$so4$1@autumn.news.rcn.net>

Hello, I'm looking for info on how to recode my Perl script to send HTML
enabled mail via Sendmail.  Can anyone help?




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

Date: 28 Sep 1999 20:42:28 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Please compare and contrast C and Perl.
Message-Id: <slrn7v2s2j.9kl.abigail@alexandra.delanet.com>

Neil (neil@pacifier.com) wrote on MMCCXIX September MCMXCIII in
<URL:news:37f04e55.0@news.pacifier.com>:
'' Please compare and contrast the two languages.

Perl is a four letter word!

'' I am aware that Larry Wall wrote Perl in C.

That's about the only difference. C was not written by Larry Wall.


Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 29 Sep 1999 01:57:18 GMT
From: hennessy@cloud9.net (Mathew A. Hennessy)
Subject: Re: Please compare and contrast C and Perl.
Message-Id: <rv2sfunt3i511@corp.supernews.com>

In article <slrn7v2s2j.9kl.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Neil (neil@pacifier.com) wrote on MMCCXIX September MCMXCIII in
><URL:news:37f04e55.0@news.pacifier.com>:
>'' Please compare and contrast the two languages.
>
>Perl is a four letter word!

	Yes, but a _nice_ FLW..  I doubt the FCC would have a problem
permitting the discussion of Perl on the radio..  Java, on the other
hand..

>Abigail

	btw: if you use trn, you can avoid these threads..  the <shift>
and 'd' keys on your kybd seem to be functional.. ;)

(ooh, I forgot, I may have been plonked years ago..)

-- 
If it sounds too good to be true, it's probably Linux.
"Fool! There is nothing Perl cannot do! NOTHING!" -Bastich
"You can never entirely stop being what you once were. That's why it's important
to be the right person today, and not put it off till tomorrow." - Larry Wall


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

Date: Wed, 29 Sep 1999 01:57:14 GMT
From: undersail@hotmail.com
Subject: Putting SSI's into perl scripts
Message-Id: <37f171e8.18881924@news.direcpc.com>

I have an ad banner serving program for my website that requires me to
insert an SSI into my pages. The tag is something to the effect of
<!--include virtual="/bin/adserve.ps?position=toppage">

That's fine for pages I'm editing with FrontPage, but I also have perl
scripts for a bulletin board program I use so the ads will be pasted
on all the messages and followups posted. One programmer told me that
I just need to stick the tag into my script, but it always seems to
break it. I think it's supposed to follow a print NEWFILE command in
the subroutine for printing the messages, but what's the exact form
the tag should take? When I try just putting in the SSI right after
NEWFILE without any characters, it simply doesn't paste the ad on the
page.

Any ideas what might be missing? I'm obviously a novice at this and
any help would be greatly appreciated. 

Thanks in advance.

tom@teleprise.com


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

Date: Tue, 28 Sep 1999 20:25:09 -0600
From: "Arunas Salkauskas" <arunas@an!m.org>
Subject: Re: Putting SSI's into perl scripts
Message-Id: <37f17889@news.cadvision.com>

It probably leaves the SSI directive in there too.

This is a web server question, and is best directed at the appropriate
group:

comp.infosystems.www.server.unix

or

comp.infosystems.www.server.www

Either way, you would have to specify what server you're working with,
because that is key to this working.  In fact, with Apache, the FAQ
specifically states that Apache doesn't do this, that is parse the results
of CGI programs.

--
--
- Arunas Salkauskas
High Point Designs
www.highpointdesigns.com

undersail@hotmail.com wrote in message
<37f171e8.18881924@news.direcpc.com>...
>I have an ad banner serving program for my website that requires me to
>insert an SSI into my pages. The tag is something to the effect of
><!--include virtual="/bin/adserve.ps?position=toppage">
>
>That's fine for pages I'm editing with FrontPage, but I also have perl
>scripts for a bulletin board program I use so the ads will be pasted
>on all the messages and followups posted. One programmer told me that
>I just need to stick the tag into my script, but it always seems to
>break it. I think it's supposed to follow a print NEWFILE command in
>the subroutine for printing the messages, but what's the exact form
>the tag should take? When I try just putting in the SSI right after
>NEWFILE without any characters, it simply doesn't paste the ad on the
>page.
>
>Any ideas what might be missing? I'm obviously a novice at this and
>any help would be greatly appreciated.
>
>Thanks in advance.
>
>tom@teleprise.com




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

Date: 29 Sep 1999 02:12:31 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: qx// and here doc puzzle
Message-Id: <7srsif$39k$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Gyepi SAM
<gyepi@praxis-sw.com>],
who wrote in article <slrn7v1t2c.n30.gyepi@magnetic.praxis-sw.com>:
> 	#this works as expected.
> 	$retval=<<`EOC`;
> 	date
> EOC

This is not ``-operator.  This is <<-pseudo-operator with a ``-modifier.

> 	$retval=qx(<<EOC);
> 	echo unreachable code
> EOC;

Here you have bona fide qx()-operator.  It runs the program "<<EOF"
(whatever it means).  You can get a similar result with

	$retval = `<<EOC`;

or

	$program = "<<EOC";
	$retval = `$program`;

> Am I missing something or is perl?

Hope this helps,
Ilya


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

Date: 28 Sep 1999 20:53:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Randomize array.....
Message-Id: <slrn7v2smi.9kl.abigail@alexandra.delanet.com>

David Cassell (cassell@mail.cor.epa.gov) wrote on MMCCXVIII September
MCMXCIII in <URL:news:37EFFEDC.E69D71E2@mail.cor.epa.gov>:
-- Samuel Kilchenmann wrote:
-- [snip]
-- > But one question is not answered in perlfaq4:
-- > How random is the shuffling of arrays  with (lets guess) more than 15
-- > elements, using the builtin rand()?
-- > Some hints or pointers to hints would be very welcome.
--
-- Oddly enough, it 'looks' fairly random.  The Fisher-Yates
-- algorithm in the FAQ is a good choice of algorithm [what a
-- surprise, like tom is going to choose a loser algorithm to
-- stick in his FAQ].  And the pseudo-random number generator 
-- seems to work pretty well for me.  I.e., as I evaluated it, 
-- the rand() call passed the basic tests I tried.
-- [BTW: This is perl, version 5.005_03 built for sun4-solaris]

From Algorithm::Numerical::Shuffle, a module that implements the Fisher
Yates algorithm:

    =head1 CAVEAT

    Salfi [4] points to a big caveat. If the outcome of a random generator
    is solely based on the value of the previous outcome, like a linear
    congruential method, then the outcome of a shuffle depends on exactly
    three things: the shuffling algorithm, the input and the seed of the
    random generator. Hence, for a given list and a given algorithm, the
    outcome of the shuffle is purely based on the seed. Many modern computers
    have 32 bit random numbers, hence a 32 bit seed. Hence, there are at
    most 2^32 possible shuffles of a list, foreach of the possible algorithms.
    But for a list of n elements, there are n! possible permutations.
    Which means that a shuffle of a list of 13 elements will not generate
    certain permutations, as 13! > 2^32.

    [4] R. Salfi: I<COMPSTAT 1974>. Vienna: 1974, pp 28 - 35.


Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 28 Sep 1999 18:50:33 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Regex == Turing? (was remove the html tag in the file)
Message-Id: <m1ln9qbi52.fsf@halfdome.holdit.com>

>>>>> "Kenneth" == Kenneth Bandes <kbandes@home.com> writes:

Kenneth> Indeed, and they make Perl regexps more expressive than standard
Kenneth> ones.  But they do not make them capable of handling general
Kenneth> context-free grammars.  Most useful languages have matched pairs of 
Kenneth> unlike things, whereas back-references can find matched pairs (or 
Kenneth> other combinations) of like things.  But parentheses, curly braces, 
Kenneth> <em>start and end tags</em>, and so forth are not amenable to this 
Kenneth> technique.

But Perl regex have *MORE* than backreferences... they have *code*.

If you haven't seen the (?{ code block here }) in 5.5's regexen, you
probably are lost here. :)

require 5.005; /(?{ 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: Tue, 28 Sep 1999 18:42:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting weird numeric data
Message-Id: <MPG.125b0e6868abb18f989ff8@nntp.hpl.hp.com>

In article <slrn7v2lg7.9kl.abigail@alexandra.delanet.com> on 28 Sep 1999 
18:50:17 -0500, Abigail <abigail@delanet.com> says...
> Bob Walton (bwalton@rochester.rr.com) wrote on MMCCXIX September MCMXCIII
> in <URL:news:37F02930.F3C909C@rochester.rr.com>:
> [] Mike Sosteric wrote:
> [] > 
> [] > How can I sort strings like this
> [] > 
> [] > 1.1
> [] > 1.1.1
> [] > 1.1.2
> [] > 1.2
> [] > 1.3
> 
> 
> I think there's a module on CPAN somewhere, but this ought to work as well:

Indeed it does, for some values of 'as well'.  It certainly is cute, 
though.  (A variable-length-laddered Schwartz-Transform comparison sub.)


Benchmark: timing 16384 iterations of Abigail, Packed...
   Abigail: 43 wallclock secs (43.11 usr +  0.00 sys = 43.11 CPU)
    Packed: 15 wallclock secs (14.62 usr +  0.00 sys = 14.62 CPU)


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

my @unsorted = qw( 10.0 1.1 1.1.1 1.1.2 1.2 1.3 1.1.0 1.1.0.0 1.1.0.0.0
    1.2.0 1.3.0 2 2.255 2.0.0.0.255 0.1 0 0.0 );

sub Abigail {
   my @sorted = map  {join "." => @$_}
              sort {my $i = 0;
                     {defined $a -> [$i] or return defined $b -> [$i] ?
                          -1 : 0;
                      defined $b -> [$i] or return 1;
                      $a -> [$i] <=> $b -> [$i] or ++ $i && redo}}
              map  {[split /\./ => $_]}
              @unsorted;
}

sub Packed {
   my @sorted = map substr($_, 5) =>
      sort
      map  pack('C5' => split /\./) . $_ => @unsorted;
}

timethese(1 << (shift || 0), {
  Abigail => \&Abigail,
  Packed  => \&Packed ,
});

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


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

Date: Tue, 28 Sep 1999 21:06:55 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Suggestion - comp.lang.perl.flame (was Re: You should be admired)
Message-Id: <37F1662F.F30801C2@erols.com>

Abigail wrote:

> No. There's already a CGI group, and people don't post there. What makes
> you think that another CGI group would solve the problem?
> 

I think the key is that 'perl' and 'cgi' must be in the name together.
There are plenty of cgi groups, true. But the posts we get are perl/cgi
queries.

Now, on my ISP's server, a quick look for newsgroups with cgi in them
reveals about 10 of them. Of those, the only ones with 'perl' in the names
are

alt.comp.perlcgi.freelance
de.comp.lang.perl.cgi

The 'main' group appears to be

comp.infosystems.www.authoring.cgi

None of these (to me anyway) is what I consider obvious enough for a newbie
to stumble across. So what does s/he do next? Turns to the B<language> that
is being used to implement cgi and that leads them straight to
comp.lang.perl.misc.

That's my reasoning for thinking that comp.lang.perl.cgi would siphon off a
good deal of the noise in clp.misc. You have to stop thinking B<reasonably>
here and put yourself in the place of a hapless programmer who has grown up
on CS courses with no hardware training, learned his skills from a
correspondance course or a "For Dummies" book and simply has not had the
training in scholarship that would lead to the asking of a question to be
the B<last> resort instead of the first.

Not that I know about haplessnes and lack of scholorship from experience; I
just happen to be good at channeling. :-)

-- 
Matthew O. Persico
    
"Tell me Larry, what part of this newsgroup _is_ in good taste?" -
Elaine -HFB- Ashton <elaine@chaos.wustl.edu> in comp.lang.perl.misc


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

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


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