[17072] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4484 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 1 18:07:28 2000

Date: Sun, 1 Oct 2000 15:05:13 -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: <970437912-v9-i4484@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 1 Oct 2000     Volume: 9 Number: 4484

Today's topics:
    Re: Bacic Log file script - Calling it from my HTML pag <simonis@myself.com>
    Re: Bacic Log file script - Calling it from my HTML pag <godzilla@stomp.stomp.tokyo>
    Re: benefits of arrays over hashes(associative arrays)  (Clay Irving)
    Re: benefits of arrays over hashes(associative arrays)  <celliot@tartarus.uwa.edu.au>
    Re: benefits of arrays over hashes(associative arrays)  <godzilla@stomp.stomp.tokyo>
    Re: benefits of arrays over hashes(associative arrays)  (David Wall)
    Re: benefits of arrays over hashes(associative arrays)  <harrisr@bignet.net>
        Comparing mod times with stat(); <noemail@nodomain.com>
    Re: Comparing mod times with stat(); <bwalton@rochester.rr.com>
    Re: Comparing mod times with stat(); (Clinton A. Pierce)
    Re: Comparing mod times with stat(); <noemail@nodomain.com>
    Re: File upload testing if it's there yorktown5425@my-deja.com
    Re: File upload testing if it's there jim_marshall2268@hotmail.com
    Re: File upload testing if it's there jim_marshall2268@hotmail.com
    Re: File upload testing if it's there <godzilla@stomp.stomp.tokyo>
    Re: Files and things <darryl@work-thicker.co.uk>
    Re: How to get length of scalar? <nospam@david-steuber.com>
    Re: How to get length of scalar? <simonis@myself.com>
    Re: How to get length of scalar? (Logan Shaw)
        Inserting characters into a string (dave@nospam.co.uk)
    Re: Inserting characters into a string <abe@ztreet.demon.nl>
    Re: Inserting HTML into CGI script as if it was beingin <jeff@vpservices.com>
        Inserting HTML into CGI script as if it was beinging #N (Mick Beeby)
    Re: Inserting HTML into CGI script as if it was beingin <flavell@mail.cern.ch>
    Re: Newbie can't handle the "true"th...  explanation de (Ilya Zakharevich)
    Re: Newbie can't handle the "true"th...  explanation de (Ilya Zakharevich)
    Re: Parsing improvements <mauldin@netstorm.net>
    Re: redirect script <webmaster@digital-espresso.com>
        starting with perl. <varat@ix.netcom.com>
    Re: while ($s = <WHATEVER>) <anmcguire@ce.mediaone.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 01 Oct 2000 18:06:13 GMT
From: Drew Simonis <simonis@myself.com>
Subject: Re: Bacic Log file script - Calling it from my HTML page
Message-Id: <39D77A86.447F57CC@myself.com>

Dave wrote:
> 
> So is that the way everybody does log files.

No.

> do they have to use SSI. I thought that SSI slowed down your web page with
> extra processing.

I think you may be going at this from the wrong side. Or maybe
I read the question too quickly.  In any event, there are a 
couple ways to do what you want to accomplish.  But this 
question is best asked and aswered in a NG dedicated to such
things.


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

Date: Sun, 01 Oct 2000 11:30:14 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Bacic Log file script - Calling it from my HTML page
Message-Id: <39D782B6.967BFF09@stomp.stomp.tokyo>

Dave Brondsema wrote:

> > In your html page, include <img src="logfile.pl" width=1 size=1>  Have
> > logfile do the logging and then return a transparent gif.  However,
> > this won't work if the browser has images turned off.


> You will have to print "Content-type: image/gif\n\n" instead of
> text/html


<img src="logfile.pl"> is within a static html page...
 
This "logfile.pl" could be setup to log and return this
trick output to avoid a content type conflict:


#!/usr/local/bin/perl

## logging code here

# return to html page:

print "Content-Type: image/gif\n\n";

print
"GIF89a\x01\0\x01\0\x80\0\0\0\0\0\xff\xff\xff\x21\xf9\x04\x01\0\0\0\0\x2c\0\0\0\0\x01\0\x01\0\x40\x02\x02\x44\x01\0\x3b";

exit;


This gif print above should be one long line,
not a split line as shown by word wrapping.


More logical though to simply use:


<!--#exec cmd="path to/logfile.pl" -->

or...

<!--#exec cmd="path to/logfile.cgi" -->


 ...as required for system configuration.



Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


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

Date: 1 Oct 2000 18:23:13 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <slrn8tf08h.77q.clay@panix3.panix.com>

On Sun, 01 Oct 2000 10:06:18 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> 
wrote:

>This term "hash" which as I say, is fancy dog food for humans.
>Inventing this expression, is right up there near top for my
>"Idiotic Geekster Garbage" list. 

  "A hash defines associations between keys and values, so hashes
   are often called *associative arrays* by people who are not 
   lazy typists."

   - Programming Perl, 3rd Edition, p. 76

Who should I believe? -- Larry Wall, Tom Christiansen and Jon Orwant or
Godzilla!...

-- 
Clay Irving <clay@panix.com>
It's so elegant that it's wrong. 


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

Date: Mon, 2 Oct 2000 02:30:52 +0800
From: "Cameron Elliott" <celliot@tartarus.uwa.edu.au>
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <39d78314$0$31989@echo-01.iinet.net.au>

thanks...
thats the kind of thing I wanted to know.
good example..

ta





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

Date: Sun, 01 Oct 2000 11:53:36 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <39D78830.67B38CAB@stomp.stomp.tokyo>

Clay Irving wrote:
 
> Godzilla! wrote with expertise:
 
> > This term "hash" which as I say, is fancy dog food for humans.
> > Inventing this expression, is right up there near top for my
> > "Idiotic Geekster Garbage" list.
 
> "A hash defines associations between keys and values, so hashes
>  are often called *associative arrays* by people who are not
>  lazy typists."
 
>    - Programming Perl, 3rd Edition, p. 76
 
> Who should I believe? -- Larry Wall, Tom Christiansen and Jon Orwant or
> Godzilla!...
 

Godzilla! of course. Very clearly, Mr. Wall, Mr. Christiansen and
Mr. Orwant support what I have said. They have a lick of sense.
All know lazy men eat hash dog food for dinner and are lazy typists.

Mr. Schwartz also agrees with me:

"In older documentation, hashes were called "associative arrays," but
 we got tired of a seven-syllable word for such a common item, so we
 replaced it with a much nicer one-syllable word." ¹


There ya go! Four of the big boys of Perl all support my statements.


Incidently Randal, only hyphenate number combinations,
not number and word combinations.

"seven syllable"
"one syllable"

This is more stylish and easier on the eyes.

*smiles*

You didn't 'got tired', you 'became tired'.
You can get a red line pencil. You cannot
get a non-physical item, unless you are
Dr. Timothy Leary.

*frowns*


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


¹  _Learning Perl_
   Schwartz, Randall L. and Christiansen, Tom
   O'Reilly & Associates
   July 1997 Second Edition
   ISBN: 1-56592-284-0
   page 66


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

Date: 1 Oct 2000 15:03:12 -0400
From: darkon@one.net (David Wall)
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <8FC09D441darkononenet@206.112.192.118>

celliot@tartarus.uwa.edu.au (Cameron Elliott) wrote in 
<39d7648e$0$31974@echo-01.iinet.net.au>:

>Can someone tell me which is better to use?
>I cant see the point of a hash except to store something by reference to a
>name which is possible to do through creative uses of arrays anyway.

Other have given you some helpful responses, so I won't repeat what they 
said.  Instead, I'll look at a single example where a hash is a better 
choice than an array.

One of the basic uses of a hash is counting the occurrences of something, 
like words in a file.  Taking a simplistic view of words as strings 
surrounded by whitespace, if you wanted to count words using only arrays, 
you might get something like this:

my (@wordlist, @counts);
while (<DATA>) {
    chomp;
    foreach my $word (split) { # simplistic words
        my $new_word = 1;
        for (my $i=0; $i < @wordlist; $i++) {
            if ($word eq $wordlist[$i]) {
                $counts[$i]++;
                $new_word = 0;
                last;
            }
        }
        if ($new_word) {
            push @wordlist, $word;
            push @counts, 1;
        }
    }
}

This works ok, considering that I typed it in without much thought. It 
could probably be rewritten to be more efficient, but it's not really worth 
the trouble. If I use a hash instead, I can do it like this:

my %wordlist;
while (<DATA>) {
    chomp;
    foreach my $word (split) {
        $wordlist{$word}++;
    }
}

Using a hash is, in lots of cases like this one, much easier to create, 
maintain, and understand, so it's the preferred way to do it. The code 
above using the hash will also run faster than the code using arrays.  

Of course there are also situations where arrays are easier and faster than 
hashes.  As others have said, which you use depends on what you're doing.

HTH.

-- 
David Wall
darkon@one.net


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

Date: Sun, 1 Oct 2000 16:43:49 -0400
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <stf8f0d0iagbc3@corp.supernews.com>


Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:39D78830.67B38CAB@stomp.stomp.tokyo...

>
> ¹  _Learning Perl_
>    Schwartz, Randall L. and Christiansen, Tom
>    O'Reilly & Associates
>    July 1997 Second Edition
>    ISBN: 1-56592-284-0
>    page 66


Mr. Schwartz spells his given name Randal (as do I).

Randy Harris




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

Date: Sun, 01 Oct 2000 19:31:16 GMT
From: "Dave A." <noemail@nodomain.com>
Subject: Comparing mod times with stat();
Message-Id: <8iMB5.2347$VY2.79624@nnrp1.ptd.net>

What im trying to do is rather simple, but because of my little perl experience
I am having a slight bit of trouble figuring out the easiest, and correct way of
of pulling up all files that have a last modified time >= $num_of_days.

An HTML Form field set to 10
(to list all files that have not been modified in the last 10 days)

<snip of code>
# form field value for days ( e.g: 10 )
my $num = $_;

foreach $filename (@filelist) {
    # File Stats
    my ($f_sec,$f_min,$f_hour,$f_mday,$f_mon,$f_year,$f_wday,$f_yday,$f_isdst) =
                                     localtime((stat($filename)));
    # compared with Current time
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=
                                    localtime();

    $lastday = $f_yday - $yday;

    if ($lastday >= $num) { push (@files, $filename); }

} # End foreach file loop
return (@files);

</snip>


Am I going about this the wrong way ?
Or am I on the right track here ?

Thanks alot.
Dave





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

Date: Sun, 01 Oct 2000 20:26:06 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Comparing mod times with stat();
Message-Id: <39D79DE7.E4347687@rochester.rr.com>

"Dave A." wrote:
> 
> What im trying to do is rather simple, but because of my little perl experience
> I am having a slight bit of trouble figuring out the easiest, and correct way of
> of pulling up all files that have a last modified time >= $num_of_days.

Check out the -M operator.  perldoc -f -M

 ...
> Dave
-- 
Bob Walton


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

Date: Sun, 01 Oct 2000 20:38:23 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Comparing mod times with stat();
Message-Id: <3hNB5.18638$hD4.4718268@news1.rdc1.mi.home.com>

[Posted and not mailed because of retarded mail address munging]

In article <8iMB5.2347$VY2.79624@nnrp1.ptd.net>,
	"Dave A." <noemail@nodomain.com> writes:
> What im trying to do is rather simple, but because of my little perl experience
> I am having a slight bit of trouble figuring out the easiest, and correct way of
> of pulling up all files that have a last modified time >= $num_of_days.

Fair enough.

> An HTML Form field set to 10
> (to list all files that have not been modified in the last 10 days)

Nobody cares about your HTML/CGI problems in clpm.  So don't bring 
them up.

>     # File Stats
>     my ($f_sec,$f_min,$f_hour,$f_mday,$f_mon,$f_year,$f_wday,$f_yday,$f_isdst) =
>                                      localtime((stat($filename)));

Whoa.  Did you look at what actually came out of this?  stat() returns 
a list of things.  Localtime is only interested 1 item (number of 
seconds, a time_t value).  What you passed off to localtime was just...wrong.
I'll bet f_sec always came out to the same small value and f_year was 
always 70.

How many seconds in a day?  60*60*24?  Ok, watch this.

	$mtime=(stat($file))[9]  # Gets you just the mtime, in seconds
	$now=time;

Who needs localtime adjustments when both values are relative to the
same epoch?  To see if mtime is older than 10 days...

	# Untested
	#
	if ($mtime < $now - (60*60*24 * 10)) {
		# Older!
	}

There.  Much simpler.  And it works.

If you need to actually use CALENDAR days, then use one of the Date::
modules to compute relative calendar dates.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Sun, 01 Oct 2000 21:50:32 GMT
From: "Dave A." <noemail@nodomain.com>
Subject: Re: Comparing mod times with stat();
Message-Id: <IkOB5.2356$VY2.81061@nnrp1.ptd.net>


"Clinton A. Pierce" <clintp@geeksalad.org> wrote in message news:3hNB5.18638$hD4.4718268@news1.rdc1.mi.home.com...
: [Posted and not mailed because of retarded mail address munging]

: Fair enough.
:
: > An HTML Form field set to 10
: > (to list all files that have not been modified in the last 10 days)
:
: Nobody cares about your HTML/CGI problems in clpm.  So don't bring
: them up.

I'm sorry,
When i leave this information out, someone complains that I didn't include it,
When I post it, someone tells me it's not relavent.
(can't win for loosing)

: How many seconds in a day?  60*60*24?  Ok, watch this.
:
: $mtime=(stat($file))[9]  # Gets you just the mtime, in seconds
: $now=time;

ohhh, ok, now i follow.

: Who needs localtime adjustments when both values are relative to the
: same epoch?  To see if mtime is older than 10 days...
:
: # Untested
: #
: if ($mtime < $now - (60*60*24 * 10)) {
: # Older!
: }
:
: There.  Much simpler.  And it works.
:
: If you need to actually use CALENDAR days, then use one of the Date::
: modules to compute relative calendar dates.

This is what i was trying to stray away from.
I knew I was not doing this correctly, but nothing clicked
(amateur i know, but still learning)





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

Date: Sun, 01 Oct 2000 18:12:49 GMT
From: yorktown5425@my-deja.com
Subject: Re: File upload testing if it's there
Message-Id: <8r7uqu$se$1@nnrp1.deja.com>

In article <39D771CA.3D6752AA@stomp.stomp.tokyo>,
> *laughs*
>
> You used the wrong fake email address.

No I didn't, either one is fine.

>
> I am a gal.

well that explains a lot.

> Hopefully you have also learned I am not another
> one these ignorant gullible fools populating this
> inane newsgroup.

No - I learned nothing.

> You didn't run into trouble. You
> ran into me! This is even worse.

ahhh, ok.

> My insight and wisdom are both, hard earned.
> Why would I share my efforts with a cretin?

Not sure what I did to make you think I am a cretin - but then again I
don't really care.  You've done nothing to indicate you have any wisdom
or insight.  You have a proved only that you are good at belittling
people, which is fine too.

>
> Godzilla!
> --
> Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
> UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
> BumScrew, South of Egypt ¦ HTML Programming Class
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 01 Oct 2000 18:15:20 GMT
From: jim_marshall2268@hotmail.com
Subject: Re: File upload testing if it's there
Message-Id: <8r7uvl$uu$1@nnrp1.deja.com>

O well - live and learn.  I was trying to reduce the clutter in the
post, obviously this is not the right thing to do in this newsgroup.

sorry


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 01 Oct 2000 18:22:01 GMT
From: jim_marshall2268@hotmail.com
Subject: Re: File upload testing if it's there
Message-Id: <8r7vc5$1ah$1@nnrp1.deja.com>

thanks


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 01 Oct 2000 12:13:41 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: File upload testing if it's there
Message-Id: <39D78CE5.FA6CC428@stomp.stomp.tokyo>

yorktown5425 wrote:
 
> Godzilla! assertively stated reality:

> > *laughs*

> > You used the wrong fake email address.
 
> No I didn't, either one is fine.


Nope. Fake email addresses are used to conceal.
See my email address? Real as can be.

However, I routinely post my real email address
and post links to my sites. People know who I am
and where to reach me, as a real person. This is
factual. Some people here mail bomb my address
every so often or send threatening email from
fake email addresses.

You are hiding just like all others who use
fake email addresses. This is suspect.

 
> > I am a gal.
 
> well that explains a lot.

cretin ~ misogynist ~ sexist

No difference.


You are certainly not scoring any points with me.
There existed no problem until you elected to 
flat out lie to me, claiming there is no fatal flaw
in your code and, your code works. This is a lie.
Additionally you claimed to have pasted those snippets
directly from your script and, in subsequent articles,
claimed to have made a typo during typing those snippets.

If you haven't realized this yet, I spotted you for
a fake after a quick glance at your first article.
You have not and will not pull wool over my eyes.
Others yes, but not me. I am woman, not some ignorant
knuckle dragging hairy backed slope browed flat toothed
pea brained Neandertal sexist man, so commonly found
in this newsgroup, just as you are found.


Godzilla!


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

Date: Sun, 1 Oct 2000 19:56:00 +0100
From: "CJ Llewellyn" <darryl@work-thicker.co.uk>
Subject: Re: Files and things
Message-Id: <1958r8.p6p.ln@paulweller>

<jon_uk@my-deja.com> wrote in message news:8r7dbl$ke6$1@nnrp1.deja.com...
> Hi,
>
> I have 2 small problems.  I need to -
>
> - Find out what size (in bytes) a folder is.  Basicly, I need to know
> the total size of /home/myname/cgi-bin (with the all the files etc).

If your running an ftp server on your machine sitesize.sourceforge.net will
help.



--
Regards, CJ Llewellyn
http://www.cjll.uklinux.net/





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

Date: Sun, 01 Oct 2000 19:03:48 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: How to get length of scalar?
Message-Id: <m3snqgz8mm.fsf@solo.david-steuber.com>

Brendon Caligari <bcaligari@my-deja.com> writes:

' PS: shouldn't there be another NG...say...
' comp.lang.perl.offtopic where the perl community
' can rant in general?

Probably.  But I bet you e to pi odds that people will crosspost to
here anyway.

As for on-topic posts, I've tried to post to comp.lang.perl and
cross-post to comp.lang.perl.misc (or modules) as clp has less traffic
than clpm.  It didn't always work though because some people trim
headers when responding so that they only reply in the group they
follow.  Fair enough.  Now I follow both groups.  It looks like I
still cross post though.

Perhaps that alt.perl group I see in the headers could be used for the
off topic rants?  There are some real gurus and wizards following this
group, and it would be nice to get a better signal to noise ratio so
that I can more easily spot their Perls of wisdom.

-- 
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member    | general Internet web wannabe.
ICQ# 91465842  (Using Micq 0.4.6 under Linux)

It's time to be free: http://www.harrybrowne2000.org


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

Date: 01 Oct 2000 20:27:00 GMT
From: Drew Simonis <simonis@myself.com>
Subject: Re: How to get length of scalar?
Message-Id: <39D79B85.733B4365@myself.com>

David Steuber wrote:
> 
> 
> As for on-topic posts, I've tried to post to comp.lang.perl and
> cross-post to comp.lang.perl.misc (or modules) as clp has less traffic
> than clpm.  It didn't always work though because some people trim
> headers when responding so that they only reply in the group they
> follow.  Fair enough.  Now I follow both groups.  It looks like I
> still cross post though.

c.l.p is a dead NG, and has been that way for a very long time.
The fact that it is still active is a shame on the many news admins
out there who haven't removed it yet.
 
> Perhaps that alt.perl group I see in the headers could be used for the
> off topic rants?  There are some real gurus and wizards following this
> group, and it would be nice to get a better signal to noise ratio so
> that I can more easily spot their Perls of wisdom.

I wouldn't post to alt.perl either.


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

Date: 1 Oct 2000 15:52:22 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How to get length of scalar?
Message-Id: <8r8866$9p0$1@provolone.cs.utexas.edu>

In article <8r79fc$i17$1@nnrp1.deja.com>,
Brendon Caligari  <bcaligari@my-deja.com> wrote:
>PS: shouldn't there be another NG...say...
>comp.lang.perl.offtopic where the perl community
>can rant in general?

I'd call it comp.lang.perl.tangents.

Not that it's terribly likely to happen anyway...

  - Logan


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

Date: Sun, 01 Oct 2000 21:35:34 GMT
From: Dave (dave@nospam.co.uk)
Subject: Inserting characters into a string
Message-Id: <39e2ad7f.45124069@news.redhotant.com>

Can anyone suggest what the quickest method
is for adding a character into a string at certain points?

e.g. 
1000000 
add a comma after 1st and  4th digit to become 1,000,000 ?

Dave


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

Date: Sun, 01 Oct 2000 23:51:55 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Inserting characters into a string
Message-Id: <7acftso3sffpugenjueofld3pq6igqstbc@4ax.com>

On Sun, 01 Oct 2000 21:35:34 GMT, Dave (dave@nospam.co.uk) wrote:

> Can anyone suggest what the quickest method
> is for adding a character into a string at certain points?

perldoc -f substr
 
> e.g. 
> 1000000 
> add a comma after 1st and  4th digit to become 1,000,000 ?

That is an FAQ:
	perldoc -q commas

	Found in d:\usr\lib\pod\perlfaq5.pod
	  How can I output my numbers with commas added?

-- 
Good luck,
Abe

##
perl -Mstrict -wle 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W].$"};print@{[Just,another,Perl,hacker]}'


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

Date: Sun, 01 Oct 2000 14:22:24 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via  SSI
Message-Id: <39D7AB10.1798FFD2@vpservices.com>

Mick Beeby wrote:
> 
> I have a standard HTML file setup for my copyright notices and links
> footer that is inserted into all my HTML and ASP pages using a Server
> Side Include.
> 
> How can I open this file from within a CGI script and read the
> contents and write them to the browser screen as if the file had been
> #INCLUDEd using SSI.

1. print an HTML content header to STDIN (same as if printing to the
screen)

2. use the Perl open() function to open the file

3. use the Perl diamond operator to loop through the file one line at a
time, printing each line to STDIN as you read it

> I'd appreciate any replies cross-mailed to me at
> mick.beeby@mjb-is.co.uk

Sorry: post here, read here. Usenet is not a private help desk.

-- 
Jeff


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

Date: Sun, 01 Oct 2000 20:56:31 GMT
From: mick.beeby@mjb-is.co.uk (Mick Beeby)
Subject: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <39d7a3ac.94703994@news.freeserve.net>

I have a standard HTML file setup for my copyright notices and links
footer that is inserted into all my HTML and ASP pages using a Server
Side Include.

How can I open this file from within a CGI script and read the
contents and write them to the browser screen as if the file had been
#INCLUDEd using SSI.

I can simply use SSI within ASP pages but cannot do this from within a
 .cgi or .pl module.

I'd appreciate any replies cross-mailed to me at
mick.beeby@mjb-is.co.uk

Thanks

Mick


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

Date: Sun, 1 Oct 2000 23:35:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <Pine.GHP.4.21.0010012329550.25515-100000@hpplus03.cern.ch>

On Sun, 1 Oct 2000, Mick Beeby wrote:

> I have a standard HTML file setup for my copyright notices and links
> footer that is inserted into all my HTML and ASP pages using a Server
> Side Include.
> 
> How can I open this file from within a CGI script and read the
> contents and write them to the browser screen as if the file had been
> #INCLUDEd using SSI.

Seems as if you've pretty much told yourself already what you need to
do.  What's your actual problem?  Identifying which point in the
script to actually spit out the file?  Only you know the answer to
that, on the basis of what you've posted so far.

Opening the included file?  Reading it?  There don't seem to be any
special features there.  How far have you got?  It's hard to know
where to help, without knowing more about where you're stuck.




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

Date: 1 Oct 2000 21:28:51 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Newbie can't handle the "true"th...  explanation desired
Message-Id: <8r8aaj$lfu$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@plover.com>],
who wrote in article <39d51fba.6b5$255@news.op.net>:
> Depends on how you set it.  Boolean expressions such as ($a == $b)
> return either 1 or ''.

 ... or whatever the overloaded == operator returns...

Ilya


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

Date: 1 Oct 2000 21:31:14 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Newbie can't handle the "true"th...  explanation desired
Message-Id: <8r8af2$lh2$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler 
<lr@hpl.hp.com>],
who wrote in article <MPG.143ea41f212df92698addf@nntp.hpl.hp.com>:
> Though you didn't ask explicitly, the only 'false' values are:
> 
>   an arithmetic expression that evaluates to 0
>   the string '0'
>   the undefined value (undef, or not assigning anything)

[   the string '' as noted in other followups...]

 ... and whatever with an overloaded 'bool'-accessor which returns
    false (this is recursive!).

Ilya



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

Date: Sun, 01 Oct 2000 16:22:53 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Parsing improvements
Message-Id: <39D789EB.79C5D1FF@netstorm.net>

Keith Calvert Ivey wrote:
> 
> Jim Mauldin <mauldin@netstorm.net> wrote:
> 
> >I wrote:
> >>
> >> $messy =~ s/(?<!^)($mod)/\n$1/;
> >
> >Slight overkill.
> >
> >$messy =~ s/[^^]($mod)/\n$1/;
> 
> Well that may work in this case, but not for the reason you
> think.  The [^^] is a character class that matches any character
> except ^. 

So sad, but so true.  Also, for the benefit of the OP and myself 

s/(?<!^)($mod)/\n$1/;

can't do the very thing it was intended to do because lookbehind
patterns can only match fixed width patterns, or atoms, and not
zero-width assertions like ^.  Shame on me.

-- Jim


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

Date: Sun, 01 Oct 2000 11:39:23 -0800
From: Digital Espresso <webmaster@digital-espresso.com>
Subject: Re: redirect script
Message-Id: <39D792EB.93507722@digital-espresso.com>

Hello, Mr. JW, yes I know that you can have a perl script print a redirect
header to the browser
so it will forward you to a new page, I've done it many times myself; but this
will only redirect
you while you are loading a page. In fact it works almost like HTML META
Refresh tag, but
what Keat looking for is to actually open another page automatically after the
original one is closed.

JW wrote:

> Dear Mr. Espresso,
>
> Perl is amazing!! It is possible to have a perl script print a redirect
> header to the browser. This will make the browser redirect to the new
> location.
>
> The funny thing is that mr. Anders Lund already mentioned this method...
>
> Ofcourse the original posting ain't worth the effort of all these replies.
> Cheers,
> JW
>
> Digital Espresso <webmaster@digital-espresso.com> wrote in message
> news:39D6625D.39F2846F@digital-espresso.com...
> > Hello, Keat, You cannot accomplish this with a CGI/Perl.
> > This kind of function is done by JavaScript.
> >
> > Keat wrote:
> >
> > > I'm looking for a perl script that will automatically open up another
> url
> > > when exiting the original,  I know its possible as I've seen it done on
> the
> > > xxx sites, but I cant seem to find a script anywhere. Does anyone have
> any
> > > ideas where I can find such a script....????
> > >
> > > Please reply to keat@beal.org.uk
> > > Keaton Roebuck
> >
> > --
> > Regards
> >
> > Digital Espresso
> > ________________
> >
> > WEB:> http://www.digital-espresso.com
> > PHONE:> 907.337.3201; CELL: 907.441.9649; PAGER/V-MAIL: 907.275.9448
> > ADDRESS:> PO BOX 240414 Midtown Station Anchorage, AK 99524-0414
> >
> >

--
Regards

Digital Espresso
________________

WEB:> http://www.digital-espresso.com
PHONE:> 907.337.3201; CELL: 907.441.9649; PAGER/V-MAIL: 907.275.9448
ADDRESS:> PO BOX 240414 Midtown Station Anchorage, AK 99524-0414




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

Date: Sun, 01 Oct 2000 21:39:33 GMT
From: Joe Creaney <varat@ix.netcom.com>
Subject: starting with perl.
Message-Id: <39D756DA.CE41F3B9@ix.netcom.com>

I am pretty new to perl and I am using earthlink(netcom) and I am having
a problem
trying to get my scrips to save a data file.  Are there any perl
programsers with
the same server to give a few tips or secrets.  I checked out their
example but
it seemed convoluted and I didn't understand it.

Also I am trying to print out my guest book.  I know there scripts out
there
but I want to write my own so I can learn.  i have a new book on perl or

CGI I hope it is helpful.

One final question, what are the job opertunities if I can accuire
a decent skill in perl and html and other web programing.

Joe Creaney
joec@annuna.com

Thank You.



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

Date: Sun, 1 Oct 2000 16:20:18 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: while ($s = <WHATEVER>)
Message-Id: <Pine.LNX.4.21.0010011615370.30897-100000@hawk.ce.mediaone.net>

On Sun, 1 Oct 2000, Brendon Caligari quoth:

BC> 
BC> 
BC> 
BC> is "defined()" automatically assumed for a reading a file from within
BC> a "while" loop?  Is this part of the 'while readign file' magic similar
BC> to the read line contents being saved to $_?
BC> 
BC> Under 'strict' and 'warnings', I 'whiled' across a file whose last line
BC> was a "0" not followed by a newline (I made sure of that).  It still
BC> output all the lines.
BC> 
BC>   while ($s = <WHATEVER>)  {
BC>     print("$s");
BC>   }
BC> 
BC> This was not the same for an "if ($s = <WHATEVER>) ..." statement that
BC> evaluated to false on the last line unless "if (defined($s =
BC> <WHATEVER>)" was used instead.


The perlsyn manpage states that defined is indeed part of the magic.
Another way of looking at it is:

#!/usr/bin/perl -lw
use strict;

my @array = ( undef() =>  undef() => undef() );

print "for loop:";
my $c = 0;
for my $s (@array) {
    print $c++;
    print $s;
}

print "while loop:";
$c = 0;
while (my $s = shift @array) {
    print $c++;
    print $s;
}

__END__

anm
-- 
perl -wMstrict -MText::ParseWords -e "
system echo => grep defined() ? /./ : q++ => quotewords '\s+', 0, <<JAPH;
"""""""""""""""""""""""""""""""" Just    """"""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""" another """"""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""" Perl    """"""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""" Hacker  """"""""""""""""""""""""""""""""
JAPH
"



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

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


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