Re: use of modules with authorize.net

2001-06-21 Thread fliptop

Susanne wrote:
 
 does anyone have sample code that would educate me on credit card
 processing with authorize.net?  tia.

try this module from cpan:

http://search.cpan.org/search?dist=Business-OnlinePayment-AuthorizeNet



System Control

2001-06-21 Thread Thanh To

Hi All,

Does anyone know why Perl did not get back the system control after called 
the Java's Applet?  I'm using the system command:

system (java HelloJava);

And the problem is: Perl did not execute any of the following lines after 
that. I'd like to know why.

Thanks in advance!

Thanh
_
Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: need code

2001-06-21 Thread Alen Sarkinovic

I only had problems with executing script from web.
It's for sure that I will blok any char ,accept numbers letters and
underline.
My problem was ,that I coudn't force script to accept variable input and
execute command  (from web).
now everything works fine,it was mestake in command syntax.

Thanks
Alen

- Original Message -
From: Curtis Poe [EMAIL PROTECTED]
To: Camilo Gonzalez [EMAIL PROTECTED]; 'Alen Sarkinovic'
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, June 20, 2001 9:40 PM
Subject: RE: need code


 --- Camilo Gonzalez [EMAIL PROTECTED] wrote:
  try
 
  system (/bin/somecommand $variable);
 
  or even
 
  `somecommand $variable`;
 
  -Original Message-
  From: Alen Sarkinovic [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, June 20, 2001 2:11 PM
  To: [EMAIL PROTECTED]
  Subject: need code
 
 
  Hi
  Can anybody send me code of perl that will take input from web and
execute
  Unix command ,I mean SYSTEM(/bin/somecommand $variable)
 
  I have try everything but still  not able to execute from web
,everything
  goes fine from command line :perl -T script.pl variable=blabla


 Be very, very careful about this!  It's extremely dangerous to run
arbitrary commands with
 system().  If you already know the command you want to run, try using the
multiple argument form
 of system (untested code):

 #/usr/bin/perl -wT
 use strict;
 use CGI qw/:standard/;

 my $program= '/bin/somecommand';
 my $dirty_variable = param( 'variable' );

 # untaint the variable
 # you'll need to create your own regex if \w+ does not
 # meet your needs
 my ( $variable ) = ( $dirty_variable =~ /^(\w+)$/ );

 if ( ! $variable ) { some_error_routine( $variable ) }

 my $bad_status = system( $program, $variable );

 if ( $bad_status ) { die $program returned a bad error code: $? }

 Using the multiple argument form of 'system' forces the arguments to be
passed to the program and
 not to the shell, where they could be interpreted in unexpected (and
possibly dangerous) ways.

 Absolutely do NOT use backticks unless it is critical that you capture the
output of the command.
 Backticks are extremely dangerous if you are allowing any user data near
the shell.

 Cheers,
 Curtis Poe

 =
 Senior Programmer
 Onsite! Technology (http://www.onsitetech.com/)
 Ovid on http://www.perlmonks.org/

 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.com/




Re: Re: Running CGI's locally

2001-06-21 Thread Mel Matsuoka

At 12:10 PM 06/20/2001 +0200, Aaron Craig wrote:

At the office, I'm running Apache 1.3 locally on Win2000, and I don't have 
to use the shebang line, as I have Perl in my path.  However, I just 
installed Apache on my Win2000 machine at home, using the current Apache 
installation for Windows (ends with an .msi extension) found on 
www.apache.org.  Now, I need to use the shebang line, using Windows style 
paths (ie C:/perl/perl.exe).  I vaguely remember adding a registry entry by 
hand to get Apache running Perl on my Win2000 here in the office, which I 
didn't do on my computer at home.  Is that what I'm missing, or has Apache 
changed and now requires the shebang line on Windows as well.

Thw Win32 port of apache has the ScriptInterpreterSource directive which
you must uncomment in the httpd.conf file in order for it to ignore the
shebang lines and use the file associations set in the windows registry.

This is such a great convinience for developing perl scripts on a windows
box that have to be deployed on a unix box. I cant tell you how many times
I've torn my hair out, debugging and trying to figure out why my win32
developed scripts bomb out on my unix boxen...when the problem was just
that I forgot to change the shebang line to point to the unix perl path!

Aloha,
mel



__
mel matsuokaHawaiian Image Productions
Chief Executive Alphageek  (vox)1.808.531.5474
[EMAIL PROTECTED]  (fax)1.808.526.4040



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Moon, John

Here the code (is this what you wanted ?) but from Mel's reply looks like
the problem could be the endform 


use strict;
use CGI qw(:standard :all *table);
use vars qw($dbh $REQUEST) ;# global !
use DBI;
use Cwd;
my $CGI_HOME=cwd();# get $home
# use lib /opt/common/html/actual/cgi-bin/Library;
use lib Library;
require MyConnect;
use MyCategories;
#
#   (keywd,value) for estimates are:
#   FY=30-Jun-  - The fiscal year of the Estimate
#   ACCT=varchar2(15)   - Account to Input/View
#   CUST_ID=number(10)  - Customer to View, ACCT will be undef
#   ACTION=(ACCOUNT,CUSTOMER) - What type of Action is required
#   if ACTION is by CUSTOMER then nothing to UPDATE
#   INITIAL=(NO,YES)  - If YES or exist then display blank form
#   TYPE=(SUBMIT,NEXT)  - If NEXT display ONLY - this hidden value
#   will be set by client side script
#
#   To display the initial form from the call line enter the url plus:
#   INITIAL=YES. This will display a blank form PLUS and explanation.
#   defining expected values ... will replace with submitted
#
my %REQUEST = (FY   ='',
ACCT='',
CUST_ID='',
ACTION  ='ACCOUNT',
VIEW='CATEGORY',
INITIAL ='');
my $q=new CGI;
#
my $status; # the results of request
#
#   return submitted values, replacing default if present ...
#
foreach ($q-param) {
$REQUEST{$_}=$q-param($_);
}
if ($q-param('INITIAL') eq 'YES') {
$REQUEST{INITIAL}='YES';
BuildForm();
}
else {
$REQUEST{INITIAL}='NO'; 
ProcessForm();
# my (@request,$keywd);
# @request=$main::q-param;
#   foreach $keywd (@request) {
#   print $q-header(-type=text/html),
#   $q-start_html('Dump of Estimates by TechDirect');
#   print $q-dump();
#   print 'PMy values are:BR';
#   my $keywd;
#   foreach $keywd (keys %REQUEST) {
#   print $keywd = $REQUEST{$keywd}BR;
#   }
#   print $q-end_html;
}
# ===
sub BuildForm {
use strict;
use MyYTD;
use MyEstbyCat;
my (%YTD, %EST, %CATEGORY, %PRODUCT);
my ($YTD, $EST, $CATEGORY, $PRODUCT);
my $q=new CGI;
print $q-header(text/html),
#   'HTMLHEADTITLEEstimates by TechDirect/TITLE',
#   'BASE NAME=main',
#   '/HEADBODY';
$q-start_html({-title='Estimates by TechDirect',-base='main'});
print \n;
#
#   form for navigation, initial and subsequent request to
#   see another account or customer ...
#
print $q-startform({-target=main}),
center(h3('TechDirect Estimates'));
print \n;
my ($fy,$database, @setup, %sth, $category, $ytd, $est);
my ($title,$acct,$cust_id,$status,$year,$prev_fy);
$title='';
$acct='';
$cust_id='';
#
#   Example  Explanation:
#
#   If the fiscal year being requested is 2001-2002
#   then the fiscal year of the date from the YTD Table and the previous
#   Estimate will be for fiscal year 2000-2001 (or 30-Jun-2001)
#
if ($REQUEST{INITIAL} eq 'NO') {
#
#   converting (1)-(2) to 30-Jun-(2)
$fy=Internal_FY($REQUEST{FY});
}
else {
my $year;
(undef,undef,undef,undef,undef,$year)=localtime;
$REQUEST{FY}=sprintf(%4d-%4d,1900 + $year, 1901 + $year);
$fy=Internal_FY($REQUEST{FY});
}
$prev_fy='30-Jun-' . substr($REQUEST{FY},0,4);
print center(font({-size=3},'Fiscal Year'),
$q-textfield(  -name='FY',
-default=$REQUEST{FY},
-size=9,
-maxlength=9));
print \n;
$database=MyConnect();  # returns the database handle !
@setup = MyCategory($database, 1);  #prepare and returns ref to rows,
initial
($sth{CATEGORY}, $category)=@setup;
$CATEGORY=CAT_is($category);# move results hash
if ($REQUEST{ACCT} ne ''  or $REQUEST{CUST_ID} ne '') {
#
#   IF INITIAL and/or ACCT,CUST_ID requested
#   then get data for requested Acct or Customer
#   ELSE ship out blank form
#
@setup=MyYTD($database, 1, $prev_fy, $CATEGORY-{NBR},
$REQUEST{ACCT}, $REQUEST{CUST_ID});
#
#   YTD is by Product so if REQUEST{VIEW} = CATEGORY
#   then roll up YTD
#
($sth{MyYTD},$ytd)=@setup;
$YTD=YTD_is($ytd);
@setup=MyEst_by_Cat($database, 1, $CATEGORY-{NBR},
$prev_fy,
$REQUEST{ACCT},
$REQUEST{CUST_ID});
($sth{MyEstimate},$est)=@setup;
$EST=EST_is($est);
$title=($EST-{TITLE} ne '')?$EST-{TITLE}:$YTD-{TITLE};
$cust_id=($EST-{CUST_ID} ne '')?$EST-{CUST_ID}:$YTD-{CUST_ID};
$status='Requested data displayed...';
}
#print start_table;
print table\n;
my %ids =   (   1 ={   label   ='Customer Id',
name='CUST_ID',
defa=$cust_id,
size=10,},
2 ={   label   ='Account',
name='ACCT',
defa=$acct,
size=15,},
3 ={   label   ='Title',
name

Re: How to learn Perl??

2001-06-21 Thread Dennis Waller

Twinkles, etal

I'm another newbie jumping in. 

I went to the referenced URL: 
 http://www.perl.com/pub/language/info/software.html   

I didn't see anything about MSI, I jumped to the Win32 section. That tries
to send you to ActiveStates ActivePerl, which when I tried it wouldn't go
anywhere. I went to ActiveStates and the link there to ActivePerl also came
up as a bad URL. 

Another question: If I use Perl from my Win98 machine to write progs, and
then d/l them to the sever I use for websites, is there a (good) chance the
prog will not work? 


On Thu, 21 Jun 2001 22:31:58 +1000, twinkles wrote:

  Go to the following URL to get a copy of Perl for your computer. Choose
the
  Windows version with the MSI link! MSI stands for Microsoft Installer
  (which you already have if you have WinME). This package comes with ALL
the
  documentation that you need to get started in C:\Perl\html\index.html.
  
  http://www.perl.com/pub/language/info/software.html
  
  You edit the source code using Notepad or any other PLAIN TEXT editor.
Save
  it with a *.pl extension.
  
  If you want to see hundreds of web and other Perl scripts as examples of
  how to program, go to http://www.perlarchive.com and download and learn!
  However, remember that most of these were written for UNIX computers and
  you are using Windows which has FAR less features.
  
  Having said that, your very first task is to learn about the difference
  between the two environments so as to avoid weeks of frustration
wondering
  why your scripts do not work. Specifically, read the
  C:\Perl\html\index.html file section entitled, Windows Specifics.
  
  Don't underestimate the journey you are about to embark upon! It will be
a
  very, very, very steep learning curve if you are new to computers however
  you have the distinct advantage that you are starting with a blank mind.
  
  All the best!
  
  
  At 11:39 AM 20/06/2001 +0200, Henrik Linderbäck wrote:
  Hi
  
  I don´t know anything about Perl but i will try to learn. Where kan i
find 
  information about Perl and answer to my questions??
  
  What is Perl?
  Why using Perl?
  How to start?
  
  
  Do i have to buy a book or can i find everything on internet??
  
  If there is somone how have made something with Perl i am intressted to 
  see. Please give me some links, even small thing.
  
  Thanks all
  
  //Hebbe






___
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/





RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Kurt Edmiston



print $q-endform, \n; # offending code maybe ? == ==
#
#   form for input of estimates, sends confirmation/results of submit
#   to toolbar ...
#


I'm not sure if this is what you want, but couldn't you just replace the 
above line of code with

print /FORM;

That will at least get rid of your hidden tag and close the form.




mail extensions

2001-06-21 Thread Cheryl Kirkpatrick

I have some simple Perl scripts that I use for several forms that have
been working correctly for several months. This week we got a new
firewall and now my forms do not work.
The user submitting the form does not see any error and believes we have
received the information inputted by the form. I receive an error
message, attachment denied by WatchGruard SMTP proxy (type text,
filename (none))

We use a Unix server that is maintained by the state government. It uses
sendmail to forward the form information to me by email. Although this
has always appeared to be a simple email message, apparently the body of
the message is actually an attachment. If I knew what extension the
program uses, I believe I can write a rule for the firewall that will
allow the message to pass through the firewall.

Does anyone know what extension(s) that sendmail uses when it complies
an email message as part of a Perl program?

Thank you!!

--
Cheryl Kirkpatrick
Web Administrator/
Information Technology Librarian
South Carolina State Library
http://www.state.sc.us/scsl/
Telephone: 803.734.5831





RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Curtis Poe

Hi John,

There are a variety of issues with this, so I'll take it from the top, but starting 
with the issue
with you are concerned.  I hope you don't take any of this personally, as it's just 
intended to be
helpful:

print $q-endform;

This does indeed print the hidden field that you are concerned with.  Here's a 
solution:

print /form; 

Frankly, I have no idea why that works, or why the hidden field is printed in the 
first place. 
I've read through much of the CGI.pm code, but this is one that I have never 
encountered.

 use CGI qw(:standard :all *table);

You're importing a bunch of functions into your namespace, but you use the object 
oriented
interface ($q-...).  You can drop the import as it's irrelevant and will slow things 
down.  Just
have use CGI;.  

However, on closer inspection, I realize that you appear to have mixed both the 
function and
object oriented interfaces.  This will merely cause confusion for maintenance 
programmers down the
road.  You should stick with one interface or the other.  From what I see with your 
code, it would
be easier to switch the function calls to object calls:

center() becomes $q-center()
b()  becomes $q-b()
h3() becomes $q-h3()

And so on...

This is an issue because CGI.pm has to do a lot of work to import those functions into 
the calling
namespace.  Since this module already has a lot of overhead, this is simply extra, 
needless work
if you are using the object oriented interface.

 foreach ($q-param) {
 $REQUEST{$_}=$q-param($_);
 }

I assume that you know your form better than I do, but are you aware that the above 
snippet will
only return the first value for a param if that param has several values?  For many 
forms, this
will not make a difference.


 sub BuildForm {
 use strict;

Two things here:

1.  It really helps if you indent the code in a sub.  Indentation gives on an 
excellent view of
how things are arranged and scoped.  Just glancing at your code, I can't tell where 
the sub ends
(or if it even ends in the snipped you sent.  Indenting is a Good Thing.

2.  use strict is not needed here.  This pragma is lexically scoped.  Thus, it will 
be in effect
in the entire scope of where it's declared.  This means that having a 'use strict' at 
the top of a
program will affect the entire file (even across package boundaries) in which it's 
present.

 center(h3('TechDirect Estimates'));

$q-center($q-h3('TechDirect Estimates'));

 print center(font({-size=3},'Fiscal Year'),

print $q-center($q-font({-size=3},'Fiscal Year'),

 #print start_table;
 print table\n;

 [snip]

 foreach (sort keys %ids) {
 print Tr(
 td({-align='RIGHT'},$ids{$_}{label},b(':')),
 td({-align='LEFT'},
 textfield(  -name=$ids{$_}{name},
 -default=$ids{$_}{defa},
 -size   =$ids{$_}{size},
 -maxlength  =$ids{$_}{size})),\n);
 }
 print /TABLE\n;

The above code for printing a table is something that I see a lot in code.  This 
happens because
of the way that that tables need to be built.  Here's a somewhat cleaner, object 
oriented method
of building it, assuming that you've already created the %ids hash:

my $table = '';
foreach (sort keys %ids) {
$table .= $q-Tr(
  $q-td({-align='RIGHT'},$ids{$_}{label},$q-b(':')),
  $q-td({-align='LEFT'},
  $q-textfield( -name  = $ids{$_}{name},
 -default   = $ids{$_}{defa},
 -size  = $ids{$_}{size},
 -maxlength = $ids{$_}{size})),\n);
}
print $q-table( $table );

There are more function orient calls, but I think this should give you a good feel for 
it.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Re: mail extensions

2001-06-21 Thread Curtis Poe

--- Cheryl Kirkpatrick [EMAIL PROTECTED] wrote:
 I have some simple Perl scripts that I use for several forms that have
 been working correctly for several months. This week we got a new
 firewall and now my forms do not work.
 The user submitting the form does not see any error and believes we have
 received the information inputted by the form. I receive an error
 message, attachment denied by WatchGruard SMTP proxy (type text,
 filename (none))

Cheryl,

I don't know enough about sendmail to answer your question, but I do know that many 
firewalls are
configured to disallow all attachments on email due to security concerns.  Despite 
repeated
warnings to people about not opening attachments, they do so anyway and release all 
sorts of
virii, worms, and other problems.

From your error message, it looks like a simple text attachment (text/plain?).  If 
so, I would
guess that it wouldn't be a problem.  My first thought would be to chat with your 
system
administrators or security people and explain the situation.  They might be able to 
loosen up the
rules to allow text attachments through, if the situation warrants.  Of course, they 
may also be
extrememly rigid and disallow all attachments, thus forcing you to find another 
solution.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Re: php - perl

2001-06-21 Thread William McKee

On 15 Jun 2001, at 10:25, Curtis Poe wrote:
  To do it manually, use the following and set $mime_type to whatever value
  you want (see W3C website for complete list):
   print Content-type: $mime_type\n;
 
 With all due respect, your print statement is why I recommend to people
 that they should not do this manually.  There should be two newlines at the
 end of that (actually a \r\n or \012\015, but usually the Web server
 catches the error and corrects for it (something I have a serious beef
 with, but that's just me (oh, and I use too many parentheses))).

I'm glad to see someone paying attention. After I sent that email, I 
realized that the snippet of code I sent was indeed in error. The two 
newlines were appended further down in my script (after a Content-
Disposition header that I was sending in order to begin a download). 
Thanks for correcting it.

William



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread William McKee

On 21 Jun 2001, at 9:50, Curtis Poe wrote:
  foreach ($q-param) {
  $REQUEST{$_}=$q-param($_);
  }
 
 I assume that you know your form better than I do, but are you aware that
 the above snippet will only return the first value for a param if that
 param has several values? For many forms, this will not make a difference.

I am working on a script which has just this problem. My solution was 
to look for the name of the field, get an array and assign the array as 
the value in the hash. Besides knowing which fields may contain 
multiple values, is there a way to determine the number of values 
returned by $q-param(foo)?

Thanks,
William



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Curtis Poe

--- Moon, John [EMAIL PROTECTED] wrote:
 Yes, ... it's gone ... 
 
 Thanks ...
 
 Interestingly, doesn't appear on subsequent calls to endform ... 
 
 so I'm a little concerned I don't understand what CGI (or I) am doing ...
 it would seem like it should always give the same results ...

A quick glance at the CGI docs (which I should have done in the first place!) shows 
that -nosticky
will stop CGI.pm from outputting the hidden .cgifields tags:

use CGI qw/-nosticky/;

CGI.pm uses sticky fields.  If you submit a form and CGI.pm redisplays that form 
using its HTML
shortcuts, it automatically fills in all of the form values for you if your param 
names match the
HTML shortcut attribute names.  Apparently, CGI.pm uses the hidden .cgifields tag to 
let it know
that it's processing a 'sticky' form.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Curtis Poe

--- William McKee [EMAIL PROTECTED] wrote:
 On 21 Jun 2001, at 9:50, Curtis Poe wrote:
   foreach ($q-param) {
   $REQUEST{$_}=$q-param($_);
   }
  
  I assume that you know your form better than I do, but are you aware that
  the above snippet will only return the first value for a param if that
  param has several values? For many forms, this will not make a difference.
 
 I am working on a script which has just this problem. My solution was 
 to look for the name of the field, get an array and assign the array as 
 the value in the hash. Besides knowing which fields may contain 
 multiple values, is there a way to determine the number of values 
 returned by $q-param(foo)?
 
 Thanks,
 William


Um, yes, but it looks ugly.  Generally I only use the following method if I have to 
generate a
form on the fly.  Here's one way of handling something like this:

my $foo_count = scalar @{[param('foo')]};

This will tell you how many values have been returned for foo.  Another way:

my @foo  = param('foo');
my$foo_count = scalar @foo;

What's going on is that param() uses 'wantarray' to determine if it's assigning to a 
scalar or
array.  If it's assigning to a scalar, it only returns the first value (or only value, 
if that's
all there is).  Otherwise, it's going to return a list.  What the first method does it 
the
following:

[ param('foo') ]

The square brackets force param() to be evaluated in a list context.

@{[param('foo')]}

The @{...} forces the listref to be dereferenced into an anonymous array.

scalar @{[param('foo')]};

That scalar function then forces the anonymous array to be evaluated in scalar 
context, thus
returning the number of elements.

If only one form element is returned for 'foo', param will just return a one element 
list and the
above construct returns the value '1'.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Re: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Randal L. Schwartz

 Curtis == Curtis Poe [EMAIL PROTECTED] writes:


Curtis my $foo_count = scalar @{[param('foo')]};

That's nice, but I prefer:

my $foo_count = () = param('foo');

Less typing, less work for the machine.  Less noise.  More magic,
though.  Oops, arguable on that. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] 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!



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Tillema, Glenn

  Curtis == Curtis Poe [EMAIL PROTECTED] writes:
 
 Curtis my $foo_count = scalar @{[param('foo')]};
 
 That's nice, but I prefer:
 
 my $foo_count = () = param('foo');
 
 Less typing, less work for the machine.  Less noise.  More magic,
 though.  Oops, arguable on that. :)
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

Let me guess ... param('foo') is assigned to a list ... the list is assigned
to $foo_count in a scalar context so the number of elements are returned.

Right?


Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc. 
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Tillema, Glenn

  my $foo_count = () = param('foo');
 
 Tillema, Let me guess ... param('foo') is assigned to a list 
 Tillema,... the list is assigned
 Tillema, to $foo_count in a scalar context so the number of 
 Tillema, elements are returned.
 
 Tillema, Right?
 
 Probably simpler than that.  param is invoked in a list context,
 so it does its listy-thing, and returns a list of N elements.  This
 list attempts to be assigned to the () list, which tosses everything
 after the 0th element (that is, EVERYTHING) as unneeded.  However,
 since that list assignment op was in a scalar context, it returns
 the number of original elements (not the number of kept elements),
 and that's back to N again.  And that N goes into $foo_count.
 
 There's never a list assigned to $foo_count in a scalar context...
 the phrase doesn't even make sense to me. :) You can't assign a list
 to $foo_count.  It can never happen.  Never.  A list cannot exist in a
 scalar context... the guts of Perl mandates that.
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

That's how it was phrased in the camel; List assignment in scalar context
returns the number of elements produced by the expression on the _right_ side
of the assignment...  Your explanation certainly goes into much more detail,
however. Thanks!


Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.   
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Moon, John

Curtis,

Thank you for the suggestion ... This is for beginners and I have a lot to
learn !

... I'll use the OO format - just got lazy ... 

never used strict before because it was s strict but some guy named
Curtis (and others) kept saying to use it so  Thanks for letting me know
about the scoping...

Yes, I knew about what param returned but haven't needed to have a
multi-value token (array) returned ... so far ... and appreciate the further
discussion ... 

Thanks for the tip on $table .= ... again I needed to get out of my box
... and that why I like this forum ... I work alone (remote) and this has
been a BIG help to me ... Hope I can help others down the road ... 


In my doc (from perldoc) I don't see the pragma listed... which brings me to
the question how do I know which version of CGI I have ... I don't install
software at this shop ... and don't have root privileges ... in fact much
to my dismay they have multiple versions of Perl installed ... so when I
run perldoc which doc's am I getting ?

Althought it says loosely found as .../5.00502  ... after a lot of other
stuff ...

What is the current stable version of CGI ... ?

$ENV{MANPATH} = /usr/share/man:/usr/local/man  

 -V reports:

SUN2perl5.00502 -V|more # which is my shebang 

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  ...
where  reports:
SUN2perl -V|more
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  ...



Re: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Randal L. Schwartz

 Tillema, == Tillema, Glenn [EMAIL PROTECTED] writes:

 There's never a list assigned to $foo_count in a scalar context...
 the phrase doesn't even make sense to me. :) You can't assign a list
 to $foo_count.  It can never happen.  Never.  A list cannot exist in a
 scalar context... the guts of Perl mandates that.

Tillema, That's how it was phrased in the camel; List assignment in scalar context
Tillema, returns the number of elements produced by the expression on the _right_ side
Tillema, of the assignment...  Your explanation certainly goes into much more detail,
Tillema, however. Thanks!

Ahh, there's HUGE difference between

list assignment _in_ scalar context

and

list assigned _to_ [a scalar]

Let's draw that out.  First is:

$foo_length = () = SOME_LIST
  == list assignment in
= __ scalar context

Second might mean something like:

$foo_length = SOME_LIST # although this can't happen
  = list
=   assigned to
=== scalar

See the difference?  And the latter can't happen.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] 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!



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Tillema, Glenn

 Tillema, That's how it was phrased in the camel; List 
 Tillema, assignment in scalar context
 Tillema, returns the number of elements produced by the 
 Tillema, expression on the _right_ side
 Tillema, of the assignment...  Your explanation certainly 
 Tillema, goes into much more detail,
 Tillema, however. Thanks!
 
 Ahh, there's HUGE difference between
 
 list assignment _in_ scalar context
 
 and
 
 list assigned _to_ [a scalar]
 
 Let's draw that out.  First is:
 
 $foo_length = () = SOME_LIST
   == list assignment in
 = __ scalar context
 
 Second might mean something like:
 
 $foo_length = SOME_LIST # although this can't happen
   = list
 =   assigned to
 === scalar
 
 See the difference?  And the latter can't happen.
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

I know I've certainly tried it ... :) I see the difference, thanks!


Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.  
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



Re: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Mel Matsuoka

At 04:21 PM 06/21/2001 -0400, Timothy Kimball wrote:

Randal L. Schwartz wrote:
: ...
: Second might mean something like:
: 
: $foo_length = SOME_LIST # although this can't happen
:   = list
: =   assigned to
: === scalar
: 
: See the difference?  And the latter can't happen.

Sure it can. Well, the list itself doesn't get assigned to the scalar,
but an assignment does get made: The last element of SOME_LIST to
$foo_length. So

my $number_of_pets = ('dog','cat','iguana');

sets $number_of_pets to 'iguana'.


Methinks you actually /validated/ Randal's post, not contradicted it ;)

Randal said:
Ahh, there's HUGE difference between

list assignment _in_ scalar context

and

list assigned _to_ [a scalar]

So your example would fit in the list assignment _in_ scalar context
category...the keyword being assignMENT, and not assignED

aloha,
mel



mel matsuoka  Hawaiian Image Productions
Chief Executive Alphageek(vox)1.808.531.5474
[EMAIL PROTECTED](fax)1.808.526.4040
 



Re: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Curtis Poe


--- Timothy Kimball [EMAIL PROTECTED] wrote:
 
 Randal L. Schwartz wrote:
 : ...
 : Second might mean something like:
 : 
 : $foo_length = SOME_LIST # although this can't happen
 :   = list
 : =   assigned to
 : === scalar
 : 
 : See the difference?  And the latter can't happen.
 
 Sure it can. Well, the list itself doesn't get assigned to the scalar,
 but an assignment does get made: The last element of SOME_LIST to
 $foo_length. So
 
 my $number_of_pets = ('dog','cat','iguana');
 
 sets $number_of_pets to 'iguana'.
 
 -- tdk

Actually, you're dealing with a well-documented, but poorly understood feature.  Try 
this:

my $number_of_pets = ('dog','cat','iguana');
print $number_of_pets;

my @pets = ('dog','cat','iguana');
$number_of_pets = @pets;
print $number_of_pets;

$number_of_pets = ('dog','cat',@pets);
print $number_of_pets;

@number_of_pets = ('dog','cat',@pets);
print scalar @number_of_pets;

The first print results in 'iguana' and the second and third print statements print 3. 
 The fourth
print display a 5.

What's going on here is subtle.  Putting parens around those scalars creates a list 
literal. 
When a list literal is accessed in scalar context, it evaluates each item in scalar 
context and
returns the value of the final element.  Since, in the third example, the array is the 
third
element, it's evaluated in scalar context, as expected.

So why do the third and fourth examples have different outputs?  Because lists are not 
arrays and
do not behave as such.

Cheers,
Curtis Poe

=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Re: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Timothy Kimball


Mel Matsuoka wrote:
: Randal L. Schwartz wrote:
: : ...
: : Second might mean something like:
: : 
: : $foo_length = SOME_LIST # although this can't happen
: :   = list
: : =   assigned to
: : === scalar
: : 
: : See the difference?  And the latter can't happen.
: 
: Sure it can. Well, the list itself doesn't get assigned to the scalar,
: but an assignment does get made: The last element of SOME_LIST to
: $foo_length. So
: 
: my $number_of_pets = ('dog','cat','iguana');
: 
: sets $number_of_pets to 'iguana'.
: 
: 
: Methinks you actually /validated/ Randal's post, not contradicted it ;)

Actually, I was reacting in a blind fury to the words can't happen.
I hate to see that in a post about Perl. ;)

-- tdk



RE: Please remove

2001-06-21 Thread Ask Bjoern Hansen

On Wed, 20 Jun 2001 [EMAIL PROTECTED] wrote:

 I also have tried removal but I get this great little insulting remark that
 could only have been produced by a 'secret loyal order of Unix programmers'
 bit bombardier!

 Hi. This is the qmail-send program at onion.perl.org.
 I'm afraid I wasn't able to deliver your message to the following addresses.
 This is a permanent error; I've given up. Sorry it didn't work out.

 [EMAIL PROTECTED]:
 Sorry, no mailbox here by that name. (#5.1.1)

 I'm trying to work it out like a mathematician with a pencil.

In the future don't CC both lists, please. I'll have to make a
filter that rejects such mails. :-I

Anyway, your Outlook program munged the confirmation adderss from
the full long one to just [EMAIL PROTECTED] which the mail
system obviously don't know what to do with. That's why you got the
message above.


 - ask

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();
more than 100M impressions per day, http://valueclick.com




Re: Please remove

2001-06-21 Thread Dave Young

D.J.B. is quite the character..  ;)


 I also have tried removal but I get this great little insulting remark that
 could only have been produced by a 'secret loyal order of Unix programmers'
 bit bombardier!

 Hi. This is the qmail-send program at onion.perl.org.
 I'm afraid I wasn't able to deliver your message to the following
 addresses. This is a permanent error; I've given up. Sorry it didn't work
 out.





Pooling of objects and session data

2001-06-21 Thread Rajeev Rumale

Hi,

I need to know if there is any easiest way to keep session data or object
accross the scripts.

Basically I would like to pool Database connections so that Parrallel
running scripts don't open multiple connection with the database.

with regards

Rajeev Rumale
- Original Message -
From: Dave Young [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, June 21, 2001 8:04 AM
Subject: Re: Please remove


 D.J.B. is quite the character..  ;)


  I also have tried removal but I get this great little insulting remark
that
  could only have been produced by a 'secret loyal order of Unix
programmers'
  bit bombardier!
 
  Hi. This is the qmail-send program at onion.perl.org.
  I'm afraid I wasn't able to deliver your message to the following
  addresses. This is a permanent error; I've given up. Sorry it didn't
work
  out.