[19248] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1443 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 4 18:05:43 2001

Date: Sat, 4 Aug 2001 15:05:08 -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: <996962707-v10-i1443@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 4 Aug 2001     Volume: 10 Number: 1443

Today's topics:
    Re: comp.infosystems.www.authoring.cgi now moderated <tsee@gmx.net>
    Re: comp.infosystems.www.authoring.cgi now moderated <godzilla@stomp.stomp.tokyo>
    Re: comp.infosystems.www.authoring.cgi now moderated <godzilla@stomp.stomp.tokyo>
    Re: comp.infosystems.www.authoring.cgi now moderated (Randal L. Schwartz)
    Re: comp.infosystems.www.authoring.cgi now moderated <godzilla@stomp.stomp.tokyo>
    Re: comp.infosystems.www.authoring.cgi now moderated <revjack@revjack.net>
    Re: comp.infosystems.www.authoring.cgi now moderated <godzilla@stomp.stomp.tokyo>
    Re: Database Problem blah@blah.blah.invalid
    Re: Database Problem <godzilla@stomp.stomp.tokyo>
    Re: Database Problem <krahnj@acm.org>
    Re: Engineering vs. Hacking (was Re: How to supply modu <newspost@coppit.org>
    Re: Engineering vs. Hacking (was Re: How to supply modu (David H. Adler)
    Re: Engineering vs. Hacking (was Re: How to supply modu <monty@primenet.com>
        FAQ: How do I process an entire hash? <faq@denver.pm.org>
        function prototype, file includes, arrays to functions <sh@planetquake.com>
    Re: How to use IO::Handle to open a pipe thedoctor@space.net
        newbe help please sending arguments to a cgi script via <none@nowere.com>
    Re: newbe help please sending arguments to a cgi script <godzilla@stomp.stomp.tokyo>
    Re: newbe help please sending arguments to a cgi script <none@nowere.com>
    Re: Optimum Sum? benhopkins@mindspring.com
        reading and writing arrays <nathan.randle@ntlworld.com>
    Re: reading and writing arrays (Logan Shaw)
    Re: reading and writing arrays <nathan.randle@ntlworld.com>
    Re: reading and writing arrays (Logan Shaw)
    Re: reading and writing arrays <krahnj@acm.org>
    Re: Save memory and measure used memory??? <iltzu@sci.invalid>
    Re: Script works on PWS but not IIS? <skoehler@upb.de>
        Thanks for all the help <nathan.randle@ntlworld.com>
    Re: What's the  regular expression to check emails and  <iltzu@sci.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 4 Aug 2001 19:26:16 +0200
From: "Steffen Mόller" <tsee@gmx.net>
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <9khb24$56a$00$1@news.t-online.com>

"Alan J. Flavell" <flavell@mail.cern.ch> schrieb im Newsbeitrag
news:Pine.LNX.4.30.0108041607500.20736-100000@lxplus023.cern.ch...

[snip]

> Here's what Tom Boutell, the promoter of the automoderation scheme,
> claimed about it as of around 1998:
>
> http://www.boutell.com/boutell/usenet.html
>
> I won't say it's been a disaster - far from it: it's been an
> interesting experiment, but it has quite a few shortcomings to balance
> against the benefits.
>
> I'd certainly like to see some fine-tuning done to its bot rules: on
> the one hand to keep out more spam, and on the other hand to allow
> some perfectly proper usenet techniques, like moving a discussion to
> or from the group by means of crosspost-and-followup, or like the
> original author issuing a replacement posting with Supersedes: header.
>
> Anyhow, I'm afraid I'm drifting off-topic for here.


To get you back on-topic:
What language are the bots written in? Why don't you offer to improve them
if you want and can?

Steffen






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

Date: Sat, 04 Aug 2001 10:57:34 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <3B6C378E.D223DFD4@stomp.stomp.tokyo>

Randal L. Schwartz wrote:
 
> >>>>> Godzilla! wrote:
 
(snipped)

> Godzilla!> The charter for the cgi group indicates self-moderation and
> Godzilla!> provides a methodology for this so all can post. This is
> Godzilla!> no longer true. Boutell has imposed restrictions of his own,
> Godzilla!> in violation of the group's charter and in violation of
> Godzilla!> long standing USENET traditions.
 
> Nope.  He's the moderator.  He can change the charter unilaterally,
> "according to longstanding Usenet traditions".
 


  "This system was approved by a popular vote of 200 to 30
   on October 5th, 1996. It is the result of a democratic
   election held according to USENET guidelines."

       - Gary Boutell



> If you have an issue with this, take it to news.admin.* groups, not
> comp.lang.perl.*, because it's very much off-topic here.


Yes, this is off-topic. However, it is ok for other regulars
here to periodically discuss and currently discuss Boutell's
newsgroup but, it is not ok for me, personally, to engage in
the same activity.

This is senseless.


Doesn't matter I suppose. I have resolved his blocking of
my posts by hacking his newsgroup.


Godzilla!


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

Date: Sat, 04 Aug 2001 11:07:07 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <3B6C39CB.63F2991B@stomp.stomp.tokyo>

Godzilla! wrote:

(snipped)

>   "This system was approved by a popular vote of 200 to 30
>    on October 5th, 1996. It is the result of a democratic
>    election held according to USENET guidelines."
> 
>        - Gary Boutell
 
Strike that.

         - Tom Boutell

Mr. Boutell, whatever.


Godzilla!  Queen Of Noms.


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

Date: 04 Aug 2001 11:19:24 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <m1lmkz3cyb.fsf@halfdome.holdit.com>

>>>>> "Godzilla!" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

>> Nope.  He's the moderator.  He can change the charter unilaterally,
>> "according to longstanding Usenet traditions".
 
Godzilla!>   "This system was approved by a popular vote of 200 to 30
Godzilla!>    on October 5th, 1996. It is the result of a democratic
Godzilla!>    election held according to USENET guidelines."

Godzilla!>        - [Tom] Boutell

Yup.  There you have it.  By popular vote, he's been made the
moderator.  After that, he's the czar.  This is the "longstanding
Usenet tradition".

Godzilla!> Doesn't matter I suppose. I have resolved his blocking of
Godzilla!> my posts by hacking his newsgroup.

If you forge approvals, your posts may be removed unilaterally without
notification.  This is also a "longstanding Usenet tradition".

Kira, just post using your real address.  You've already used your
real address in the past.  Get over it.

-- 
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: Sat, 04 Aug 2001 11:36:03 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <3B6C4093.5864F5DE@stomp.stomp.tokyo>

Randal L. Schwartz wrote:
 
> >>>>> Godzilla! wrote:
 
(snipped)

> Godzilla!> Doesn't matter I suppose. I have resolved his blocking of
> Godzilla!> my posts by hacking his newsgroup.
 
> If you forge approvals, your posts may be removed unilaterally without
> notification.  This is also a "longstanding Usenet tradition".
 

Otherwords, he will practice discriminatory censorship
in violation of the cgi group's democratically created
newsgroup charter. This reminds me of unpleasant events
which took place here in the now quite distant past.


Godzilla!


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

Date: 4 Aug 2001 19:48:09 GMT
From: revjack <revjack@revjack.net>
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <9khjhp$2ld$3@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:

: Doesn't matter I suppose. I have resolved his blocking of
: my posts by hacking his newsgroup.

If you forge approvals to moderated newsgroups, I'll do
whatever I can to get your account yoinked. (You're probably
just trolling Randal, but maybe not everyone knows this) 

Just get a hotmail account for this sort of thing, that's
what I do. 


RJ, NetKKKop
-- 
___________________
revjack@revjack.net


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

Date: Sat, 04 Aug 2001 13:11:11 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: comp.infosystems.www.authoring.cgi now moderated
Message-Id: <3B6C56DF.1D84BF49@stomp.stomp.tokyo>

revjack wrote:
 
> Godzilla!  wrote:
 
 (snipped)

> : Doesn't matter I suppose. I have resolved his blocking of
> : my posts by hacking his newsgroup.
 
> If you forge approvals to moderated newsgroups, I'll do
> whatever I can to get your account yoinked. (You're probably
> just trolling Randal, but maybe not everyone knows this)
 

I would suggest both you and Randal smarten up a bit.

  "PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
   SELF-MODERATED newsgroup. aa.net and boutell.com are
   NOT the originators of the articles and are NOT responsible
   for their content."


What part of this statement do neither of you USENET Cops understand?

You personally are bordering on unlawful harassment which can
be resolved by filing of a criminal complaint with your local
law enforcement agency, an activity in which I have engaged
in the past, as documented in this group's archives.


Godzilla!


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

Date: Sat, 04 Aug 2001 16:34:42 GMT
From: blah@blah.blah.invalid
Subject: Re: Database Problem
Message-Id: <CuVa7.644$q73.76891263@newssvr17.news.prodigy.com>

John W. Krahn <krahnj@acm.org> wrote:
> Walnut wrote:
>> 
>> On 24 Jul 2001 08:00:08 -0700, tommyumuc@aol.com (JR) wrote:
>> 
>> >
>> > my $typeChange = $q->param('typeChange');
>> 
>> This should change all the newlines to spaces.
>> 
>> my $typeChange = $q->param('typeChange') =~ s/\n*/\s/g;
> 
> No, that will change newlines to the letter s.

the '\n*' is a mistake too, since it'll match, well, everything.
try '\n+' instead.  And as someone else mentioned, wrap parens
around the assignment.


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

Date: Sat, 04 Aug 2001 12:30:55 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Database Problem
Message-Id: <3B6C4D6F.B64FB946@stomp.stomp.tokyo>

blah@blah.blah.invalid wrote:
 
> John W. Krahn wrote:
> > Walnut wrote:
> >> tommyumuc wrote:

> >> > my $typeChange = $q->param('typeChange');

> >> This should change all the newlines to spaces.

> >> my $typeChange = $q->param('typeChange') =~ s/\n*/\s/g;

> > No, that will change newlines to the letter s.
 
> the '\n*' is a mistake too, since it'll match, well, everything.
> try '\n+' instead.  And as someone else mentioned, wrap parens
> around the assignment.

Actually this incorrect syntax posted by the troll Walnut,
doesn't match literally everything. It does certainly match
in ways you don't expect as you have indicated. Krahn is
also correct about the troll's syntax replacing newlines
with a letter s. These troll's like Walnut, are not real
bright boys.


Godzilla!
--

#!perl

print "Content-type: text/plain\n\n";

$string = "line one
line two
line three";


print "Before: $string\n\n";

$string =~ s/\n*/\s/g;

print "After: $string";


print "\n\n";


$string = "line one
line two
line three";

print "Before: $string\n\n";

$string =~ s/\n*/X/g;

print "After: $string";

exit;


PRINTED RESULTS:
________________

Before: line one
line two
line three

After: slsisnses sosnsesslsisnses stswsosslsisnses stshsrseses


Before: line one
line two
line three

After: XlXiXnXeX XoXnXeXXlXiXnXeX XtXwXoXXlXiXnXeX XtXhXrXeXeX





-- 
$_="47‡85•58535‡575—5—5…‡“515…0";
tr/…‡‰873514“•—™›/975318642abcdef/;
s/([0-9A-Fa-f]{2})/sprintf("%c",hex($1))/ge;
tr/“”•–—˜™š›œ‚ƒ„…†‡ˆ‰Š‹ŒŽ/ H-OV-ZP-UA-G/;
print$_=reverse$_;exit;


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

Date: Sat, 04 Aug 2001 20:56:18 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Database Problem
Message-Id: <3B6C616E.E6CBF09@acm.org>

blah@blah.blah.invalid wrote:
> 
> John W. Krahn <krahnj@acm.org> wrote:
> > Walnut wrote:
> >>
> >> On 24 Jul 2001 08:00:08 -0700, tommyumuc@aol.com (JR) wrote:
> >>
> >> >
> >> > my $typeChange = $q->param('typeChange');
> >>
> >> This should change all the newlines to spaces.
> >>
> >> my $typeChange = $q->param('typeChange') =~ s/\n*/\s/g;
> >
> > No, that will change newlines to the letter s.
> 
> the '\n*' is a mistake too, since it'll match, well, everything.
> try '\n+' instead.  And as someone else mentioned, wrap parens
> around the assignment.

No, it won't match everything, it will match zero or more newlines or
the (zero width) space between characters.

$ perl -le '$_ = "THE\n QUICK\n BROWN\n FOX\n"; print; s/\n*/\s/g;
print'
THE
 QUICK
 BROWN
 FOX

sTsHsEss sQsUsIsCsKss sBsRsOsWsNss sFsOsXss



John
-- 
use Perl;
program
fulfillment


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

Date: Sat, 04 Aug 2001 14:07:03 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Engineering vs. Hacking (was Re: How to supply modules with your       software.)
Message-Id: <3B6C39C7.40007@coppit.org>

Godzilla! wrote:
> David H. Adler AKA The CLPM Troll
> deliberately trolled using an article nearly a month old:
>
>>>"...do not advocate this position."
>  
>>You have omitted the beginning of that statement.  It started with the
>>word "please", which, in normal english parlance makes it a request,
>>rather than a demand.

[snip]

> "Please shut up right now."
> 
> Use of "please" certainly changes insulting context
> to one of sundry pleasantries.

You forget the way the police say "Please step out of the car" :)

In any case, I have said repeatedly that I did not intend a command but 
rather a request. If you still insist on believing that I meant the 
former, I guess there's nothing I (or Adler) can say to convince you 
otherwise.

Unfortunately, the point of my post has gotten lost in all of this 
useless name calling. :(

David



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

Date: 4 Aug 2001 21:50:07 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Engineering vs. Hacking (was Re: How to supply modules with your       software.)
Message-Id: <slrn9morgf.mhi.dha@panix6.panix.com>

In article <3B6C39C7.40007@coppit.org>, David Coppit wrote:
> Godzilla! wrote:
>> David H. Adler AKA The CLPM Troll
>> deliberately trolled using an article nearly a month old:

Odd.  This response seems not to have turned up here.  Thanks for
pointing it out.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
They'll need a crane.
	- They Might Be Giants


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

Date: 4 Aug 2001 19:31:55 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Engineering vs. Hacking (was Re: How to supply modules with your      software.)
Message-Id: <9khijb$gae$1@nnrp2.phx.gblx.net>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Clear to me as a long time English teacher and English professor ...

[*What* is clear to you? Did you mean *it* is clear to you? What's
a "long time" teacher? Did you mean "longtime" teacher?]

You're fuvggva' me! If this is true, let's hope your poor students
will somehow eventually learn the correct use of "who" and "whom":

    "Not surprising there are a handful of regulars here whom would
    have this group moderated as well."

    "My opinion is those sponsors whom violate the sancity [sancity?]
    of USENET, display a lack of good ethics." [Not a lack of *bad
    ethics*?]

    "I don't take much of a hankering [*Take* a hankering?] to
    those whom decide use [Did you intend *to use* the infinitive
    form here?] an iron fist approach to administration of a
    newsgroup."

> ... your reading comprehension skills do not surpass those of typical
> middle school students; eleven to thirteen year olds. Should I elect
> to comment upon your displayed intellectual skills, my comments would
> be less than complimentary.

Glass houses, throwing stones, yada yada yada.

> * thinks this troll is desperate for fresh troll bait articles *

What's a "troll"?

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Sat, 04 Aug 2001 18:17:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I process an entire hash?
Message-Id: <x_Wa7.28$T3.171059200@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I process an entire hash?

    Use the each() function (see the each entry in the perlfunc manpage) if
    you don't care whether it's sorted:

        while ( ($key, $value) = each %hash) {
            print "$key = $value\n";
        }

    If you want it sorted, you'll have to use foreach() on the result of
    sorting the keys as shown in an earlier question.

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.53
-- 
    This space intentionally left blank


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

Date: Sat, 04 Aug 2001 21:48:03 GMT
From: "Sean Hamilton" <sh@planetquake.com>
Subject: function prototype, file includes, arrays to functions
Message-Id: <n4_a7.28060$b_3.2278520@news0.telusplanet.net>

1. Having a strong background in C and similar, I am somewhat surprised to
find that you cannot do the following in Perl:

sub myprint ($text)
{
    print ($text);
}

myprint ('bleh');

Am I just horribly mistaken, or is there some weird syntax involved, or
what? Must I use shift? That seems error-prone.

2. Is this the best way to mimic a server side include?

open (FILE, '<', shift);
print while read (FILE, $_, 16384);
close (FILE);

3. How might I go about passing an array to a function? It seems to just get
mashed into the argument list. I tried passing a reference to that array,
but then couldn't find information on any sort of indirection operator.

sh




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

Date: Sat, 04 Aug 2001 22:01:07 GMT
From: thedoctor@space.net
Subject: Re: How to use IO::Handle to open a pipe
Message-Id: <3b6c7077$1$oeczf$mr2ice@news.earthlink.net>

In <slrn9mmrvd.mr8.see-sig@typhoon.xnet.com>, on 08/04/01 
   at 03:45 AM, see-sig@from.invalid (David Efflandt) said:

>> How do you open a pipe with IO::Handle?

>perldoc perlipc

Thanks for the pointer. It got me to IPC::Open2 and open2 which I tried. 
I think it did what it is supposed to do, but I haven't completely solved
my problem.

I'll describe it and maybe someone will show me a way:

My script is using perlTk for its user interface. I have a frame that has
several [4] buttons; one calls a sub to start recording a sound file from
/dev/audio.  It launches a rec process for which I get a pid; I then kill
the pid when I push the button that stops the recording.  I think the rec
is starting another process with sox [there is one left after the program
completes and it hogs /dev/audio.]

Am I wrong about the origin of the sox process, and how can I kill it when
I kill the rec process. Here are the two subs that are doing the creation
and destruction.

sub recMsg {
#my $ent = shift;
if ($ent) {
	my $v =$ent->get;
	my $vorig = $v . ".au";
#record message thru sound card
#	print "start recording; type ctrl-c when finished";
my $pid = open2(\*READR, \*RCONTROL, "rec -d /dev/audio $vorig"); #open
(RCONTROL, "| rec -d /dev/audio $vorig");
# test to see when RCONTROL disappears
waitpid ($pid,"");
	my $vnu = $v . ".au";
	`autopvf $vorig | pvftormd US_Robotics 4 > $vnu`;
}
else {
$NOPLAYFILE->Show eq 'OK';
}
}
sub stopRec {
	print RCONTROL \cC;
	close RCONTROL;
}

Thanks for all the help.

Paul Schwartz

-- 
-----------------------------------------------------------
Reply to brpms at earthlink dot net
-----------------------------------------------------------



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

Date: Sat, 04 Aug 2001 18:00:38 +0100
From: fred58 <none@nowere.com>
Subject: newbe help please sending arguments to a cgi script via ssi
Message-Id: <8n9omtkgesate2hrphkrpmjp13ba4vjvjj@4ax.com>

I wrote a very simple script to output a some dynamic content for my
web site but i cant seem to call it using ssi, it works fine up until
i want to send arguments to the script through ssi ne way here is the
script. 


#!/usr/bin/perl

parse_form();

if ($FORM{'special'}) {
special();
} else {
news();
  }


sub special {
print <<EOFORMS;
special bit goes here        
EOFORMS
;
}#end sub special


sub news {
print <<EOFORMS;
Well the new site is up feel free to browse through 
EOFORMS
;
}#end sub news


sub parse_form {

   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
   if (length($buffer) < 5) {
         $buffer = $ENV{QUERY_STRING};
    }
 
  @pairs = split(/&/, $buffer);
   foreach $pair (@pairs) {
      ($name, $value) = split(/=/, $pair);

      $value =~ tr/+/ /;
      $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

      $FORM{$name} = $value;
   }
}


ok if i put this in my shtml page <!--#exec cgi="news.cgi"--> i get no
problem it puts the text from the news sub where i want it to go but
if i try this <!--#exec cgi="news.cgi?special=special"--> it just
errors now i know the script works but the ssi doesn't seem to be able
to process the arguments, is there any way of doing this.

Any help gratefully received.


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

Date: Sat, 04 Aug 2001 10:42:06 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: newbe help please sending arguments to a cgi script via ssi
Message-Id: <3B6C33EE.59E5EAED@stomp.stomp.tokyo>

fred58 wrote:

(snipped)
 
> I wrote a very simple script to output a some dynamic content for my
> web site but i cant seem to call it using ssi, it works fine up until
> i want to send arguments to the script through ssi ne way here is the
> script.


> ok if i put this in my shtml page <!--#exec cgi="news.cgi"--> i get no
> problem it puts the text from the news sub where i want it to go but
> if i try this <!--#exec cgi="news.cgi?special=special"--> it just
> errors now i know the script works but the ssi doesn't seem to be able
> to process the arguments, is there any way of doing this.


You could have resolved your problem with less than ten minutes
of research and reading. There are literally hundreds of sites
on our internet which discuss Server Side Include techniques.

A query string cannot be included in an  #exe cgi  style call.
You need to use an  #include virtual  style call.

<!--#include virtual="news.cgi?special=special" -->


Godzilla!
-- 
$_="47‡85•58535‡575—5—5…‡“515…0";
tr/…‡‰873514“•—™›/975318642abcdef/;
s/([0-9A-Fa-f]{2})/sprintf("%c",hex($1))/ge;
tr/“”•–—˜™š›œ‚ƒ„…†‡ˆ‰Š‹ŒŽ/ H-OV-ZP-UA-G/;
print$_=reverse$_;exit;


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

Date: Sat, 04 Aug 2001 18:52:59 +0100
From: fred58 <none@nowere.com>
Subject: Re: newbe help please sending arguments to a cgi script via ssi
Message-Id: <nidomto99u6mi2os6pt36ou3bb1rf6o1sc@4ax.com>

On Sat, 04 Aug 2001 10:42:06 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:

>You could have resolved your problem with less than ten minutes
>of research and reading. There are literally hundreds of sites
>on our internet which discuss Server Side Include techniques.
>
>A query string cannot be included in an  #exe cgi  style call.
>You need to use an  #include virtual  style call.
>
><!--#include virtual="news.cgi?special=special" -->
>
>
>Godzilla!


Thanks for the help.




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

Date: Sat, 4 Aug 2001 14:27:29 -0700
From: benhopkins@mindspring.com
Subject: Re: Optimum Sum?
Message-Id: <1cphk9.nc8.ln@127.0.0.1>

Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> benhopkins@mindspring.com wrote:

> (snipped to fit on a CD)

<snip>

> Oh my, its a rehash of the Knapsnack problem from a
> few weeks back.

>  
>> Any suggestions?

> Yeah, spare us the aggravation and simply post this
> code you have already written to resolve your
> Napster Knapsnack problem.


#!/usr/bin/perl -w 

use strict; 
use strict 'vars'; 
use MP3::Info; 
{
sub print_cd(@@\@);
my ($file, $junk); 
my $cd_limit = 4800;		# seconds (80x60)
my ($time, $min, $sec);
my ($cd_number, $total_cd);
my @songs;
my @cd;

$cd_number = 1;
$total_cd = 0;

foreach $file (`find /home/ben/music -name ""*.mp3""`) {
	chomp $file;
	($min, $sec) = get_time($file);
	$time = ($min * 60) + $sec;
	$file .= '$%$' . $time;
	push(@songs, $file);
}

fisher_yates_shuffle(\@songs);    # permutes @songs in place

do {
	$junk = pop(@songs);
	($file, $time) = split(/\$%\$/, $junk);
	if ($total_cd + $time > $cd_limit) {
		push(@songs, $junk);
		print_cd($total_cd, $cd_number, @cd);
		@cd = ();
		$total_cd = 0;
		$cd_number++;
	} else {
		$total_cd += $time;
		push(@cd, $junk);
	}
} while (@songs);

print_cd($total_cd, $cd_number, @cd);
}

#	Taken (copied shamelessly) from perlfaq4:
# fisher_yates_shuffle( \@array ) :
# generate a random permutation of @array in place

sub fisher_yates_shuffle {
	my $array = shift;
	my $i;

	for ($i = @$array; --$i; ) {
		my $j = int rand ($i+1);
		next if $i == $j;
		@$array[$i,$j] = @$array[$j,$i];
	}
}

sub get_time {

	my $file = shift;
	my ($min, $sec); 
	my $info;

	$info = get_mp3info($file); 
	($min, $sec) = split(/:/, $info->{TIME});
	return($min, $sec);
}

sub print_cd (@@\@){
	my $time = shift;
	my $cd_number = shift;
	my @cd = @_;
	my ($min, $sec);
	my ($sname, $file, $junk);

	$sec = $time % 60;
	$time -= $sec;
	$min = $time / 60;
	printf "cd #%02d (time %02d:%02d)\n", $cd_number, $min, $sec;
#	print "cd #$cd_number (time $min:$sec)\n";

	foreach $junk (@cd) {
		($file, $time) = split(/\$%\$/, $junk);
		$sec = $time % 60;
		$time -= $sec;
		$min = $time / 60;
		$sname = $file;
		$sname =~ s/.*\/([^\/]+)$/$1/;
		printf "\t%02d:%02d - $sname\n", $min, $sec;
#		print "\t$min:$sec - $sname\n";
	}
	print "\n";
}


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

Date: Sat, 4 Aug 2001 20:47:20 +0100
From: "Nathan Randle" <nathan.randle@ntlworld.com>
Subject: reading and writing arrays
Message-Id: <wkYa7.2938$hs5.718238@news2-win.server.ntlworld.com>

I am trying to read a whole file into an array change one of the elements
then save the whole array overwriting all the data in the file. I have used
the code below to select which element is being changed then write over the
file but when I run it only the element i changed is saved so there is only
1 line in my file.

Any help appreciated.

open(MAP,">template.dat") or die("Coldn't open file for writing: $! \n");
flock(MAP,2);

@data = <MAP>;
$data["(($FORM{'codtwo'}-1)*30)+$FORM{'codone'}"]="$FORM{'north'}|$FORM{'eas
t'}|$FORM{'south'}|$FORM{'west'}|$FORM{'marks'}|";

print MAP "@data";
close(MAP);

Thanks in advance
Nathan Randle




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

Date: 4 Aug 2001 15:10:39 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: reading and writing arrays
Message-Id: <9khkrv$2pj$1@charity.cs.utexas.edu>

In article <wkYa7.2938$hs5.718238@news2-win.server.ntlworld.com>,
Nathan Randle <nathan.randle@ntlworld.com> wrote:
>I am trying to read a whole file into an array change one of the elements
>then save the whole array overwriting all the data in the file. I have used
>the code below to select which element is being changed then write over the
>file but when I run it only the element i changed is saved so there is only
>1 line in my file.
>
>Any help appreciated.
>
>open(MAP,">template.dat") or die("Coldn't open file for writing: $! \n");

Using ">template.dat" to open the file will, IIRC, open it for writing,
not for updating.  That means the file will be truncated to zero bytes
upon opening.  I think you want to use "+<template.dat" instead.

>flock(MAP,2);
>
>@data = <MAP>;
> 
>$data["(($FORM{'codtwo'}-1)*30)+$FORM{'codone'}"]="$FORM{'north'}|$FORM{'eas
>t'}|$FORM{'south'}|$FORM{'west'}|$FORM{'marks'}|";

Here @data is an array, which means it has numerical indices.  Yet, for
some reason, you're using a quoted string as an index.

If $FROM{codtwo} has the value 41 and $FORM{codone} has the value 99,
you're going to be creating an string index that looks like this:

	"((41-1)*30+99"

Perl will have to convert this into a number, and I've forgotten what
the rules are, but I think it will either convert it into zero or
into 41, neither of which is what you want.

>print MAP "@data";

Since you have just read the file, the file's pointer is currently at
the end of the file.  If you print stuff to the file, it will append to
the file instead of overwriting it.  You probably want to do a

	seek (MAP, 0, 0);

to rewind the file before you print to it.

Also, you've again used double quotes in a way that isn't helpful or
necessary.  If you are used to programming in Unix shells, you have to
keep in mind that with Perl, double quotes aren't necessary to prevent
the shell from interpreting things like whitespace in the value of a
string variable.

Hope that helps.

  - Logan
-- 
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)


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

Date: Sat, 4 Aug 2001 21:15:57 +0100
From: "Nathan Randle" <nathan.randle@ntlworld.com>
Subject: Re: reading and writing arrays
Message-Id: <mLYa7.3124$hs5.743177@news2-win.server.ntlworld.com>

thanks for the help but is their a way to calculate like I have tried to
without perl thinking it's a string ??

Logan Shaw <logan@cs.utexas.edu> wrote in message
news:9khkrv$2pj$1@charity.cs.utexas.edu...
> In article <wkYa7.2938$hs5.718238@news2-win.server.ntlworld.com>,
> Nathan Randle <nathan.randle@ntlworld.com> wrote:
> >I am trying to read a whole file into an array change one of the elements
> >then save the whole array overwriting all the data in the file. I have
used
> >the code below to select which element is being changed then write over
the
> >file but when I run it only the element i changed is saved so there is
only
> >1 line in my file.
> >
> >Any help appreciated.
> >
> >open(MAP,">template.dat") or die("Coldn't open file for writing: $! \n");
>
> Using ">template.dat" to open the file will, IIRC, open it for writing,
> not for updating.  That means the file will be truncated to zero bytes
> upon opening.  I think you want to use "+<template.dat" instead.
>
> >flock(MAP,2);
> >
> >@data = <MAP>;
> >
>
>$data["(($FORM{'codtwo'}-1)*30)+$FORM{'codone'}"]="$FORM{'north'}|$FORM{'ea
s
> >t'}|$FORM{'south'}|$FORM{'west'}|$FORM{'marks'}|";
>
> Here @data is an array, which means it has numerical indices.  Yet, for
> some reason, you're using a quoted string as an index.
>
> If $FROM{codtwo} has the value 41 and $FORM{codone} has the value 99,
> you're going to be creating an string index that looks like this:
>
> "((41-1)*30+99"
>
> Perl will have to convert this into a number, and I've forgotten what
> the rules are, but I think it will either convert it into zero or
> into 41, neither of which is what you want.
>
> >print MAP "@data";
>
> Since you have just read the file, the file's pointer is currently at
> the end of the file.  If you print stuff to the file, it will append to
> the file instead of overwriting it.  You probably want to do a
>
> seek (MAP, 0, 0);
>
> to rewind the file before you print to it.
>
> Also, you've again used double quotes in a way that isn't helpful or
> necessary.  If you are used to programming in Unix shells, you have to
> keep in mind that with Perl, double quotes aren't necessary to prevent
> the shell from interpreting things like whitespace in the value of a
> string variable.
>
> Hope that helps.
>
>   - Logan
> --
> "Our grandkids love that we get Roadrunner and digital cable."
> (Advertisement for Time Warner cable TV and internet access, July 2001)




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

Date: 4 Aug 2001 16:02:40 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: reading and writing arrays
Message-Id: <9khntg$31s$1@charity.cs.utexas.edu>

In article <mLYa7.3124$hs5.743177@news2-win.server.ntlworld.com>,
Nathan Randle <nathan.randle@ntlworld.com> wrote:
>thanks for the help but is their a way to calculate like I have tried to
>without perl thinking it's a string ??

Double quotes always form a string.  You don't want a string, so
don't use the double quotes.

Example:

	$x[ 1 + 2 ]

instead of:

	$x[ "1 + 2" ]

Hope that helps.

  - Logan
-- 
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)


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

Date: Sat, 04 Aug 2001 21:11:08 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: reading and writing arrays
Message-Id: <3B6C64EA.62CF6CB6@acm.org>

Nathan Randle wrote:
> 
> I am trying to read a whole file into an array change one of the elements
> then save the whole array overwriting all the data in the file. I have used
> the code below to select which element is being changed then write over the
> file but when I run it only the element i changed is saved so there is only
> 1 line in my file.
> 
> Any help appreciated.
> 
> open(MAP,">template.dat") or die("Coldn't open file for writing: $! \n");
> flock(MAP,2);
> 
> @data = <MAP>;
> $data["(($FORM{'codtwo'}-1)*30)+$FORM{'codone'}"]="$FORM{'north'}|$FORM{'eas
> t'}|$FORM{'south'}|$FORM{'west'}|$FORM{'marks'}|";
> 
> print MAP "@data";
> close(MAP);


use Fcntl ':flock';

open MAP, '+< template.dat' or die "Couldn't open template.dat: $!";
flock MAP, LOCK_EX;

my @data = <MAP>;
$data[ ( $FORM{'codtwo'} - 1 ) * 30 + $FORM{'codone'} ] =
   
"$FORM{'north'}|$FORM{'east'}|$FORM{'south'}|$FORM{'west'}|$FORM{'marks'}|\n";

seek MAP, 0, 0 or die "Couldn't rewind template.dat: $!";
truncate MAP, 0 or die "Couldn't truncate template.dat: $!";
print MAP @data;
close MAP;

__END__



John
-- 
use Perl;
program
fulfillment


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

Date: 4 Aug 2001 17:04:00 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Save memory and measure used memory???
Message-Id: <996943633.25902@itz.pp.sci.fi>

In article <9kgde1$488to$1@ID-101658.news.dfncis.de>, Markus wrote:
>
>What is the most memory-saving efficient way to store the rules?
>Note that many rules begin with the same symbols.
>
>Is this better:
>$rules{'A'}{'MPN'}{'NP'} = 1;
>$rules{'A'}{'MPN'}{'NP'}{'$.'} = 1;
>$rules{'A'}{'MPN'}{'NP'}{'CARD'}{'$.'} = 1;
>
>or this:
>$rules{'A MPN NP'} = 1;
>$rules{'A MPN NP $.'} = 1;
>$rules{'A MPN NP CARD $.'} = 1;

My guess is the latter should take less memory.  Nested hashes have
quite noticeable overhead, since each subhash takes a hash entry + key,
a reference and the hash itself.  That adds up to over a hundred bytes.
The extra key length in the second solution should be insignificant in
comparison.


>The Benchmark module says access time using the latter method is faster.
>But what is less memory-intensive?
>Is there a way to measure the memory used by a certain data structure?

On unix, you can use ps to show the size of the process before and after
building a huge data structure.  That should give some idea.

[Followups narrowed to comp.lang.perl.misc only.]

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Sat, 4 Aug 2001 18:26:01 +0200
From: "Sven Kφhler" <skoehler@upb.de>
Subject: Re: Script works on PWS but not IIS?
Message-Id: <9kh7lb$k2r$01$1@news.t-online.com>

BTW: you can turn this of by turn some options off in the PWS ...
don't ask me how these options are called in english - but it should be
something like "integrated windows authentication" ... just below the box
for the "cleartext authentication" which should be turned on in order to
make authentication work with any non-MS browser ...

"Alex" <samara_biz@hotmail.com> schrieb im Newsbeitrag
news:c7d9d63c.0108030452.2d5a82dc@posting.google.com...
> "Sven K?ler" <skoehler@upb.de> wrote in message
news:<9kbuon$86c$07$1@news.t-online.com>...
> > perhaps you use IE ... and IE automatically logs you in as the user you
> > are - for example administrator :-) - which gives the script the rights
of
> > the administrator ...
>
> Yep. I do use IE and I am logged in as an administrator on the local
> machine. That must be the reason why the script works on PWS on the
> local machine, but not on IIS on a remote webserver then.
>
> Thanks for your help again. I really appreciate it.
>
> Alex




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

Date: Sat, 4 Aug 2001 22:41:14 +0100
From: "Nathan Randle" <nathan.randle@ntlworld.com>
Subject: Thanks for all the help
Message-Id: <h%Za7.3646$hs5.811903@news2-win.server.ntlworld.com>

not just on this topic but all the others I have posted recently. I've
learnt alot about perl in about a week!! I started from scratch last week
and now I've written a fairly good program i think since I'm a begginer.

Cheerz all
Nathan




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

Date: 4 Aug 2001 18:22:31 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: What's the  regular expression to check emails and to remove html
Message-Id: <996946220.27054@itz.pp.sci.fi>

In article <slrn9mmbq2.iik.abigail@alexandra.xs4all.nl>, Abigail wrote:
>Ilmari Karonen (iltzu@sci.invalid) wrote on MMDCCCXCII September MCMXCIII
>in <URL:news:996689523.26104@itz.pp.sci.fi>:
>%% In article <slrn9mee1h.d4m.abigail@alexandra.xs4all.nl>, Abigail wrote:
>%% >
>%% >Really? I'd like to see it. Most attempts don't even get close.
>%% 
>%% Well, s%<(-?[^>"'-]|-?"[^"]*"|-?'[^']*'|--(-?[^-])*--)*(>|$)%%g should
>%% handle any valid tags and comments.  Extending it to handle marked
>%% sections, null-end-tags, and any other SGML oddities one could think of
>%% is left as an exercise for the reader.
>
>First example I tried was the string "++ <# #> ++". You substitution
>left "++  ++". Unfortunally, "++ <# #> ++" can appear in an HTML document
>and doesn't contain any special characters. It's just 11 data chars.

Hmm.. oh, you're right.  Well, that means it doesn't get that close
after all.  It could be fixed, but it's hardly worth the bother, in
particular because getting every detail right would involve learning
more about SGML than I really want to.

Now XML, on the other hand, is simpler, and the standard is much more
comprehensible too.  A single-regex XML parser might be a fun project,
should I ever find myself having nothing better to do.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1443
***************************************


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