[10257] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3849 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 29 13:57:28 1998

Date: Tue, 29 Sep 98 10:00:56 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 29 Sep 1998     Volume: 8 Number: 3849

Today's topics:
        ActivePerl incompatibility? (network,socket) <philip@hrsites.com>
    Re: ActivePerl incompatibility? (network,socket) (Brian Jepson)
    Re: Alternate colors in tables with perl command? <jdw@dev.tivoli.com>
    Re: Alternate colors in tables with perl command? (Joergen W. Lang)
    Re: an observation on why python will fail <perlguy@inlink.com>
    Re: an observation on why python will fail Aaron_Watters@my-dejanews.com
        Answer: How to obtain my server IP number ?? dragnovich@my-dejanews.com
    Re: Answer: How to obtain my server IP number ?? <95ncp@eng.cam.ac.uk>
    Re: Automatically change content of HTML-page with Perl (David A. Black)
    Re: Automatically change content of HTML-page with Perl (I R A Aggie)
    Re: Automatically change content of HTML-page with Perl (Abigail)
    Re: Automatically uploading files with perl <dparrott@ford.com>
        BANIP <moishe@kosher.com>
    Re: BANIP (brian d foy)
        Can't find YIELD in threaded perl on Solaris. <lavoie@zeus.genie.uottawa.ca>
        CGI to CGI <swet@world.waena.edu>
        CGI.pm - forms within tables - How to? (Steven D Jones)
    Re: CGI.pm - forms within tables - How to? (Matt Knecht)
    Re: CGI.pm - forms within tables - How to? <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: CGI.pm - forms within tables - How to? (Matt Knecht)
    Re: CGI.pm - forms within tables - How to? <perlguy@inlink.com>
    Re: Coding Standards? (Ken Rich)
    Re: delayed $aa += $n desired <rick.delaney@shaw.wave.ca>
    Re: delayed $aa += $n desired (Mark-Jason Dominus)
    Re: delayed $aa += $n desired <aeb@saltfarm.bt.co.uk>
    Re: delayed $aa += $n desired (David A. Black)
    Re: delayed $aa += $n desired (Larry Rosler)
    Re: delayed $aa += $n desired (David A. Black)
    Re: delayed $aa += $n desired (Abigail)
    Re: Email parser <aperrin@mcmahon.qal.berkeley.edu>
        Find NbOfCpu <Christopher.Marquis@fairchildsemi.com>
    Re: format help huntersean@hotmail.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 29 Sep 1998 10:41:24 -0500
From: Philip Parker <philip@hrsites.com>
Subject: ActivePerl incompatibility? (network,socket)
Message-Id: <3610FFA3.1D1E2B34@hrsites.com>

I've encountered a problem while trying to learn network programming
with Perl. I am using ActivePerl 5.005_02 build 502 on an NT4wks box
with SP3. The code below was taken directly from the blue llama 2nd ed.
(p246) but I've tried it on two machines (same Perl, OS, etc) and keep
getting the error message:

IO::Socket::INET: Unknown error at C:\Work\ipctest.pl line 4
cannot connect to daytime port at localhost at C:\Work\ipctest.pl line
4.

And when I 'use strict', I get another error message:

Global symbol "$remote" requires explicit package name at
C:\Work\ipctest.pl line 4.
Execution of C:\Work\ipctest.pl aborted due to compilation errors.

I've looked at the ActiveState list of known issues
(http://www.activestate.com/ActivePerl/knownissues.htm), but couldn't
identify anything I thought related to the problem. I've not knowingly
altered any files or deviated from the default setup options. I would
appreciate it if anyone could either tell me what might be wrong or
point me in a direction to find out. Thanks.


1: #!/usr/bin/perl -w
2:
3: use IO::Socket;
4: $remote = IO::Socket::INET->new(
5:     Proto => "tcp",
6:     PeerAddr => "localhost",
7:     PeerPort => "daytime(13)",
8: )or die "cannot connect to daytime port at localhost";
9: while(<$remote>){print}


                                        Philip Parker
                                        philipNOSPAM@hrsites.com




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

Date: 29 Sep 1998 16:01:21 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: ActivePerl incompatibility? (network,socket)
Message-Id: <slrn71215c.1vb.bjepson@gelvis.ids.net>

On Tue, 29 Sep 1998 10:41:24 -0500, Philip Parker <philip@hrsites.com> wrote:
>I've encountered a problem while trying to learn network programming
>with Perl. I am using ActivePerl 5.005_02 build 502 on an NT4wks box
>with SP3. The code below was taken directly from the blue llama 2nd ed.
>(p246) but I've tried it on two machines (same Perl, OS, etc) and keep
>getting the error message:
>
>IO::Socket::INET: Unknown error at C:\Work\ipctest.pl line 4
>cannot connect to daytime port at localhost at C:\Work\ipctest.pl line
>4.
>
[...]

Is there a service running that listens to this port?  Try telnetting to
the port with:

    telnet localhost 13

I think that daytime can be installed on your machine by going
to the control panel, choosing Network->Services->Add and install "Simple
TCP/IP Services".  This is an optional component, so it might not be
installed on your workstation.  If it is, and if you can telnet to the
port and get the time, then this might indicate a problem. 

Here's some sample code that works for me (ActiveState 502, NT Server 4.0
SP3):

  use IO::Socket;
  $s = new IO::Socket::INET( PeerAddr => 'gelvis',
                             PeerPort => 'daytime(13)');
  print $s->getline;  # prints the time

gelvis is a host on my network running GNU/Linux on a SPARCStation.

-- 
Brian Jepson * (bjepson@ids.net)  * http://users.ids.net/~bjepson
              Choosy mothers choose to chew Chew-Z


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

Date: 29 Sep 1998 08:17:21 -0500
From: Jim Woodgate <jdw@dev.tivoli.com>
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <ob7lynukgu.fsf@alder.dev.tivoli.com>



daniel@intecomp.com (Daniel Pray) writes:
> I've seen some professional web site that have a perl script list a
> database request.  The table is alternated rows of color. Does anyone know
> how to do this?

Here's a quick one:

use CGI qw/:standard/;

my @colors = qw/#DEDEDE #888888/;

print header, start_html;

my @table;
my $rows = 5;

for (my $i=0; $i<$rows; $i++) {
  push (@table, TR(td({-bgcolor => $colors[$i % @colors]},
		      [qw/1 2 3 4 5/])));
		       
}

print table(@table), end_html;


-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: Tue, 29 Sep 1998 17:40:37 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <1dg4m5n.1hn78l91wqwuoiN@host028-210.seicom.net>

daniel@intecomp.com (Daniel Pray) writes:
 
> I've seen some professional web site that have a perl script list a
> database request.  The table is alternated rows of color. Does anyone know
> how to do this?

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

my $i = "";      # just to make sure we don't get an "only used once"
                 # warning we do something with $i.
                 # In the while loop $i holds the return value
                 # of the "..." (range) operator. 
                 # This is done so we don't get a 
                 # warning about using "range" "in void context".
                 
while (<DATA>)
{
       $i = (( print "grey : $_" )...( print "white: $_" ));
}
__END__
one
two
three
four
five
six
seven
eight
nine
ten

hth,

Joergen

-- 
  To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
print pack q,h52,,unpack q,H52,,join q,,,map chr,split q, ,,q,164 87 55
71 2 22 230 246 71 134 86 39 2 5 86 39 198 2 132 22 54 182 86 39 2 18,;


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

Date: Tue, 29 Sep 1998 11:35:52 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: an observation on why python will fail
Message-Id: <3610C618.38A35C8E@inlink.com>

Lloyd Wood wrote:
> 
> It always comes down to the most visible leading advocate and exemplar:
> tcl:    John Ousterhout
> perl:   T^HLarry Wall
> python: George Reese

George Reese, I thought it was John Cleese!  Hell, if THAT is the
case... oh wait, wrong python.  Nevermind.

-- 
(Disclaimer: I haven't had enough caffeine today, sorry.)
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Tue, 29 Sep 1998 13:59:42 GMT
From: Aaron_Watters@my-dejanews.com
Subject: Re: an observation on why python will fail
Message-Id: <6uqp4d$62l$1@nnrp1.dejanews.com>

In article <JsLP1.3$94.119760@burlma1-snr1.gtei.net>,
  "Elaine -HappyFunBall- Ashton" <eashton@bbnplanet.com> wrote:
> >Lloyd Wood <eep1lw@surrey.ac.uk> wrote:
> >>It always comes down to the most visible leading advocate and exemplar:
> >Bullshit.
>
> While I do believe that is a pretty hasty gross generalisation, at the core
> it does have some merit. Larry Wall is somewhat charismatic, seemingly
> diplomatic and has encouraged the diversity of contribution from others to
> make Perl the language that it is.

While I haven't met Larry Wall I do have the deepest respect
for his talents and accomplishments.  Nevertheless I must say
that tolerance and diplomacy has not been a notable characteristic
among many *other* Perl advocates, and I don't know what that
does or doesn't have to do with Perl's success.  Personally, I
think that Perl and some other things happened to be in the
right place at the right time (in addition to being an excellent
tool for many purposes, of course).

Diplomacy, openness, respectfulness, tolerance and an
encouraging attitude I'm sure wouldn't hurt in any endeavor,
as I'm sure we all learned in kindergarten ;).

One problem the Python community has is that when we prove
to others that their favorite tools are deficient, the others get mad
and endeavor to punish us.  Oh well.  ;)

   -- Aaron Watters

===
The master, when he entered the grand temple
asked about everything.  Some one said, "Who
will say [he] knows the rules of propriety?
He enters the grand temple and asks about everything!"
The master heard this remark, and said,
"This is a rule of propriety."

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Tue, 29 Sep 1998 15:48:01 GMT
From: dragnovich@my-dejanews.com
Subject: Answer: How to obtain my server IP number ??
Message-Id: <6uqvfh$cvq$1@nnrp1.dejanews.com>

Ok yesterday I put this question and, some answers where very helpfull..
THANKS
And here's the complet script:

$remoteip = $ENV{'REMOTE_ADDR'};
$localip = $ENV{'REMOTE_HOST'};
print "Hello you are on $remoteip ip number\n";
print "and test.pl script is on $localip ip number\n";

But I find a very good problem! there are NO
gethostbyname, getnetbyname, getservbyname, gethostbyaddr, etc...
routines on perl for win 32 (thats the perl 5.0.0.5 version!)

And how you can see it is imposible to get the IP number, but all is not a
failure! we can get that data, only if the script is runned by a web server,
and obtaining the data with the ENVIRONMENT variables.

Thnks to :
Earl Hood      but I simple can't do that men =(
Nigel Parker   Good answer but is very complex! but look I simplified it, did
               you see? so don't be afraid!!! =-)
all other that help me and/or answer my question...

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Tue, 29 Sep 1998 17:21:06 +0100
From: Nigel Parker <95ncp@eng.cam.ac.uk>
Subject: Re: Answer: How to obtain my server IP number ??
Message-Id: <Pine.HPP.3.96L.980929171059.15122C-100000@club.eng.cam.ac.uk>

On Tue, 29 Sep 1998 dragnovich@my-dejanews.com wrote:

: Ok yesterday I put this question and, some answers where very helpfull..
: THANKS
: And here's the complet script:
: 
: $remoteip = $ENV{'REMOTE_ADDR'};
: $localip = $ENV{'REMOTE_HOST'};
: print "Hello you are on $remoteip ip number\n";
: print "and test.pl script is on $localip ip number\n";
[snip]

I've just checked with a "print all the environment variables script"...

The result was REMOTE_HOST = REMOTE_ADDR = 131.127.194.209!

I believe:
 REMOTE_ADDR = numerical IP address of remote computer (running browser).
 REMOTE_NAME = name for REMOTE_ADDR if available, else equals REMOTE_ADDR.
 SERVER_NAME = name for web server if available, else numerical IP address
               of web server.

This is on a Sun flavour of unix, running Apache webserver.  What are you
running, and values do you get for $remoteip and $localip?

Cheers.


Nigel
-- 
Girton College, Cambridge, England, CB3 0JG.             Tel: 0411 384803

http://welcome.to/nigels                             nigel.parker@iee.org



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

Date: Tue, 29 Sep 1998 08:45:42 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Automatically change content of HTML-page with Perl
Message-Id: <6uqkpm$l07$1@earth.superlink.net>

mcalbers@multivisual.nl writes:

>Does anyone know how to change the content of a HTML-page automatically using
>Perl.

>I need to change a page on a weekly base.


Every week, run a Perl script which, ummm, changes the content of the file,
assuming it's a static file.  

I don't know what else to say, in the absence of any detailed information about
which aspects of Perl's file input and output operations are puzzling you.


David Black
dblack@saturn.superlink.net


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

Date: Tue, 29 Sep 1998 11:08:42 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Automatically change content of HTML-page with Perl
Message-Id: <fl_aggie-2909981108420001@aggie.coaps.fsu.edu>

In article <6uqkpm$l07$1@earth.superlink.net>, dblack@saturn.superlink.net
(David A. Black) wrote:

+ Every week, run a Perl script which, ummm, changes the content of 
+ the file, assuming it's a static file.  

cron(1) is a wonderful thing...

James


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

Date: 29 Sep 1998 16:48:22 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Automatically change content of HTML-page with Perl
Message-Id: <6ur30m$ol1$4@client3.news.psi.net>

mcalbers@multivisual.nl (mcalbers@multivisual.nl) wrote on MDCCCLV
September MCMXCIII in <URL:news:6uqfki$s9l$1@nnrp1.dejanews.com>:
++ Does anyone know how to change the content of a HTML-page automatically using
++ Perl.


{  open FILE, "> /your/html/page" or die "Eeeps: $!";
   print FILE "<HTML> .... </HTML>";
   close FILE;
   redo if sleep 7 * 24 * 60 * 60;
}



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


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

Date: Tue, 29 Sep 1998 11:05:02 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
To: mcalbers@my-dejanews.com
Subject: Re: Automatically uploading files with perl
Message-Id: <3610F71E.1689@ford.com>

mcalbers@my-dejanews.com wrote:
> 
> Hello,
> 
> Does anyone know how to automatically changing the content of a web page using
> perl.
> I need to add an url every week.
> 
> Thanks,
> 
> Michael.
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

yes, I do. for the appropriate fee, I could be enticed to tell you!
-- 

-----------------------------------------------------------------------
Dennis M. Parrott        |            Unix:  dparrott@ford.com
PCSE Webmaster           |           PROFS:  DPARROTT
Ford Motor Company       |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA   | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------
Voice: 313-322-4933  Fax: 313-248-1234  Pager: 313-851-2958


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

Date: Tue, 29 Sep 1998 11:12:08 -0400
From: "Moishe Wasserman" <moishe@kosher.com>
Subject: BANIP
Message-Id: <6uqtg2$7gk$1@whisper.globalserve.net>

Is there a way to ban someone from an HTML page. I know how to do it in
perl, but then I dont know how to call it to the HTML page.

Please MAIL me the reply       moishew@globalserve.net




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

Date: Tue, 29 Sep 1998 11:28:41 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: BANIP
Message-Id: <comdog-ya02408000R2909981128410001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6uqtg2$7gk$1@whisper.globalserve.net>, "Moishe Wasserman" <moishe@kosher.com> posted:

>Is there a way to ban someone from an HTML page. I know how to do it in
>perl, but then I dont know how to call it to the HTML page.

use your server to provide access control.  if that isn't enough,
you might want to block the bad guy at the router.

it's easier not to use Perl to do this (except perhaps mod_perl in
the server config file(s)).

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers needs volunteers! <URL:http://www.pm.org/to-do.html>


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

Date: 29 Sep 1998 10:28:30 -0400
From: Lavoie Philippe <lavoie@zeus.genie.uottawa.ca>
Subject: Can't find YIELD in threaded perl on Solaris.
Message-Id: <y67lyn56y9.fsf@yoho.genie.uottawa.ca>


Hi,

line 465 of Thread.xs fails because it can't find YIELD.

For now I'm recompiling without the threading option, but I'd
appreciate a patch.

Thanks.

Phil

PS Solaris 2.5.1 on Ultra1  and Solaris2.6 on Pentium gives this error



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

Date: 29 Sep 98 14:16:56 GMT
From: Swetal Jariwala <swet@world.waena.edu>
Subject: CGI to CGI
Message-Id: <3610ebd8.0@news.inch.com>

I have a web form that has only one parameter, a user ID.  Once the
user clicks on the Submit button my Perl CGI script is called.  The
problem now is that my script needs to send that user ID to another
CGI script to do a lookup in a database.  Get the record associated
with user ID and inject that into a Notes database.  Anyone have any
idea how to go about doing this?  The perl script is on a Win32
platform.  Thanks for all help.

Swetal Jariwala
swet@clk.net




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

Date: Tue, 29 Sep 1998 12:40:32 GMT
From: Steve_D_Jones@hp.com (Steven D Jones)
Subject: CGI.pm - forms within tables - How to?
Message-Id: <6uqkg6$m8@fcnews.fc.hp.com>

I would like to create a form which is formated by placing the input fields 
inside of a table.  Here's an html example:

<HTML><BODY>
<TABLE BORDER=1>
<FORM>

<TR>
<TD><INPUT TYPE="radio" NAME="test" VALUE="Hello">Hello</TD>
<TD><INPUT TYPE="radio" NAME="test" VALUE="Goodbye">Goodbye</TD>
</TR>

</FORM>
</TABLE>
</HTML></BODY>

How would I do this using CGI.pm?

Thanks for your help.

Steve Jones

Steve_D_Jones@hp.com
970-898-7805


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

Date: Tue, 29 Sep 1998 15:01:02 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <OC6Q1.1042$7Q6.6921163@news2.voicenet.com>

Steven D Jones <Steve_D_Jones@hp.com> wrote:
>I would like to create a form which is formated by placing the input fields 
>inside of a table.  Here's an html example:

[ snip HTML ]

>How would I do this using CGI.pm?

You don't.  CGI.pm doesn't know anything about tables.  You need to
build your own tables, and use CGI.pm to fill in the cells of the table.

I was tasked to write a web frontend for a database.  Since DBI
convieniently returns an array ref to array refs, I built a table
generator around that format and used it everywhere.  Here's what I use
to do that:

# Takes a ref to an array of arrays and turns it into an html table
sub array_ref2table
{
    my $table   = shift;
    my $recurse = shift || 0;

    my $ret    = '';
    my $indent = "\t" x $recurse;

    $ret .= "\n" unless $recurse;
    $ret .= "<TABLE BORDER>\n";

    for $row (@{$table}) {
        $ret .= "$indent\t<TR>\n";

        for $cell (@{$row}) {
            if (ref $cell eq 'ARRAY') { # must be another table
                $ret .= "$indent\t\t<TD>\n$indent\t\t\t";
                $ret .= array_ref2table($cell, $recurse + 3);
                $ret .= "\n$indent\t\t</TD>\n";
            } else {
                $ret .= "$indent\t\t<TD> $cell </TD>\n";
            }
        }
        $ret .= "$indent\t</TR>\n";
    }

    $ret .= $indent if $recurse;
    $ret .= "</TABLE>";
    $ret .= "\n" unless $recurse;

    return $ret;
}


If a cell is an array ref, it assumes it's another tables and it will
nest them.  Usually, I just unshift a header onto a $db->fetchall_arrayref.
Here's a quick example:

$row1_col1 = 
$cell3 = $cgi->radio_group
(
    '-name'       => 'colors',
    '-values'     => [ qw/Red Green Blue/ ],
    '-linebreak'  => 'true',
    '-default'    => 'Red',
)

$table =
[
    [ 'Table header', 'Col2 header'    ],
    [ $row1_col1,     'Another column' ],
];

array_ref2table($table);

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: 29 Sep 1998 17:20:27 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <83af3jymh0.fsf@vcpc.univie.ac.at>

Re: CGI.pm - forms within tables - How to?, Matt
<hex@voicenet.com> said:

Matt> You don't.  CGI.pm doesn't know anything about tables.

Huh?  What about all the HTML shortcuts?

print table(@rows);

tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Tue, 29 Sep 1998 16:01:17 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <hv7Q1.1047$7Q6.6946945@news2.voicenet.com>

Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
>Re: CGI.pm - forms within tables - How to?, Matt
><hex@voicenet.com> said:
>
>Matt> You don't.  CGI.pm doesn't know anything about tables.
>
>Huh?  What about all the HTML shortcuts?
>
>print table(@rows);

Gah!  I can't believe after all the times I've been through the docs
that I missed this.

Something can be said for reading the docs from front to back, instead
of merrily grepping/searching your way through them.

Well, there's a few hours of job work that was totally unnesecery.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Tue, 29 Sep 1998 15:40:33 GMT
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <3610FF71.283C9D9@inlink.com>

You could put the FORM tags outside of the TABLE tags.  It really
doesn't matter.  Then just do a:

$q->start_form;
 ..Table stuff here...
$->end_form;

HTH
-- 
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: 29 Sep 1998 12:48:40 GMT
From: kenr@troi.cc.rochester.edu (Ken Rich)
Subject: Re: Coding Standards?
Message-Id: <6uqkv8$e9o6@biko.cc.rochester.edu>

In comp.lang.perl.misc, lemull@unx.sas.com writes:
:Can anyone point me to a set of Coding Standards developed
:specifically for Perl?

Not perl specific, but Steve McConnell's (?) book __Code Complete__
from Microsoft Press has really great recommendations on coding
standards, that bear a striking resemblance to man perlstyle, but
goes further in the good directions.

--
-ken rich                


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

Date: Tue, 29 Sep 1998 12:10:25 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: delayed $aa += $n desired
Message-Id: <3610CFBA.3B856778@shaw.wave.ca>

[posted & mailed]

Xah wrote:
> 
> The following code will print "1 2".
> 
> #!perl -w
> my $aa = 1;
> &{sub {print "$_[0] ";}}($aa++);
> print $aa;
> 
> But, I really need the increment to be 2. So, if I change $aa++ to 
> $aa+=2, then it prints "3 3", which is not what I wanted. I want "1 
> 3".

Try:
    &{sub {print "$_[0] ";$_[0]+=2}}($aa);

> **The above is an extraction of my problem.** Here is my question: Is 
> there a way to replace ($aa++) by something else so I get my desired 
> effect?

A brief scan through perlop would show there is no such operator. 
However you could roll your own sub to mimic it, something like above.

Why you would *need* this, I don't know.  Personally, I would just split
the code into two statements.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 29 Sep 1998 08:30:56 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: delayed $aa += $n desired
Message-Id: <6uqju0$a2t$1@monet.op.net>

In article <6uqci0$crk$1@nntp2.ba.best.com>, Xah <xah@best.com> wrote:
>Is there a way to get something like $aa =+ 2, so that the value of the
>variable is returned before it is incremented?

	(($aa,$aa+=2)[0])



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

Date: 29 Sep 1998 14:43:20 +0100
From: Tony Bass <aeb@saltfarm.bt.co.uk>
Subject: Re: delayed $aa += $n desired
Message-Id: <rg90j3xcef.fsf@calf.saltfarm.bt.co.uk>

mjd@op.net (Mark-Jason Dominus) writes:

> In article <6uqci0$crk$1@nntp2.ba.best.com>, Xah <xah@best.com> wrote:
> >Is there a way to get something like $aa =+ 2, so that the value of the
> >variable is returned before it is incremented?

> 	(($aa,$aa+=2)[0])

yielding the post-value,

   calf$ cat try2        
   #! /usr/local/bin/perl -w
   use strict;
   my $aa = 42;
   print( (($aa,$aa+=2)[0]), "\n");
   exit 0;
   ...
   calf$ try2
   44
   calf$ 


   calf$ perl -v

   This is perl, version 5.001
   ...

I think the delays in dereferencing make any interleaving of
side-effects dangerously unpredictable and better avoided in such
contexts.  Perhaps

   sub postinc {
    my $pre = $_[0];
    $_[0] += $_[1];
    return $pre;
   }

   ...postinc($aa, 2)...

might be a fairly safe way of expressing it if one had to.


-- 
# A E Bass                                      Tel: (01473) 645305
# MLB 3/19, BT Laboratories                     e-mail: aeb@saltfarm.bt.co.uk
# Martlesham Heath, Ipswich, Suffolk, IP5 3RE   Do not rely on From: line
#                                               Opinions are my own


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

Date: Tue, 29 Sep 1998 10:03:07 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: delayed $aa += $n desired
Message-Id: <6uqpar$6q1$1@earth.superlink.net>

Hello -

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

>Is there a way to get something like $aa =+ 2, so that the value of the
>variable is returned before it is incremented?

print map { ($_ += 2) - 2 } ($x, $x);

(But see Mark-Jason's more concise answer.  I'm just a map junkie.)


David Black
dblack@saturn.superlink.net


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

Date: Tue, 29 Sep 1998 07:46:52 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: delayed $aa += $n desired
Message-Id: <MPG.107a92b2d154dbd998988d@nntp.hpl.hp.com>

In article <rg90j3xcef.fsf@calf.saltfarm.bt.co.uk> on 29 Sep 1998 
14:43:20 +0100, Tony Bass <aeb@saltfarm.bt.co.uk> says...
> mjd@op.net (Mark-Jason Dominus) writes: 
> > 	(($aa,$aa+=2)[0])
 ... 
> I think the delays in dereferencing make any interleaving of
> side-effects dangerously unpredictable and better avoided in such
> contexts.  Perhaps
> 
>    sub postinc {
>     my $pre = $_[0];
>     $_[0] += $_[1];
>     return $pre;
>    }

Using MJD's one-liner approach, one could write your code simply as

        ((my $pre = $aa), $aa += 2)[0]

The point is to capture the rvalue.  The original way captures the 
lvalue, which is then modified by the increment.

The subroutine overhead wipes out the few-percent advantage of the 
strung-out approach compared to the array approach.

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

sub postinc { my $pre = $_[0]; $_[0] += 2; $pre };
$aa = 42;

timethese (1 << (shift || 0), {
    Array   => sub { my $result = ((my $pre = $aa), $aa += 2)[0] },
    Strung  => sub { my $pre = $aa; $aa += 2; my $result = $pre },
    Sub     => sub { my $result = postinc($aa) },
} );

Benchmark: timing 262144 iterations of Array, Strung, Sub...
     Array:  7 secs ( 7.08 usr  0.02 sys =  7.10 cpu)
    Strung:  7 secs ( 6.86 usr  0.02 sys =  6.88 cpu)
       Sub: 16 secs (12.37 usr  0.06 sys = 12.43 cpu)

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


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

Date: Tue, 29 Sep 1998 10:49:21 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: delayed $aa += $n desired
Message-Id: <6uqs1h$d1g$1@earth.superlink.net>

Hello -

Tony Bass <aeb@saltfarm.bt.co.uk> writes:

>mjd@op.net (Mark-Jason Dominus) writes:

>> In article <6uqci0$crk$1@nntp2.ba.best.com>, Xah <xah@best.com> wrote:
>> >Is there a way to get something like $aa =+ 2, so that the value of the
>> >variable is returned before it is incremented?

>> 	(($aa,$aa+=2)[0])

>yielding the post-value,

 ...

>I think the delays in dereferencing make any interleaving of
>side-effects dangerously unpredictable and better avoided in such
>contexts.  Perhaps

>   sub postinc {
>    my $pre = $_[0];
>    $_[0] += $_[1];
>    return $pre;
>   }

>   ...postinc($aa, 2)...

>might be a fairly safe way of expressing it if one had to.

Although you'll still run into the same evaluation precedence problems if you
use it, say, in a print() list:

my $x = 1;
print $x, postinc($x, 2);

prints 3,1

and

print postinc($x, 2), $x;

prints 1,3


David Black
dblack@saturn.superlink.net


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

Date: 29 Sep 1998 16:18:30 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: delayed $aa += $n desired
Message-Id: <6ur18m$ol1$1@client3.news.psi.net>

Xah (xah@best.com) wrote on MDCCCLV September MCMXCIII in
<URL:news:6uqci0$crk$1@nntp2.ba.best.com>:
++ 
++ The following code will print "1 2".
++ 
++ #!perl -w
++ my $aa = 1;
++ &{sub {print "$_[0] ";}}($aa++);
++ print $aa;
++ 
++ But, I really need the increment to be 2. So, if I change $aa++ to $aa+=2,
++ then it prints "3 3", which is not what I wanted. I want "1 3".
++ 
++ **The above is an extraction of my problem.** Here is my question: Is there
++ a way to replace ($aa++) by something else so I get my desired effect?



my $aa = 1; &{sub {print "$_[0] ";}} ($aa); $aa += 2; print $aa;

my $aa = 1; $aa = &{sub {print "$_[0] "; $_ [0]}} ($aa) + 2; print $aa;

my $aa = 1; &{sub {print "${\($_[0] - 2)} ";}} ($aa += 2); print $aa;

my $aa = 1; &{sub {print "$_[0] "; $_ [0] += 2}} ($aa); print $aa;

my $aa = 1; ${&{sub {print "${$_[0]} "; $_ [0]}} (\$aa)} += 2; print $aa;


package Number;
sub new () {my $class = shift; my $num = shift; bless \$num => $class}
use overload  '++' => sub {my $num = shift; $$num += 2; $num},
              '""' => sub {my $num = shift; $$num};
package main;
my $aa = Num -> new (1); &{sub {print "$_[0] ";}} ($aa++); print $aa;



Abigail
-- 
undef$/;$_=<DATA>;s/\n//g;s/Q(\d+)Q/' 'x$1/eg;%%=map{chop,$_}qw/dMMMMK"7
dMMMMb8 VMMMP"9 .dMMMbR .aMMMb2 "AMFS .aMPT VMMMbU "VMPW VPZ dkO/,"  Y",
"1 1X";for$%(keys(%%)){s/$%/$%{$%}/g}s/\d+/d.M x$&.P/eg&&s/.{62}/$&."\n"
x(2-!!(++$i%5))/eg&&chop&&print;
__DATA__
Q16Q5YXYRY6Q31Q1YXY1"Q1QZQ4Q1Q33Q1YXQ3QUQ5Q1Q29QOQ1Q.1Y1TY0Q1Q.1Q4Q1Q30Q
9Q3Q9Q3Q9Q4Q1Q22Q2Q3Q8Q3Q2Q1Q6Q1QXY5Y8Q3Q1"1YXY1"1Q3Q1Q3QXY1Q6Q1.1Y5YXYX
Q3Q1Q3Q5Y3Q4Q7YXYXY1TQ3Q1Q3QXY1Q6Q1SYXYXQ3Q9Q3Q1Q3QXY5YXQ20Q8Q3Q5Y8Q3Q1Q
31Q1.1Y1Q6Q1.1Y1Q31Q4"Y3Q4Q7Y1Q31Q1Q6Q1Q6Q1SY1Q31Q1Q6Q5YXY5Q19QXY2Q3Q2Q3
QXY5Y8Q10QXY1"1Y1WY1.1Y1Q6Q1.1Q9Q5Y5Y1Q6Q7Y3Q4Q7Q9QXYXY1TY1SY1Q6Q1SQ9QXY
XQ3Q9YXY5YXQ10Q


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

Date: Tue, 29 Sep 1998 09:04:07 -0700
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: Phil C <phil-att@worldnet.att.net>
Subject: Re: Email parser
Message-Id: <361104F7.77EFB9A4@mcmahon.qal.berkeley.edu>

[Reply posted and sent via e-mail]

1.) In the spirit of avoiding wheel-reinvention, check out procmail, a
free (I think) utility that does much of what you want without writing
perl scripts.  If it's not already on your system you can install it
locally and pipe your mail through it.

2.) Alternatively, the Mail::Internet and Mail::Header packages
available at CPAN will help you a lot.

Regards,
Andy Perrin

Phil C wrote:

> Is there a way ot read Emails from a perl script and parse its
> informations. I'm trying to filter automatically some of my incoming
> Emails like a UNIX tool called "Filter" used to do.
> Does anyone know where I can get access to such a script?
>
> Thanks
> Phil.



--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting -  (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King
http://socrates.berkeley.edu/~aperrin        to e-mail me)
    e-mail wheres-andy@socrates.berkeley.edu to find me!
-------------------------------------------------------------




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

Date: Tue, 29 Sep 1998 11:24:34 -0400
From: Christopher Marquis <Christopher.Marquis@fairchildsemi.com>
Subject: Find NbOfCpu
Message-Id: <3610FBB2.99A4AF3B@fairchildsemi.com>

Does anyone know of a module, function or some spawned shell trick to
find the number of cpu's running on a Solaris or HP/UX box?

Chris



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

Date: Tue, 29 Sep 1998 15:26:36 GMT
From: huntersean@hotmail.com
Subject: Re: format help
Message-Id: <6uqu7b$b82$1@nnrp1.dejanews.com>

TYPO IN PREVIOUS MAIL

>     ($one,$two,$three);
 ...err, I meant...
       ($one,$two,$three) = split;

Sean Hunter

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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