[7869] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1494 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 17 20:17:21 1997

Date: Wed, 17 Dec 97 17:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 17 Dec 1997     Volume: 8 Number: 1494

Today's topics:
     Re: 6 elementary questions (Andrew M. Langmead)
     Re: A question for perl MASTERS not newbies (Andrew M. Langmead)
     Re: append to top of file ? (Honza Pazdziora)
     Re: append to top of file ? <reibert@mystech.com>
     Re: HELP! How to use records in Perl? (Martin Vorlaender)
     how to do this from STDIN (WOLtetch)
     Re: How to get everything in between <pre>....</pre> ta (Martien Verbruggen)
     Re: http socket programming (brian d foy)
     Re: IIS 4.0 and PERL scripts <rshah@sapient.com>
     Iteration within a foreach loop (Paul)
     Re: JPL & PERL 5.004_04 under IRIX (Juan Gallego)
     Re: Newbie question.   Do you recommend moving from C? <adavid@netinfo.com.au>
     No Flock! -- Now What? <VikR@aol.com>
     Re: Part of a line (brian d foy)
     Re: Password encription <neil@nsedley.dircon.co.uk-antispam>
     Q Sorting Web access file? (bosch6)
     Re: Q Sorting Web access file? (Juergen Heinzl)
     Re: references to globalise locally generatied filehand (Gurusamy Sarathy)
     Re: Script calls embedded in web pages <rootbeer@teleport.com>
     Re: searchable archive (brian d foy)
     Re: targeting a frame window with perl (brian d foy)
     Re: Teaching programing (Gabor)
     Time-out w/o alarm() on NT <henk@fortean.org>
     Re: Wacky idea: a PERL server (Jonathan Stowe)
     Re: What kind of machine wouldn't support FLOCK? (Juergen Heinzl)
     Re: What kind of machine wouldn't support FLOCK? <reibert@mystech.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Dec 1997 20:15:44 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: 6 elementary questions
Message-Id: <ELCoA9.5r8@world.std.com>

"Xah" <xah@best.com> writes:

>Some Perl beginner's questions I'v accumulated. I've not investigated them
>extensively, but those experienced should be able to help me out easily.

You've already gotten some good answers to your questions, but I just
wanted to point out that some of the difficulties might stem from
perl's notion of list vs. scalar context.

One of the things that I was disappointed in the second edition of the
camel book is how the initial discussion of list and scalar
contexts. The first edition had it in chapter 1 in a section labeled
"WAKE UP!!!". It definitely made its point that it was a very
fundemental concept to learning perl.

The second edition has a section in the second chapter ("the gory
details") titled "list and scalar context". It doesn't quite have the
same impact.

(Actually, my biggest disappointment is the disappearance of the
"common tasks in perl" chapter, which the authors have explained their
reasons over and over by now. No use beating that dead horse, again.)
-- 
Andrew Langmead


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

Date: Wed, 17 Dec 1997 20:44:48 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: A question for perl MASTERS not newbies
Message-Id: <ELCpMo.512@world.std.com>

 Subject: Re: A question for perl MASTERS not newbies
[I almost feel embarrassed to answer an article with this subject
line. There is a wide range of experience between newbie and MASTERS,
and I'm probably a fair distance from either end.]

"Dafydd Richards" <dafydd@gwe.co.uk> writes:

>The point of doing this is that after 3 seconds the alarm breaks the read
>and jumps into the loop again with $cond=0 and therefore breaks the loop.
>In perl version 5.004 the function 'timeup' seems to return to the 'read'.

>Is there anyway in perl 5.004 of breaking the wait on 'read' after a set
>time???

Perl now sets signals to be restartable where it used to leave them in
their OS dependant default. (I thought the change was made before
5.004?)

Keep in mind signals are still broken in perl. Their use can cause
your program to dump core and quit. Thats why others have suggested
(when you aked the same question a few days ago with a different
subject) using select() with a timeout to wait for data and to only
read when data is indeed available.

If you really want to use the alarm signal, maybe you can use a method
similar to the example shown in the perlipc man page?

           eval {
               local $SIG{ALRM} = sub { die "alarm clock restart" };
               alarm 10;
               flock(FH, 2);   # blocking write lock
               alarm 0;
           };
           if ($@ and $@ !~ /alarm clock restart/) { die }
 

Pretty much all you have to do is to substitute the value "3" for the
value "10" and change the call to "flock" to "read".
-- 
Andrew Langmead


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

Date: Wed, 17 Dec 1997 20:00:56 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: append to top of file ?
Message-Id: <adelton.882388856@aisa.fi.muni.cz>

"Bob Zwick" <cottage@azmail.net> writes:

> Can anyone provide a simple script that add to the top of a file.
> I tried seek, but I must be doing it wrong.
> Don't have perl so I can't do a read doc.

If you do not have Perl, then the answer might be

cat append origfile > newfile ; mv newfile origfile

Hope this helps,

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Wed, 17 Dec 1997 14:05:56 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: append to top of file ?
Message-Id: <34983EB4.686F0AF2@mystech.com>

Bob Zwick wrote:

> Can anyone provide a simple script that add to the top of a file.
> I tried seek, but I must be doing it wrong.

I don't believe this can be done - even in C. seek() can position you at
the top of the file, but when you write from there you overwrite what
already exists. Think of it as rewinding your VCR tape - you can't record
before the beginning of the tape! :-(

HTH,
Mark Reibert
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: Wed, 17 Dec 1997 20:06:42 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: HELP! How to use records in Perl?
Message-Id: <349822c2.524144494f47414741@radiogaga.harz.de>

Greg Roberts (gregr@ee.uwa.edu.au) wrote:
: Hi. I'm having some trouble at the moment trying to emulate a Pascal record
: structure in Perl. What I want is something like this:
: machine_record {
:   hostname,
:   IP,
:   group,
:   traffic,
:   cost
: }

That's an easy one: use a hash.

  %machine_record = (
     hostname => 'host.domain',
     IP       => '1.2.3.4',
     ...
  );

or

  $machine_record{hostname} = 'host.domain';

: So for machine X, I want to be able to go:
:     machine_record(X).hostname = "wahey";

Ahh... So you want a hash of hashes. Then you could create a hash reference by

  $machine_record{X} = {
     hostname => 'host.name',
     IP       => '1.2.3.4',
     ...
  };

or

  $machine_record{X}{hostname} = 'host.domain';

(more exactly written as $machine_record{X}->{hostname} = 'host.domain'; )

Read the perldata and perlref POD pages on hashes and references, and the
perllol (list of lists) and perldsc (data structures cookbook) POD pages on
building multi-dimensional structures, and the gotchas associated with them.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 17 Dec 1997 21:32:45 GMT
From: woltetch@aol.com (WOLtetch)
Subject: how to do this from STDIN
Message-Id: <19971217213200.QAA00711@ladder01.news.aol.com>

I have the following script:

#!/usr/local/bin/perl -w 
use diagnostics;

@list2sort = <STDIN>;
chomp @list2sort;
@sorted_list = sort mysort @list2sort;

print "@sorted_list";

sub mysort {

        my $var1 = $a =~ /^\d+/;
        my $var2 = $b =~ /^\d+/;

        if ($var1 && $var2) {
                $a <=> $b;

        } elsif ($var1) {
                 1;

        } elsif ($var2) {
                -1;
        } else {
                 lc$a cmp lc$b;
        }
}

This works fine if I define a test array to sort in the script itself.
However, in its present form, when I try to have it sort stuff entered on the
command line, it doesn't work (prints the input, unsorted).
What am I doing wrong here?


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

Date: 17 Dec 1997 21:39:07 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to get everything in between <pre>....</pre> tags in html
Message-Id: <679gpr$a7e$1@comdyn.comdyn.com.au>

In article <349e2044.10620943@news.halcyon.com>,
	FHeasley@chemistry.com (Frank) writes:
> On 16 Dec 1997 15:16:24 GMT, mjtg@cus.cam.ac.uk (M.J.T. Guy) wrote:
> 
>>In article <hl0176.cs.ln@localhost>, 
>>	Tad McClellan <tadmc@metronet.com> wrote:
>>
>>   { local $/; $lines = <FILENAME> };
> 
> Why not:
> 
> while (<FILENAME>){
> $lines .= "$_";
> }

Because it's slower.
Because you don't need those double quotes.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd.       | negative.
NSW, Australia                      | 


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

Date: Wed, 17 Dec 1997 15:45:43 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: http socket programming
Message-Id: <comdog-ya02408000R1712971545430001@news.panix.com>

In article <cATapIAEAlSGM1-971217104012Z-28449@sgm1.iaea.or.at>, G.Hood@iaea.org wrote:

>I need to find out if certain files (listed in a database) really exist
>on our web server and came up with the following code. I'm a bit out of
>my depth though and don't understand why I can't pick up the http header
>for a different file on each loop. Is it simply that I need to close and
>re-open the socket on each loop?

this isn't a perl specific issue...

the people in comp.infosystems.www.authoring.cgi might be able to
tell you about the Connection: header.  or you could check the HTTP/1.1
specification referenced in the CGI Meta FAQ.

good luck!

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


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

Date: Wed, 17 Dec 1997 16:13:30 -0500
From: Raj Shah <rshah@sapient.com>
Subject: Re: IIS 4.0 and PERL scripts
Message-Id: <0685A427A719D11197BB00A024D39945022FA87E@delphi.sapient.com>

Look in the registry...
I think it's
HKEY_LOCAL_MACHINE
	CurrentControlSet
	Services
	W3SVC
	Parameters
	Script Map

Make sure that the .pl extension is associated with C:\perl\bin\perl.exe
%s %s (s in lowercase)
this should be a Reg_Dword.
(see http://www.geocities.com/SiliconValley/Park/8312/perlis.htm)

Raj

> -----Original Message-----
> From:	jgreen@nimr.mrc.ac.uk (John Green) [SMTP:jgreen@nimr.mrc.ac.uk]
> Posted At:	Thursday, December 11, 1997 6:23 AM
> Posted To:	misc
> Conversation:	IIS 4.0 and Perl CGI scripts.
> Subject:	IIS 4.0 and Perl CGI scripts.
> 
> I'm trying to run some Perl CGI scripts under Microsoft's new IIS 4.0
> under NT Server. They used to work fine under IIS 2 and 3, but now I
> get
> messages like:
> 
> 	"The server has encountered a configuration error attempting to
> 	process your request. The configuration parameter MD_SCRIPT_MAPS
> 	(6014) has an invalid value..."
> 
> The Application extension mapping shows .pl mapped to
> 
> 	c:\perl\bin\perl.exe %s %s
> 
> I can't find anything in the IIS documentation that explains what "%s"
> does,
> and changing it to
> 
> 	c:\perl\bin\perl.exe %1 %*
> 
> as with previous versions of IIS makes no difference.
> 
> Has anybody got any ideas?
> 
> Thanks in advance,
> 
> John Green, NIMR, London, U.K.
> 
> 



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

Date: 17 Dec 1997 21:08:33 GMT
From: paul@pmcg.com (Paul)
Subject: Iteration within a foreach loop
Message-Id: <679f0h$la8$1@la-mail4.digilink.net>

	Here's the snippet (we will be checking our named.boot files):

	foreach $domname (sort keys %prifor) {
		@buf = split /\n/, `whois $domname`;

		foreach ( @buf ) {
			if ( /$match_this_puppy/ ) {
				<ITERATE TWO MORE LINES HERE>;
				...do somethig way cool here;
			}
		}
	}

	Any clues for the clueless?

Thanks,
Paul



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

Date: 17 Dec 1997 21:04:31 GMT
From: juan@physics.mcgill.ca (Juan Gallego)
Subject: Re: JPL & PERL 5.004_04 under IRIX
Message-Id: <679eov$132@sifon.cc.mcgill.ca>

In article <349802FB.794B@bell-labs.com>
posted to comp.sys.sgi.admin on Wed, 17 Dec 1997 11:51:07 -0500,
Stephan Vladimir Bugaj (bugaj@bell-labs.com) wrote:

: Greetings.

: I need to use JPL and am running IRIX (we have machines running
: 6.2,6.3 & 6.4).  I've tried to build PERL 5.004_04 on 6.2 and
: 6.3 using both the SGI make and cc and GNU make and cc and have
: been unsuccessful in creating a version with a dynamic libperl.so
: and the system malloc (I did compile a static version with the
: PERL malloc successfully).  I have discussed this problem somewhat
: with others, and have not yet figured out what needs to be done
: to make the compilation work properly.

and the error messages would be? Kind of hard to guess, but I'll give it
a shot (in the dark of course!). I seem to remember that the only tricky
part (if it could be called tricky) was that the LD_LIBRARY_PATH during the
make had to include the directory in which the make was being done. I opted
for:

env LD_LIBRARY_PATH=`$cwd` make
env LD_LIBRARY_PATH=`$cwd` make test
env LD_LIBRARY_PATH=`$cwd` make install

and things went really smoothly (for IRIX 5.3, 6.{2,4}).

HTH,
--
Juan Gallego
Little ({sys,net}-{admin,hacker}) Boss


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

Date: Thu, 18 Dec 1997 07:23:55 +1100
From: Anthony David <adavid@netinfo.com.au>
To: Steven Osman <sosman@terratron.com>
Subject: Re: Newbie question.   Do you recommend moving from C?
Message-Id: <349834DB.F8052B1D@netinfo.com.au>

Steven Osman wrote:

Let's see

> You would use the Java Activator is if you need 1000000% JDK 1.1 compliance
> really, it's not something that needs to be downloaded by everyone.
>

No Perl here

<snip>

In fact this looked like a Perl-free post to a couple of Perl newsgroups.
Any reason?

--
Anthony David     |     Opinions expressed ARE
Anthony David & Associates |     those of my employer




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

Date: Wed, 17 Dec 1997 13:05:55 -0800
From: Vik Rubenfeld <VikR@aol.com>
Subject: No Flock! -- Now What?
Message-Id: <34983EB2.AD3B8D6C@aol.com>

I'm finding that there are PERL installations that neither support nor emulate
FLOCK. What do you do on a system like that? Surely these systems have some
way of handling multiple simultaneous attempts to write to a single data file
-- don't they?

Is it possible to develop something that is strictly PERL code, and can
provide flock or something like it under any setup? 

Thanks very much in advance to all for any info.

- Vik


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

Date: Wed, 17 Dec 1997 15:56:07 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Part of a line
Message-Id: <comdog-ya02408000R1712971556070001@news.panix.com>

In article <eli$9712171229@qz.little-neck.ny.us>, Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:

>brian d foy <comdog@computerdog.com> wrote:
>>    $line =~ m/Archivo:(.*?)<br>/;
>>    $data = $1;
>
>     ($data) = $line =~ /Archivo:(.*?)<br>/;

i've found that novice programmers get tripped up by that sort of 
construction, so i've stopped doing that sort of thing.  but then,
i usually opt for maintainability rather than compactness or
elegance, although i suppose i could write it as

    $line = q qjust another new york perl hackerq;

    ($ny, $pm) = ($line =~ m m^just another (\S+) (\S+)m);

which seems to show the program flow more clearly.

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


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

Date: Wed, 17 Dec 1997 20:35:45 -0000
From: "Neil Sedley" <neil@nsedley.dircon.co.uk-antispam>
Subject: Re: Password encription
Message-Id: <349837a7.0@newsread1.dircon.co.uk>

This is really a http server issue.

I assume you have access to the machine running the server. If the server is
Apache, then you will need to set up a .htaccess file so that the server
will require authentication. If you want people to use the same ID and
password as they do for normal logging in, then you will need to create an
Apache password file based on the system passwords, I do this with the
following PERL program that I run once a day via a cron.

#!/usr/local/bin/perl
$authpath = "/usr/local/etc/httpd/auth";
open (OUTFILE, ">$authpath/passwd") || die "Output file open failed\n";
select OUTFILE;
while ( ( $user, $passwd ) = getpwent () ) {
 $passwd =~ /^\*/ || print "$user:$passwd\n";
}
close OUTFILE;

For further information on setting up authentication see the Apache
documentation or try http://www.apache.org

Neil Sedley
nsedley@dircon.co.uk


mgeorgeadis@fallschurch.esys.com wrote in message
<882377046.196018186@dejanews.com>...
>I'll get right to the point ... I've developed a sequence of html pages
>from perl scripts. The first of these html pages asks the user to enter
>a user name and a password. When the user submits the info the password
>field can be seen in the next page's URL. I need help in correcting this
>problem as well as figuring a way to check the validity of the entered
>password with the corresponding user name. Any advice would be greatly
>appreciated. Thanks.
>
>-MG
>
>-------------------==== Posted via Deja News ====-----------------------
>      http://www.dejanews.com/     Search, Read, Post to Usenet




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

Date: Wed, 17 Dec 1997 12:36:47 -0800 (PST)
From: the_bulkster05@alias.cyberpass.net (bosch6)
Subject: Q Sorting Web access file?
Message-Id: <199712172036.MAA06716@sirius.infonex.com>

Hi,

I have a Web server thats logging events in random order. While Im waiting for a patch, 
I want to sort the existing log files chronologically using Perl. Heres a few sample lines 
of what an access log looks like

207.175.99.82 - - 15/Dec/1997212658 -0500 GET /images/edhome.gif HTTP/1.0 200 203
207.91.76.252 - - 15/Dec/1997191423 -0500 GET /images/dlhome.gif HTTP/1.0 200 639
207.175.99.82 - - 15/Dec/1997212652 -0500 GET /images/dlhome.gif HTTP/1.0 200 639
206.114.185.122 - - 16/Dec/1997074431 -0500 POST /cgi-bin/dlsscgi.exe HTTP/1.0 200 755
165.224.19.154 - - 16/Dec/1997092734 -0500 GET /cgi-bin/dlsscgi.exe HTTP/1.0 405 170
206.91.76.252 - - 15/Dec/1997191421 -0500 POST /cgi-bin/afsacgi.exe HTTP/1.0 200 3742
207.175.99.82 - - 15/Dec/1997212637 -0500 POST /cgi-bin/dlsscgi.exe HTTP/1.0 200 3742

I can set up some code like this

@sortedlines = sort chrono @lines

sub chrono 
    linea = lineb


But all thats not seeing that middle field stuff i.e., 15/Dec/1997212637 which I think 
will require some sort of hairy regular expression. Unfortunately, Im just starting out with 
Perl and cant seem to get a handle on how I would approach this. Any hints would be 
appreciated.

Replies to the group preferred, but if you send e-mail, send to the address below.

TIA

-- Pat
~~~~~~~~~~~~~~~~~~~~~~~~
Pat Bosch           if3  kid  life = 0 
bosch6@hotmail.com



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

Date: 17 Dec 1997 21:20:11 GMT
From: juergen@unicorn.noris.de (Juergen Heinzl)
Subject: Re: Q Sorting Web access file?
Message-Id: <slrn69ggr7.u1.juergen@unicorn.noris.de>

In article <199712172036.MAA06716@sirius.infonex.com>, bosch6 wrote:
>I have a Web server thats logging events in random order. While Im waiting for a patch, 
>I want to sort the existing log files chronologically using Perl. Heres a few sample lines 
>of what an access log looks like
>
>207.175.99.82 - - 15/Dec/1997212658 -0500 GET /images/edhome.gif HTTP/1.0 200 203
[...]

>But all thats not seeing that middle field stuff i.e., 15/Dec/1997212637 which I think 
>will require some sort of hairy regular expression. Unfortunately, Im just starting out with 
>Perl and cant seem to get a handle on how I would approach this. Any hints would be 
>appreciated.

perhaps this is enough already. If $i is your whole line, then ...

$i =~ /\d+\.\d+\.\d+\.\d+ - - (\d+)\/(\w+)\/(\d+) .*/o;

 ... will give you $1 (15 for instance), $2 (Dec) and $3 (1997212658).
Could be tuned probably, but ...

Bye, Juergen

-- 
\ Real name     : Juergen Heinzl     \       no flames      /
 \ EMail Private : unicorn@noris.de   \ send money instead /
  \ Phone Private : +49 911-4501186    \                  /


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

Date: 17 Dec 1997 20:32:25 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: references to globalise locally generatied filehandles
Message-Id: <679csp$icc@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <67913n$22j$1@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, 
>    fischman@dfki.uni-sb.de (Matthias Fischmann) writes:
>:more complicated, but the problem lies here).
>:
>:        sub newopen {
>:             my $path = shift;
>:             local *FH;  # not my!
>:             open (FH, $path) || return undef;
>:             return \*FH;
>:         }
>:         $fh = newopen('/etc/passwd');
>
>The bug is the backslash there in the return.  Although 
>when I first wrote that code it worked fine, for reasons
>that are less than perfectly clear, it now has to be 
>return *FH instead.

Umm, the reasons are known alright (in some quarters).  I'd guess
if it "worked" before it caused a memory leak.

A typeglob carries two different refcounts: one for the GV
itself, and another for the contents of the GV (called
the GP, glob-pointer).  Taking a ref to a GV doesn't increment
the GP's refcount, which means scope exit will happily clear
out the contents of *FH (but not *FH itself, because the
refcount of _that_ did get incremented by the return()
mechanism and subsequent assignment to $fh).

Doing something like:

    % perl -MDevel::Peek
    Dump(*main);
    $a = \*main;
    Dump(*main);
    $b = *main;
    Dump(*main);
    __END__

should satisfy the curious.

Offhand, I can't think of any theoretical reasons why the GP's
refcount should not be incremented to get the expected behavior.
But as a practical matter, it will cause a significant impact on
performance--there's quite a bit of generic code in the source that
creates refs to things.

 - Sarathy.
   gsar@umich.edu


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

Date: Wed, 17 Dec 1997 14:01:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: SoCheer <socheer.kwek@ac.com>
Subject: Re: Script calls embedded in web pages
Message-Id: <Pine.GSO.3.96.971217135710.29019K-100000@user2.teleport.com>

On Wed, 17 Dec 1997, SoCheer wrote:

> Instead of physically clicking on a link to execute the perl script,
> could we call a perl script from a html tag ? 
> 
> I know <IMG SRC="/cgi-bin/scriptname.pl"> does it, but a broken image is
> shown.  How could I get rid of it ? 

You may not have realized this, but there's nothing Perl specific about
this question: It's actually about HTTP, HTML and CGI, since the answer
will be the same even if the script isn't written in Perl. So the question
doesn't really belong in a Perl-specific newsgroup. But I'll take a try at
it anyway. :-) 

If you get a broken image, that means that when the browser requested the
image, it didn't get a valid one. You'll need to fix the script so that
its output is a valid image, including any needed headers. If you're not
sure what the output should contain, you'll want to check the docs and
FAQs, and possibly the newsgroups, about CGI and HTTP. Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 17 Dec 1997 15:47:50 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: searchable archive
Message-Id: <comdog-ya02408000R1712971547500001@news.panix.com>

In article <34981D3E.59E2@bell-labs.com>, Stephan Vladimir Bugaj <bugaj@bell-labs.com> wrote:

>Is there a (searchable) archive of comp.lang.perl.misc, preferably
>with a web interface?  I searched on comp.lang.perl.misc in
>AltaVista and at perl.com and found stuff but not what I was 
>hoping to find... 

you can check Dejanews, which not only archives usenet, but uses
perl to do it.

good luck!

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


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

Date: Wed, 17 Dec 1997 15:43:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: targeting a frame window with perl
Message-Id: <comdog-ya02408000R1712971543020001@news.panix.com>

In article <34981E8B.83BA10E6@wwgv.com>, Shawn Tolivar <shawn@wwgv.com> wrote:

>is there a way to use perl to target an html frame without using the <a
>href> tag?

you could use the print() function in combination with the techniques
illustrating in the Frames documentation referenced in the CGI Meta
FAQ.

good luck!

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


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

Date: 17 Dec 1997 20:56:35 GMT
From: gabor@vinyl.quickweb.com (Gabor)
Subject: Re: Teaching programing
Message-Id: <slrn69geno.spl.gabor@vinyl.quickweb.com>

In article <russellm-ya02408000R1512972017590001@news.fastlane.net>,
Russell Mirabelli wrote:
- Janos Blazi <jblazi@wuerzburg.netsurf.de> wrote:
- >I have to teach programing to 15-years old pupils. Is PERL a good language
- >to start with? Our "authorities" seem to prefer PASCAL, but PASCAL seems to
- >be absolutely dead and the first steps in PERL are perhaps easier than the
- >first steps in C. Or should I take BASIC (oh horror!)?
- 
- One real shortcoming of PERL for teaching beginning programming is that is
- not strictly typed. Not to start a variable typing war, /but/ the concept
- of typing is actually very useful when learning programming.
- 
- PERL is great for many things (I keep finding more of them each day) but
- teaching programming isn't one of them. I really would advise PASCAL.

I think you should give Java a try as a teaching language.  It's free
and strongly typed.  Available for quite a few platforms and is quite
easy to learn.  I think perl is a cool language and probably my
favourite but it definitely wasn't my first and there are 'weird'
things in perl which will bite you. ;-)

gabor.
--
    That means I'll have to use $ans to suppress newlines now.  
    Life is ridiculous. 
        -- Larry Wall in Configure from the perl distribution


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

Date: Wed, 17 Dec 1997 21:21:05 +0100
From: Henk Kloepping <henk@fortean.org>
Subject: Time-out w/o alarm() on NT
Message-Id: <34983431.4ECD7F47@fortean.org>

Help.

Anybody out there who has a suggestion on how to implement 
a time-out mechanism for Perl on NT, comparable with what
is done on Unix and VMS with %SIG and alarm()? 


Suuuomikkie vinnouuven,
-- 
   Henk Kloepping                         Voice  : +31 598 42 31 31
   European Fortean Foundation            e-mail : henk@fortean.org

   To join ISOC.NL: http://www.isoc.nl/files/join.htm


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

Date: 17 Dec 1997 21:36:50 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Wacky idea: a PERL server
Message-Id: <679gli$4qn$1@uranium.btinternet.com>

The perl interpreter (still at 4.036 Unfortunately) that ships with 
Novell IntraNetware sort of does this (Netware has heavy process startup 
overhead I understand) it is loaded as an NLM with the webserver and 
receives the script via a socket.  This has been warned about as a 
potential security hole (you can just telnet to the port and send a nasty 
script).

But then again Intranetware is not a very popular server platform among 
the wider Perling community ;-}

Jonathan



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

Date: 17 Dec 1997 21:22:03 GMT
From: juergen@unicorn.noris.de (Juergen Heinzl)
Subject: Re: What kind of machine wouldn't support FLOCK?
Message-Id: <slrn69gguo.u1.juergen@unicorn.noris.de>

In article <34981D71.7474A6BF@aol.com>, Vik Rubenfeld wrote:
>The camel book says "Invoking flock will produce a fatal error if used on a
>machine that doesn't implement flock(2) or emulate it through someother
>locking mechanism." What kind of machine wouldn't implement or emulate flock?
>And, how common is it for a machine not to support flock? Thanks very much in
>advance to all for any info.

Well, a Sinix machine for instance :-) ... as soon as you have to use it, it
is common enough.

Bye, Juergen

-- 
\ Real name     : Juergen Heinzl     \       no flames      /
 \ EMail Private : unicorn@noris.de   \ send money instead /
  \ Phone Private : +49 911-4501186    \                  /


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

Date: Wed, 17 Dec 1997 13:55:07 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: What kind of machine wouldn't support FLOCK?
Message-Id: <34983C2A.2AC1F6B0@mystech.com>

Vik Rubenfeld wrote:

> The camel book says "Invoking flock will produce a fatal error if used on a
> machine that doesn't implement flock(2) or emulate it through someother
> locking mechanism." What kind of machine wouldn't implement or emulate flock?
> And, how common is it for a machine not to support flock? Thanks very much in
> advance to
> all for any info.

Good question. For what it's worth, ActiveState's web site does not list flock()
as an unsupported routine in their Win32 port of Perl. Moreover, a quick check
check with two processes accessing the same file (on WinNT) showed that flock
works as advertised. So, with UNIX and Win32 covered, I imagine that will take
care of most of us. :-)

HTH,
Mark Reibert
-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1494
**************************************

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