[18197] in Perl-Users-Digest
Perl-Users Digest, Issue: 365 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 27 11:05:48 2001
Date: Tue, 27 Feb 2001 08:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983289911-v10-i365@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 27 Feb 2001 Volume: 10 Number: 365
Today's topics:
ANNOUNCE: DDL::Oracle v1.03 <rvsutherland@yahoo.com>
ANNOUNCE: CGI::Explorer V 1.00 <ron@savage.net.au>
ANNOUNCE: OpenInteract 1.06 <chris@cwinters.com>
ANNOUNCE: SPOPS 0.39 <chris@cwinters.com>
ANNOUNCE: Spreadsheet::WriteExcel 0.30 (John McNamara)
Creating string of values ignoring empty values (Thomas Wolfmaier)
Re: Date formatting (Peter J. Acklam)
Re: Etymology of hash (Rafael Garcia-Suarez)
Re: Etymology of hash <bart.lateur@skynet.be>
Re: Etymology of hash (Abigail)
Re: form/cgi help really needed! emelin@my-deja.com
Re: form/cgi help really needed! <bart.lateur@skynet.be>
Re: GUI interface for Perl program <mjcarman@home.com>
Re: How the CLPM turns (Tad McClellan)
Re: How the CLPM turns (Randal L. Schwartz)
Interpolate.pm (was Re: PROPOSAL: Graphics::ColorNames) <bmb@ginger.libs.uga.edu>
Re: Interpolate.pm (was Re: PROPOSAL: Graphics::ColorNa <bmb@ginger.libs.uga.edu>
Need some help to understand how some scripts work (Shawn Ryder)
Re: Need some help to understand how some scripts work <shanem@ll.mit.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 24 Feb 2001 19:21:49 -0500
From: "Richard Sutherland" <rvsutherland@yahoo.com>
Subject: ANNOUNCE: DDL::Oracle v1.03
Message-Id: <t9nfvpofi4vh9c@corp.supernews.com>
===========================================================================
Release of DDL::Oracle, Version 1.03
===========================================================================
CHANGES
Rewrote routine for CREATE TRIGGER, which was buggy, farkled and less
than a stellar effort. Added support for SCHEMA and DATABASE triggers.
Separated CREATE PACKAGE BODY from the CREATE PACKAGE function, giving
it its own function. Apologies to users who may have scripts which
rely on the original behavior -- you will need to adapt them if you
upgrade to 1.03 and beyond.
Added a new configure attribute -- "heading" -- which, if set to zero,
omits the heading REM's containing name, rank, serial number and time
of day.
DESCRIPTION
Designed for Oracle DBA's and users, for Oracle versions 7.3, 8.0
and 8i. Reverse engineers database objects (tables, indexes, users,
profiles, tablespaces, roles, constraints, etc.). Generates DDL to
*resize* tables and indexes to the provided standard or to a user
defined standard. Can reorganize/defragment tablespaces.
SYNOPSIS
use DBI;
use DDL::Oracle;
my $dbh = DBI->connect(
"dbi:Oracle:dbname",
"username",
"password",
{
PrintError => 0,
RaiseError => 1
}
);
# Use default resizing and schema options.
# query default DBA_xxx tables (could use USER_xxx for non-DBA types)
DDL::Oracle->configure(
dbh => $dbh,
);
# Create a list of one or more objects
my $sth = $dbh->prepare(
"SELECT
owner
, name
FROM
dba_tables
WHERE
tablespace_name = 'MY_TBLSP' -- your millage may vary
"
);
$sth->execute;
my $list = $sth->fetchall_arrayref;
my $obj = DDL::Oracle->new(
type => "table",
list => $list, );
);
my $ddl = $obj->create; # or $obj->resize; or $obj->drop; etc.
print $ddl; # Use STDOUT so user can redirect to desired file.
AUTHOR
Richard V. Sutherland
rvsutherland@yahoo.com
COPYRIGHT
Copyright (c) 2000, 2001 Richard V. Sutherland. All rights reserved.
This module is free software. It may be used, redistributed, and/or
modified under the same terms as Perl itself. See:
http://www.perl.com/perl/misc/Artistic.html
===========================================================================
AVAILABILITY
===========================================================================
DDL::Oracle is available from the CPAN, and from:
http://sourceforge.net/projects/ddl-oracle/
------------------------------
Date: Mon, 26 Feb 2001 20:16:34 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Explorer V 1.00
Message-Id: <t9nfvh8kcogk98@corp.supernews.com>
CGI::Explorer is available from CPAN or from YAWS (pronounced 'mine' : Yet
Another Web Site):
http://savage.net.au/Perl.html#CGI::Explorer
Extracts from the POD:
NAME
====
CGI::Explorer - A class to manage a tree of data, for use in CGI scripts
VERSION
=======
This document refers to version 1.00 of CGI::Explorer, released 24-02-2001.
SYNOPSIS
========
See the POD in Explorer.pm, or see ce.pl.
DESCRIPTION
===========
CGI::Explorer is a support module for CGI scripts. It manages a tree of
data, so
that the script can display the tree, and the user can click on a node in
the tree
to open or close that node.
Opening a node reveals all children of that node, and restores their
open/close state.
Closing a node hides all children of that node.
CGI::Explorer is pure Perl.
Overview
========
CGI::Explorer reconstructs its internal representation of the tree each time
the script
is invoked.
Some of data comes from the script calling $tree -> from_directory(...) or
$tree -> from_hash(...), and some of the data comes from CGI form fields
returned
from the previous invocation of the script.
Specifically, the open/closed state of each node is sent on a round trip
from one
invocation of the script out to the browser, and, via a 'form submit', back
to the
next invocation of the script.
Also, clicking on a node on a form submits the form, and passed the id of
the node
so clicked back to the second invocation of the script.
State maintenance - a complex issue - is discussed further below. See the
'state'
method.
Constructor and initialization
==============================
new(...) returns a CGI::Explorer object.
This is the class's contructor.
A call to new() is equivalent to:
new(a_href => 0, image_dir => '/images', show_current => 1, show_id => 1,
show_name => 1)
Icons for Nodes
===============
CGI::Explorer ships with a set of icons, with a PNG and a GIF for each icon.
The default is GIF, because more browsers support GIF transparency than
support
PNG transparency.
You don't have to pay UniSys a licence for usage of the GIF compression
algorithm,
because the GIFs are uncompressed :-).
The make file does not install these files automatically. You must install
them
manually under the web server's document root, and then use the image_dir
option
to point to the directory containing these files.
Methods
=======
as_HTML($q)
-----------
Returns a string.
Converts the internal representation of the data into HTML, and returns
that.
current_id()
------------
Returns the id of the 'current' node.
from_dir($dir_name)
-------------------
Returns nothing.
Tells the object to construct its internal representation of the data by
parsing
the names of all sub-directories in the given directory.
You call as_HTML($q) later to retrieve a printable version of the data.
See ce.pl for an example.
from_hash($hash_ref)
--------------------
Returns nothing.
Tells the object to construct its internal representation of the data by
extracting
information from the given hash.
You would call as_HTML($q) later to retrieve a printable version of the
data.
See ce.pl for an example.
name()
------
Returns the name of the 'current' node.
parent_id()
-----------
Returns the id of the parent of the 'current' node.
set()
-----
Returns nothing.
Used to set a new value for any option, after a call to new().
set() takes the same parameters as new().
state($q)
---------
Returns the open/closed state of all nodes.
Tells the object to update its internal representation of the data by
recovering
CGI form field data from the given CGI object.
Warning: You must use the return value as a field, presumably hidden, in a
form,
in your script so that the value can do a round trip out to the browser and
back.
This way the value can be recovered by the next invocation of your script.
This is the mechanism CGI::Explorer uses to maintain the open/closed state
of each
node. State maintenance is a quite a complex issue. For details, see:
Writing Apache Modules with Perl and C
Lincoln Stein and Doug MacEachern
O'Reilly
1-56592-567-X
Chapter 5 'Maintaining State'
You can see the problem: When you close and then re-open a node, you expect
all child
nodes to be restored to the open/close state they were in before the node
was closed.
With a program like Windows Explorer, this is simple, since the program
remains in
RAM, running, all the time nodes are being clicked. Thus it can maintain the
state of
each node in its own (process) memory.
With a CGI script, 2 separate invocations of the script must maintain state
outside
their own memory. I have chosen to use (hidden) form fields in
C<CGI::Explorer>.
See ce.pl for an example.
Old Versions of Perl
====================
If your Perl complains about things like:
use warnings; or
require 5.005_62; or
our @ISA = qw(Exporter);
you can either:
upgrade Perl or
download http://savage.net.au/Perl/old_Explorer.pm
Required Modules
================
Tree::Nary. Not shipped with Perl. Get it from a CPAN near you
AUTHOR
======
CGI::Explorer was written by Ron Savage <ron@savage.net.au> in 2001.
Home page: http://savage.net.au/index.html
COPYRIGHT
=========
Copyright (c) 2001, Ron Savage. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under
the same terms as Perl itself.
Motto
=====
No compliment too small...
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
------------------------------
Date: Tue, 27 Feb 2001 12:29:04 GMT
From: Chris Winters <chris@cwinters.com>
Subject: ANNOUNCE: OpenInteract 1.06
Message-Id: <t9nfv315k3r091@corp.supernews.com>
A new version of OpenInteract has been released.
OpenInteract is an
extensible web application framework built on Apache,
mod_perl, the
Template Toolkit and SPOPS object persistence.
Quick change notes:
- Move to a text-based package repository format -- GDBM is
no longer
required.
- Add new tasks for 'oi_manage' to make upgrading easy and
to allow
websites to always maintain the most current version of the
documentation.
- Several bugfixes, including one which prevented MySQL
version 3.22
and earlier from using the automatic SQL installation
process.
URLs:
Download the source (also available on CPAN):
http://sourceforge.net/project/showfiles.php?group_id=16810
Release notes/changelog (much more detailed than above):
http://sourceforge.net/project/shownotes.php?release_id=25295
Sourceforge home (mailing lists, CVS, bugs, etc.):
http://sourceforge.net/projects/openinteract/
Other home:
http://www.openinteract.org/
Thanks!
Chris
--
Chris Winters (chris@cwinters.com)
Building enterprise-capable snack solutions since 1988.
------------------------------
Date: Tue, 27 Feb 2001 12:29:50 GMT
From: Chris Winters <chris@cwinters.com>
Subject: ANNOUNCE: SPOPS 0.39
Message-Id: <t9nfuqdrnv5g8f@corp.supernews.com>
A new version of SPOPS (Simple Perl Object Persistence with
Security)
has been released. It's available via CPAN ('SPOPS' or
'Bundle::SPOPS') as well as Sourceforge (URLs below).
Highlights of this release:
- Move the key generation utility functions out of
SPOPS::DBI::*
- Allow each object to track whether it's been persisted to
the
database or not
- Modify and better document the 'has_a' automatic object
relationship handling
- Minor bugfixes, primarily to SPOPS::GDBM
The only change you might notice is if you're currently
using SPOPS
with MySQL and 'AUTO_INCREMENT' fields. These folks will
need to add a
'increment_field => 1' in each object's configuration to get
the
previous behavior.
Changelog and release notes:
http://sourceforge.net/project/shownotes.php?release_id=25292
Download from Sourceforge:
http://sourceforge.net/project/showfiles.php?group_id=16810&release_id=25292
SPOPS is supported by the openinteract-(help|dev) mailing
lists:
http://sourceforge.net/mail/?group_id=16810
Thanks!
Chris
--
Chris Winters (chris@cwinters.com)
Building enterprise-capable snack solutions since 1988.
------------------------------
Date: Tue, 27 Feb 2001 00:04:52 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: ANNOUNCE: Spreadsheet::WriteExcel 0.30
Message-Id: <t9nfvanqq1nq97@corp.supernews.com>
======================================================================
ANNOUNCE
Spreadsheet::WriteExcel version 0.30 has been uploaded to CPAN.
This version supports formulas and functions.
======================================================================
NAME
Spreadsheet::WriteExcel - Write formatted text and numbers to a
cross-platform Excel binary file.
======================================================================
DESCRIPTION
The Spreadsheet::WriteExcel module can be used create a cross-
platform Excel binary file. Multiple worksheets can be added to a
workbook and formatting can be applied to cells. Text, numbers,
formulas and hyperlinks can be written to the cells.
The Excel file produced by this module is compatible with Excel 5,
95, 97 and 2000.
The module will work on the majority of Windows, UNIX and
Macintosh platforms. Generated files are also compatible with the
Linux/UNIX spreadsheet applications OpenOffice, Gnumeric and XESS.
The generated files are not compatible with MS Access.
This module cannot be used to read an Excel file. See
Spreadsheet::ParseExcel or look at the main documentation for some
suggestions. This module cannot be uses to write to an existing
Excel file.
======================================================================
SYNOPSIS
To write a string, a formatted string, a number and a formula to
the first worksheet in an Excel workbook called perl.xls:
use Spreadsheet::WriteExcel;
# Create a new Excel workbook
my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
$worksheet = $workbook->addworksheet(); # Add a worksheet
$format = $workbook->addformat(); # Add a format
# Define the format
$format->set_bold();
$format->set_color('red');
$format->set_align('center');
# Row and column are zero indexed
$col = 0;
$row = 0;
$worksheet->write($row, $col, "Hi Excel!");
$worksheet->write(1, $col, "Hi Excel!", $format);
$worksheet->write(2, $col, 1.2345);
$worksheet->write(3, $col, '=SIN(PI()/4)');
======================================================================
INSTALLATION
Method 1
Download the zipped tar file from one of the following:
http://search.cpan.org/search?dist=Spreadsheet-WriteExcel
http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?idinfo=154
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/J/JM/JMCNAMARA/
Unzip the module as follows or use winzip:
tar -zxvf Spreadsheet-WriteExcel-0.xx.tar.gz
The module can be installed using the standard Perl procedure:
perl Makefile.PL
make
make test
make install # You may need to be root
make clean # or make realclean
Windows users without a working "make" can get nmake from:
ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
Method 2
If you have CPAN.pm configured you can install the module as
follows:
perl -MCPAN -e "install 'Spreadsheet::WriteExcel'"
Method 3
ActivePerl users can use PPM as follows:
C:\> ppm
PPM> set repository tmp
http://homepage.eircom.net/~jmcnamara/perl
PPM> install Spreadsheet-WriteExcel
PPM> quit
C:\>
If this fails try the following:
PPM>install
http://homepage.eircom.net/~jmcnamara/perl/Spreadsheet-WriteExcel.ppd
NOTE: Version 0.23 changed the WriteExcel namespace. To tidy up
stray files it would be best to uninstall any version older than
this prior to installation.
======================================================================
REQUIREMENTS
This module requires Perl 5.005 (or later) and Parse::RecDescent:
http://search.cpan.org/search?dist=Parse-RecDescent
======================================================================
AUTHOR
John McNamara (jmcnamara@cpan.org)
--
------------------------------
Date: 27 Feb 2001 16:35:40 +0100
From: twolfmaier@acm.org (Thomas Wolfmaier)
Subject: Creating string of values ignoring empty values
Message-Id: <3.0.2.32.20010227103831.01154290@interlog.com>
I am looking for a better, in the sense of shorter and more readable, way
to accomplish the following:
My script retrieves a record as a hash reference from a database. Let's
assume the record represents a user and includes fields for different types
of permissions, e.g.,
hasSection1AccessPermission
hasSection2AccessPermission
hasSection3AccessPermission
The values are 0 for false and 1 for true. I now have to create a
comma-separated string of a user's access permissions in English or German.
For example, if a user has access permission for Section 1 and Section 3,
the string should read in English and German, respectively:
Section 1, Section 3
Bereich 1, Bereich 3
That's the way I came up with:
my $record = {} ; // given, hash reference of record retrieved from database
my $lang = 'en'; // given, either 'en' or 'de'
use constant ACCESS_PERMISSION {
'hasSection1AccessPermission' => {
'en' => 'Section 1',
'de' => 'Bereich 1'
},
'hasSection2AccessPermission' => {
'en' => 'Section 2',
'de' => 'Bereich 2'
},
'hasSection3AccessPermission' => {
'en' => 'Section 3',
'de' => 'Bereich 3'
}
};
my $access_permissions = '';
foreach (qw(hasSection1AccessPermission hasSection2AccessPermission
hasSection3AccessPermission)) {
$access_permissions .= ($access_permissions ? ', ' : '') .
ACCESS_PERMISSION->{$_}->{$lang} if $record->{$_};
}
I don't particularly like this last part. I tried to use 'join' together
with 'map':
my $access_permission = join ', ', map { ACCESS_PERMISSION->{$_}->{$lang} }
qw(hasSection1AccessPermission hasSection2AccessPermission
hasSection3AccessPermission);
For some reason I find this more readable. Unfortunately, it gives me:
Section 1, , Section 3
According to the documentation it is possible to return zero elements from
a map block, but I have no idea how and I could not find any example in the
documentation.
Thanks for your help,
Thomas
-----------------------------------------------------
Thomas Wolfmaier
Human-Computer Interaction Resource Network (HCIRN)
25 Bucks Green Road, Thornhill, ON, Canada, L3T 4G1
Tel: +1-905-881-7095
Email: twolfmaier@acm.org
Web: www.hcirn.com
-----------------------------------------------------
--
Posted from bretweir.total.net [154.11.89.176]
via Mailgate.ORG Server - http://www.Mailgate.ORG
------------------------------
Date: 27 Feb 2001 16:29:41 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Date formatting
Message-Id: <wkpug487us.fsf@math.uio.no>
Steve Attwell <s.attwell@snet.net> writes:
> Is there any module that will convert data format mm/dd/yyyy to
> DD-MMM-YY eg. 1/13/2001 == 13-JAN-01? I've looked in CPAN and perldoc.
There are modules that can do this, although a module is hardly
necessary:
sub my_date_convert {
my @mon = qw(JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC);
my @date = split '/', shift;
sprintf '%02d-%s-%02d', $date[1], $mon[$date[0]-1], $date[2] % 100;
}
Peter
--
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!
------------------------------
Date: Tue, 27 Feb 2001 14:21:37 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Etymology of hash
Message-Id: <slrn99nduq.tai.rgarciasuarez@rafael.kazibao.net>
Lou Moran wrote in comp.lang.perl.misc:
> --Still new to programming (but not computers) and I am trying to
> catch up. I noticed that a hash goes by several names:
>
> Associative Array
> Dictionary (in Python anyway)
In Java too... Java has also HashTables.
> I am sure there are others. I get what a hash is/does I was wondering
> why it is called a hash:
Because perl hashes are implemented as hash tables, and that hash tables
use internally a hash function.
See http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?hash+function
and related items.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Tue, 27 Feb 2001 14:57:44 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Etymology of hash
Message-Id: <0ufn9t8jkb91desvtpcbohmg5ipov27daq@4ax.com>
Lou Moran wrote:
>I was wondering
>why it is called a hash:
Because of how it's implemented: using a hashing function. A string is
first reduced to a small number, that will hopefully be rather unique
over the set of existing keys. Then, only the items with that particular
hash value for their key still need to be checked.
So the group of all keys is subdivided (hashed) in quite a few lots
smaller sets.
Hash functions are typically closely related to checksums.
--
Bart.
------------------------------
Date: 27 Feb 2001 15:56:53 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Etymology of hash
Message-Id: <slrn99nji5.jh7.abigail@tsathoggua.rlyeh.net>
Lou Moran (lmoran@wtsg.com) wrote on MMDCCXXXVII September MCMXCIII in
<URL:news:92cn9t4pg8td3kc6tr6ctnsat9thuhmbad@4ax.com>:
\\ --Still new to programming (but not computers) and I am trying to
\\ catch up. I noticed that a hash goes by several names:
\\
\\ Associative Array
\\ Dictionary (in Python anyway)
Mapping (in LPC)
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'
------------------------------
Date: 27 Feb 2001 14:06:24 GMT
From: emelin@my-deja.com
Subject: Re: form/cgi help really needed!
Message-Id: <97gc90$49t$1@news.netmar.com>
In article <02vm9tg3re2le1qmd4pk5vi5p4a3c3ajpd@4ax.com>, Bart Lateur
<bart.lateur@skynet.be> writes:
>You must make sure that your input fields have a UNIQUE name for the
>whole form. Since you're constructing a table with many items, that
>implies that for a field name, you need a combination of the field type,
>for example "QTY" with a product identifier, for example the part
>number.
I don't think this is the problem.
The names are already unique for every field - $qty and $tpr are incremented
with the foreach loop as you can see below...
The solution is probably a simple one...
But the question remains: How can I send the info on a line ONLY if the
checkbox at the end of the line is checked??
foreach $item (@stock) {
if ($item =~ /$FORM::part/ig) {
@array = (@array, $item);
$rfq=a0;
$qty=0;
$tpr=00;
foreach $match (@array) {
($partnr,$quantity,$manufacturer,$datecode,$package) = split(/,/, $match);
$rfq++; # these are the field names
$qty++; # they are incremented
$tpr++; # so they will be unique
}
if ($partnr =~ /$FORM::part/ig) {
print "<td><font face=verdana size=1>$partnr</td>";
print "<td><font face=verdana size=1><input type=text size=5 name=$qty
value=$quantity></td>";
print "<td><font face=verdana size=1>$manufacturer</td>";
print "<td><font face=verdana size=1>$datecode</td>";
print "<td><font face=verdana size=1>$package</td>";
print "<td><font face=verdana size=1><center><input type=text size=5
name=$tpr value=0.00></td>";
$result = join(",", $partnr,$manufacturer,$datecode,$package);
print "<td><center><input type=checkbox name=$rfq value=$result></td>";
print "<tr>";
}
}
}
print "<td colspan=6><font face=verdana size=1><b>Couldn't find what you're
looking for?</b> <br>We will do our best to help you! <a href=...>Click
here...</a><p><br></td>";
print "<td><center><input type=submit value=RFQ></form></td>";
print "</td></table><p><br>";
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: Tue, 27 Feb 2001 14:52:43 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: form/cgi help really needed!
Message-Id: <bifn9ts9bjbr4c0lgc8nrqduecofktf2vo@4ax.com>
emelin@my-deja.com wrote:
>I don't think this is the problem.
>The names are already unique for every field - $qty and $tpr are incremented
>with the foreach loop as you can see below...
>foreach $item (@stock) {
> if ($item =~ /$FORM::part/ig) {
> @array = (@array, $item);
>
> $rfq=a0;
> $qty=0;
> $tpr=00;
Nope. You're resetting these variables for each item. And ++$qty is the
same as ++$tpr.
The idea isn't bad, though. Move this in front of the loop. But you
should start out every name with a different letter.
$rfq='R0';
$qty='Q0';
$tpr='T0';
foreach (@item) { ...
>But the question remains: How can I send the info on a line ONLY if the
>checkbox at the end of the line is checked??
You can't avoid the browser for sending it. Simply ignore the data
unless the name of the checkbox appears in the query, when it is
checked, in which case the value will be 'on'.
--
Bart.
------------------------------
Date: Tue, 27 Feb 2001 08:13:04 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: GUI interface for Perl program
Message-Id: <3A9BB5F0.90374190@home.com>
Mirek Rewak wrote:
>
> I want to to write program that will be interfaced by a GUI on Win32.
> I don't know what interface will I use: Win32, GTK or Tk. I know that
> there are modules for that GUIs, but I want someone to share some
> opionions about stability, practical use, etc. these modules. (I'd
> preffer Win32::GUI)
I've no idea how many people have used more than one of the GUI building
tool sets. I've never used GTK and haven't done much more than look at
Win32::GUI -- I gave that up when I found Tk. Perhaps some of the folks
on comp.lang.perl.tk have tried the other methods; you might try asking
there.
That said, I would suggest using Tk over Win32::GUI. There's more
documentation, the aforementioned newsgroup, and your code will be
portable across platforms. (Presumably Gtk is as well.) On the other
hand, Win32::GUI may give you a more native "feel."
-mjc
------------------------------
Date: Tue, 27 Feb 2001 09:02:45 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How the CLPM turns
Message-Id: <slrn99ncs4.aa1.tadmc@tadmc26.august.net>
Bernard El-Hagin <bernard.el-hagin@lido-tech.net> wrote:
>
> After frequenting this newsgroup for over 2 years I've come to know
>some of the regular posters here and decided that, as a service to
>newbies, I'd write up some typical regular poster replies to typical
>newbie questions. That way someone new to the group can pick the style
>of answer he/she prefers and look for that person in the future.
>
>DISCLAIMER!
>My goal in doing this is not to offend anyone. Quite the contrary,
>actually.
I like it!
>__________
>Typical newbie question:
>
>Subject: NEWBIE DEMANDS HELP NOW!!!!!!
Note that the Subject that the poster has carefully crafted hit
three of my scorefile rules, so I probably wouldn't have even
seen the post if it had happened for real :-)
Subject: newbie (-5000)
Subject: !!! (-9999)
~Subject: \c[a-z] (-9999 subject contains no lower case letters)
>I'm new to PERL. I want to sort an array, but don't know how. I've spent
>hours searching the Web, the docs, the FAQs, the books, and under my
^^^^^^^^^ ^^^^^^^^
>bed, but couldn't find the answer.
A rather non-typical newbie there.
>You must help me NOW or I'll get
>fired.
>__________
>
>Tad McClellan:
>
>It's Perl or perl, not PERL (perldoc perlfaq1). You are expected to read
^^^^
I don't think I ever say that. I make a conscious effort to not
say that. I say "check", not "read". Nobody is going to actually
read all 1500 pages of the standard docs, they just check them
when something comes up.
>__________
>
>Bart Lateur:
>
>my @sorted = sort @unsorted;
This style reminds me of the "teach to fish" cliche, which in turn
reminds me of a rec.humor.funny post from last week. Since it is
topical I should get it out there while the off-topic topic is
still current:
-----------------------------------------------------
Message-id: <S1071.2808@netfunny.com>
From: glenn@the-nest.com (Glenn Brensinger)
Newsgroups: rec.humor.funny
Subject: Thought For The Day
Date: Fri, 23 Feb 2001 19:30:01 PST
Organization: Diversified Business Services
Reply-Path: glenn@the-nest.com
Keywords: topical, smirk, forwarded
Approved: funny-request@netfunny.com
Followup-To: rec.humor.d
Give a man a fish, and he'll eat for a day. Teach a man to fish, and
he'll get nailed by a U.S. nuclear submarine.
-----------------------------------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 27 Feb 2001 07:08:18 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How the CLPM turns
Message-Id: <m1k86c88pp.fsf@halfdome.holdit.com>
>>>>> "Bernard" == Bernard El-Hagin <bernard.el-hagin@lido-tech.net> writes:
Bernard> Typical answers:
Bernard> Randal Schwartz:
Bernard> Funny you should ask that. I just wrote an article about
Bernard> sorting for my Web Techniques column. Check it out. <url
Bernard> follows>
{grin}
It's really weird, having now written 122 columns, how many things are
already answered there.
And there's another 2.5 a month (how do I keep up, gah!)... so once
again...
IF YOU WANT TO GET YOUR NAME IN PRINT, please send me column
ideas. Please. Please.
Past columns are at:
http://www.stonehenge.com/merlyn/WebTechniques/
http://www.stonehenge.com/merlyn/UnixReview/
http://www.stonehenge.com/merlyn/LinuxMag/
for examples of what not to send me because I already did them. :)
And thanks to the publishers for letting me put them online as a
public resource, even though they own the copyright.
print "Just another Perl column hack writer,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 27 Feb 2001 10:26:16 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Interpolate.pm (was Re: PROPOSAL: Graphics::ColorNames)
Message-Id: <Pine.A41.4.21.0102271010200.12368-100000@ginger.libs.uga.edu>
On Tue, 27 Feb 2001, Bart Lateur wrote:
> Unfortunately it's not the only bug in Interpolation.pm. For example,
> this will fail, too:
>
> sub foo { shift }
> use Interpolation 'FOO' => \&foo;
> use Interpolation 'FOO' => \&foo;
> -->
> Values in argument list in `use Interpolation' must be code refs;
> aborting
> BEGIN failed--compilation aborted
>
> Perhaps it even has the same cause...
>
> The bug you are referring to, is because this module uses the original
> code ref as the tied object(!), so you can't use the same sub for more
> than one hash. One more indirection gets around it: I bless the scalar
> containing the code ref, not the code ref itself:
>
> sub TIEHASH {
> my $pack = shift;
> my $cref = shift;
> ref $cref) or croak "'$cref' no a code ref; aborting";
> bless \$cref, $pack;
> }
>
> sub FETCH {
> &{${shift()}};
> }
On Feb 22, Ilmari Karonen answered my post, the subject line of which was
"Bug in Interpolate.pm?", with a suggested code change (see line 65
below). It seems to fix the problem. I haven't seen the author respond
to this, but I suspect he's seen it.
Brad
(from Interpolate.pm)
50 sub import {
51 my $caller_pack = caller;
52 # print STDERR "exporter args: (@_); caller pack: $caller_pack\n";
53 my $my_pack = shift;
54 if (@_ % 2) {
55 croak "Argument list in `use $my_pack' must be list of pairs; aborting";
56 }
57 while (@_) {
58 my $hashname = shift;
59 my $function = shift;
60
61 # Probably should use ISA or something here, because
62 # $function might be blessed
63 #unless (ref $function eq CODE || exists $builtin{$function}) {
64 #courtesy Ilmari Karonen:
65 unless (UNIVERSAL::isa($function, 'CODE') or exists $builtin{$function}) {
66 croak "Values in argument list in `use $my_pack' must be code refs; aborting\n";
67 }
68
69 my %fakehash;
70 tie %fakehash, $my_pack, $function;
71 *{$caller_pack . '::' . $hashname} = \%fakehash;
72 }
73 }
------------------------------
Date: Tue, 27 Feb 2001 10:34:25 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Interpolate.pm (was Re: PROPOSAL: Graphics::ColorNames)
Message-Id: <Pine.A41.4.21.0102271032530.12368-100000@ginger.libs.uga.edu>
> (from Interpolate.pm)
My apologies; it is, of course, Interpolation.pm.
Brad
------------------------------
Date: Tue, 27 Feb 2001 15:33:39 GMT
From: sryder@webryder.com (Shawn Ryder)
Subject: Need some help to understand how some scripts work
Message-Id: <3a9bc7c2.13126113@news>
I have three scripts that I would like to have somebody explain to me
exactly how they work. Is it okay if I simply post the links here for
the community to look at or should I go about it another way ??
They aren't that big but here are the text files that you can view !
If you have any questions - please feel free to post here or contact
me directly !
http://www.webryder.com/read.txt
http://www.webryder.com/write.txt
http://www.webryder.com/test_mail.txt
Also if it isn't too much trouble - what would it take to run these in
a Windows enviroment ??
Thanks Again !
__________________
Shawn Ryder
sryder@webryder.com
ICQ # 60081110
http://www.webryder.com
------------------------------
Date: Tue, 27 Feb 2001 10:59:06 -0500
From: Shane McDaniel <shanem@ll.mit.edu>
Subject: Re: Need some help to understand how some scripts work
Message-Id: <3A9BCECA.9DCE5E65@ll.mit.edu>
Shawn Ryder wrote:
>
> I have three scripts that I would like to have somebody explain to me
> exactly how they work. Is it okay if I simply post the links here for
> the community to look at or should I go about it another way ??
>
> They aren't that big but here are the text files that you can view !
> If you have any questions - please feel free to post here or contact
> me directly !
>
> http://www.webryder.com/read.txt
>
> http://www.webryder.com/write.txt
>
> http://www.webryder.com/test_mail.txt
>
> Also if it isn't too much trouble - what would it take to run these in
> a Windows enviroment ??
>
> Thanks Again !
>
To run them in windows you would need to install perl, which you can get
from www.perl.com. Since these scripts are CGI's you would also need to
install/run IIS and make sure the perl install automatically links .pl
extensions to the perl app. If not you'll have to do it yourself.
------------------------------
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 V10 Issue 365
**************************************