[24358] in Perl-Users-Digest
Perl-Users Digest, Issue: 6547 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 10 09:05:39 2004
Date: Mon, 10 May 2004 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 10 May 2004 Volume: 10 Number: 6547
Today's topics:
Conditional Statement failure --- if ($a>0) <ewijaya@singnet.com.sg>
Newbie LWP question - simulate browser? (philthym)
Re: Newbie LWP question - simulate browser? <spamtrap@dot-app.org>
Re: Newbie LWP question - simulate browser? <Joe.Smith@inwap.com>
Re: Perl DBI and DB2 Stored Procedure <stolze@de.ibm.com>
Re: Printing Array's content with carriage return (\n) <tadmc@augustmail.com>
Re: rapid development web interface to a database <nospam@bigpond.com>
Re: rapid development web interface to a database <Joe.Smith@inwap.com>
Re: rapid development web interface to a database <bigiain@mightymedia.com.au>
Re: rapid development web interface to a database <tony@NOSPAM.demon.co.uk>
upload file with perl cgi (Sokar)
Re: upload file with perl cgi <tore@aursand.no>
Re: upload file with perl cgi <nobull@mail.com>
Re: upload file with perl cgi <1usa@llenroc.ude>
Very urgent: plz someone answer (Neo)
Re: Very urgent: plz someone answer (Sam Holden)
Re: Very urgent: plz someone answer <tadmc@augustmail.com>
WWW::Search::Ebay <marcus.reiter@gmx.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 10 May 2004 21:01:37 -0000
From: Edward Wijaya <ewijaya@singnet.com.sg>
Subject: Conditional Statement failure --- if ($a>0)
Message-Id: <opr7sx0zokuj0cst@news.singnet.com.sg>
Hi all,
This are my code snippet.
The countArray subroutines are suppose to count
the number of elements withiin an array.
However the compilation gives the following error:
Use of uninitialized value in concatenation (.) or string at pvalue_v12.pl
line 325.
Use of uninitialized value in numeric gt (>) at pvalue_v12.pl line 327.
Is there anything wrong with my conditional statement i.e, if ($a>0)
or is it because of my subroutines?
Thanks so much for your time.
Regards
Edward WIJAYA
SINGAPORE
#----My code snippet-----
$a = countArray(@b);
print "$a\n"; #----- line 325
if ($a> 0) { #-----line 327
bla bla bla;
}
else { die "bla bla bla"}
#----Subroutines----
sub countArray {
my @params = @_;
my $Key;
my $count;
foreach $Key (@params) {$count++}
return $count;
}
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
------------------------------
Date: 9 May 2004 19:23:38 -0700
From: philthym@yahoo.com (philthym)
Subject: Newbie LWP question - simulate browser?
Message-Id: <3c7692f6.0405091823.240dec09@posting.google.com>
Hi
As the title suggests, I am a Perl newbie. I am trying to monitor a
remote site and would like to time it in returning all objects on the
page, ie the HTML and all the associated GIFs, bits of JavaScript,
Java applets and so on.
Here is the code as it stands today:
#!/usr/bin/perl
use CGI;
use LWP::Simple;
use Time::HiRes qw(gettimeofday);
$URL="http://www.xyz.com/index.html";
$usec1 = gettimeofday;
$timenow = localtime();
$HomePage=get($URL);
if
($HomePage =~ /String/)
{ $usec2 = gettimeofday;
$elapsed = $usec2-$usec1;
print "$timenow Page retrieved in $elapsed seconds\n" }
else
{ print "$timenow Page not retrieved\n"; }
I'm not sure I understand the whole lwp/get thing! What I'm wondering
is does this request effectively initiate the web server to return all
objects or just the HTML itself? If it's returning everything, then
does the second timer occur after all objects have been returned? In
other words, does this code do what I want it to? If not, any ideas
how I would achieve my aim, please?
Any help would be gratefully appreciated.
Thanks
Phil
------------------------------
Date: Sun, 09 May 2004 23:32:48 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Newbie LWP question - simulate browser?
Message-Id: <leqdnZLo8-B9agPdRVn-tw@adelphia.com>
philthym wrote:
> I'm not sure I understand the whole lwp/get thing! What I'm wondering
> is does this request effectively initiate the web server to return all
> objects or just the HTML itself?
It does *exactly* what you ask it to, no more - it fetches index.html.
Parsing the HTML, extracting the <img ...> elements from it, and making
additional requests to the server to fetch the images they point to, will
require additional code.
Have a look at HTML::Parser - it's a good place to start.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Mon, 10 May 2004 09:02:26 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Newbie LWP question - simulate browser?
Message-Id: <yyHnc.3519$UQ.238188@attbi_s51>
philthym wrote:
> As the title suggests, I am a Perl newbie. I am trying to monitor a
> remote site and would like to time it in returning all objects on the
> page, ie the HTML and all the associated GIFs, bits of JavaScript,
> Java applets and so on.
It's one thing to fetch a Javascript. It is quite another to fetch
the things that would be requested had the Javascript been executed.
For that, you need a proxy that logs the requests from a real browser.
There are several, including the "Web Scrapting Proxy"
http://www.research.att.com/~hpk/wsp/
-Joe
------------------------------
Date: Mon, 10 May 2004 08:09:47 +0200
From: Knut Stolze <stolze@de.ibm.com>
Subject: Re: Perl DBI and DB2 Stored Procedure
Message-Id: <c7n6bb$ha9$2@fsuj29.rz.uni-jena.de>
Wonderinguy wrote:
> Hi everybody , I have been trying to execute a simple DB2 stored
> Procedure from perl. But it doesn't work. Could anybody please help me
> find out why this is happening :
>
> here is my perl script that execute the SP :
> <snip>
> my $dbh = DBI->connect( "dbi:DB2:$database","user1","passwd1") || die
> "cannot connect to db2";
> my $callstmt = "CALL SPACESP('DB','TEXAS')";
> my $sth = $dbh->prepare($callstmt) || die "can't do
> prepare",$dbh->errstr(),"\n";
> $sth->execute || die "Can't do executed:" , $dbh->errstr(),"\n";
>
> <snip>
>
> When I execute this I get this on the apache error.log :
>
> Premature end of script headers: get_dbspace.cgi, referer:
> http://localhost/space.html
> [Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] Use of
> uninitialized value in warn at C:/Program Files/Apache
> Group/Apache2/cgi-bin/space/get_dbspace.cgi line 8., referer:
> http://localhost/space.html
> [Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] Warning:
> something's wrong at C:/Program Files/Apache
> Group/Apache2/cgi-bin/space/get_dbspace.cgi line 8., referer:
> http://localhost/space.html
> [Fri May 07 15:14:56 2004] [error] [client 127.0.0.1] DBD::DB2::st
> execute failed: [IBM][CLI Driver][DB2] SQL0440N No function by the
> name "SPACESP" having compatible arguments was found in the function
> path. SQLSTATE=42884
You should also verify that the schema name is the same when you execute on
the command line and inside the script. Better yet: always use the fully
qualified name of the procedure, i.e:
CALL user1.spacesp(...)
--
Knut Stolze
Information Integration
IBM Germany / University of Jena
------------------------------
Date: Mon, 10 May 2004 07:30:24 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Printing Array's content with carriage return (\n)
Message-Id: <slrnc9utf0.lc.tadmc@magna.augustmail.com>
l v <lv@aol.com> wrote:
> I usually use with preference on #2:
>
> print map {"$_\n"} @myarray;
>
> or
>
> map {print "$_\n"} @myarray;
_Why_ do you prefer #2?
I think most people would prefer #1 because it says "print bunch 'o stuff"
while #2 says "bunch 'o stuff print".
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 10 May 2004 18:14:29 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: rapid development web interface to a database
Message-Id: <1206526.SbimVY2hZK@GMT-hosting-and-pickle-farming>
carloschoenberg@yahoo.com wrote:
> I am looking for the easiest web interface to a database. By easiest,
> I mean most rapid development. Because the requirements are so simple
> and standard, I'm hoping that something can take care of the grunt
> work. Easy maintenance, possibly by non-programmers (or at least
> "junior" programmers) would also be nice.
>
> I'm open to Perl, PHP, Java in that order (best solution wins, equal
> solutions go with the preferred language). I'm also open to anything
> that doesn't require code to be written to get the job done, as long
> as there's some way to extend it if I get stuck.
>
> The design is simple and is an age-old story:
> I have a database with about 15 tables. 5 contain data with the same
> primary key, 2 have their own primary key but still a 1-to-1 mapping
> to the "main" primary key, and 8 are master lists that the other
> tables reference (site id, customer id, that sort of thing). I need
> the following screens:
> simple search based on a couple fields
> advanced search based on most available fields
> search results simple display, showing a reasonable set of fields
> search results advanced display, showing large or configurable set of
> fields
> simple display, showing most commonly desired fields
> advanced display, showing all data
> add new record simple, requesting most commonly entered fields
> add new record advanced, allowing all fields to be manipulated
> edit existing record simple
> edit existing record advanced
> editing for each of the 'master' tables
Oracle have tools to do all that but it costs a fortune.
gtoomey
------------------------------
Date: Mon, 10 May 2004 09:13:01 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: rapid development web interface to a database
Message-Id: <xIHnc.62313$Ik.4766779@attbi_s53>
carloschoenberg@yahoo.com wrote:
> I am looking for the easiest web interface to a database. By easiest,
> I mean most rapid development. Because the requirements are so simple
> and standard, I'm hoping that something can take care of the grunt
> work. Easy maintenance, possibly by non-programmers (or at least
> "junior" programmers) would also be nice.
Sounds like a job for the SiteWand building blocks that Instantis uses.
http://www.instantis.com/technology/technology_home.html
They have 30-day free evaluation accounts.
-Joe
------------------------------
Date: Mon, 10 May 2004 19:56:33 +1000
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: rapid development web interface to a database
Message-Id: <bigiain-AD10DD.19563310052004@news.fu-berlin.de>
In article <8c526b62.0405091341.784cdea5@posting.google.com>,
carloschoenberg@yahoo.com wrote:
> I am looking for the easiest web interface to a database. By easiest,
> I mean most rapid development. Because the requirements are so simple
> and standard, I'm hoping that something can take care of the grunt
> work.
Have you looked at Maypole yet?
http://maypole.simon-cozens.org/
(caveat, I haven't actually used it yet, but I've read enough about it
to be pretty excited, now I just need to make some time to play with
it...)
big
--
'You know all those spasticated-looking hip-hop gestures involving
extended fingers and wrists cocked at odd angles which are intended to
have a meaning to the effect of "Kinoath!" or "You have spoken wisely,
my friend."? I'm making one in your direction now...' Marko in aus.moto
------------------------------
Date: Mon, 10 May 2004 12:55:23 +0100
From: "Tony Marston" <tony@NOSPAM.demon.co.uk>
Subject: Re: rapid development web interface to a database
Message-Id: <c7nqjd$4li$1$8302bc10@news.demon.co.uk>
Take a look at http://www.tonymarston.net/php-mysql/sample-application.html
for rapid application development for the web using PHP.
--
Tony Marston
http://www.tonymarston.net
<carloschoenberg@yahoo.com> wrote in message
news:8c526b62.0405091341.784cdea5@posting.google.com...
> I am looking for the easiest web interface to a database. By easiest,
> I mean most rapid development. Because the requirements are so simple
> and standard, I'm hoping that something can take care of the grunt
> work. Easy maintenance, possibly by non-programmers (or at least
> "junior" programmers) would also be nice.
>
> I'm open to Perl, PHP, Java in that order (best solution wins, equal
> solutions go with the preferred language). I'm also open to anything
> that doesn't require code to be written to get the job done, as long
> as there's some way to extend it if I get stuck.
>
> The design is simple and is an age-old story:
> I have a database with about 15 tables. 5 contain data with the same
> primary key, 2 have their own primary key but still a 1-to-1 mapping
> to the "main" primary key, and 8 are master lists that the other
> tables reference (site id, customer id, that sort of thing). I need
> the following screens:
> simple search based on a couple fields
> advanced search based on most available fields
> search results simple display, showing a reasonable set of fields
> search results advanced display, showing large or configurable set of
> fields
> simple display, showing most commonly desired fields
> advanced display, showing all data
> add new record simple, requesting most commonly entered fields
> add new record advanced, allowing all fields to be manipulated
> edit existing record simple
> edit existing record advanced
> editing for each of the 'master' tables
>
> All edit/add screens need pulldowns for master lists allowing one to
> be selected, search screens need pulldowns allowing multiple to be
> selected. The user should not be burdened by the underlying layout of
> thed tabase.
>
> I want something to do most of the grunt work of:
> all the CGI stuff, of course
> authentication and maintaining the session
> building the forms. ugly is ok as long as it's usable. optional
> templating would be nice.
> working with the database
>
> After everything is done modifying the interface to accomidate a new
> table or new column in an existing table should be trivial.
>
> I appreciate any advice about the most efficient way to develop such
> systems.
------------------------------
Date: 10 May 2004 04:04:37 -0700
From: jmccloughlin@hotmail.com (Sokar)
Subject: upload file with perl cgi
Message-Id: <34628238.0405100304.46fa9a97@posting.google.com>
I am designing a new feature to a services web page for the user to upload
screen dumps of problems onto my server for inspection and maybe further
use.
I have investigated the <input TYPE='file' NAME='pic' size='15'> for use in
the html part.
The problem comes when I get to the perl cgi part of the code, I am havin
problems saving the .jpg onto my server.
Can anyone provide a little help on how to upload files onto the server via
a web interface?
Thanks
John
------------------------------
Date: Mon, 10 May 2004 13:44:03 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: upload file with perl cgi
Message-Id: <pan.2004.05.10.11.44.02.979149@aursand.no>
On Mon, 10 May 2004 04:04:37 -0700, Sokar wrote:
> Can anyone provide a little help on how to upload files onto the server
> via a web interface?
perldoc CGI
--
Tore Aursand <tore@aursand.no>
"When you love someone, all your saved-up wishes start coming out."
(Elizabeth Bowen)
------------------------------
Date: 10 May 2004 12:38:39 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: upload file with perl cgi
Message-Id: <u9hduoldfk.fsf@wcl-l.bham.ac.uk>
jmccloughlin@hotmail.com (Sokar) writes:
> I am designing a new feature to a services web page for the user to upload
> screen dumps of problems onto my server for inspection and maybe further
> use.
>
> I have investigated the <input TYPE='file' NAME='pic' size='15'> for use in
> the html part.
What was the outcome of the investigation?
> The problem comes when I get to the perl cgi part of the code, I am havin
> problems saving the .jpg onto my server.
What sort of problems? (Random shot-in-the-dark: did you forget binmode()?).
> Can anyone provide a little help on how to upload files onto the server via
> a web interface?
perldoc CGI
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 10 May 2004 11:56:37 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: upload file with perl cgi
Message-Id: <Xns94E550CF632E5asu1cornelledu@132.236.56.8>
jmccloughlin@hotmail.com (Sokar) wrote in
news:34628238.0405100304.46fa9a97@posting.google.com:
> I am designing a new feature to a services web page for the user to
> upload screen dumps of problems onto my server for inspection and
> maybe further use.
>
> I have investigated the <input TYPE='file' NAME='pic' size='15'> for
> use in the html part.
>
> The problem comes when I get to the perl cgi part of the code, I am
> havin problems saving the .jpg onto my server.
>
> Can anyone provide a little help on how to upload files onto the
> server via a web interface?
<http://tinyurl.com/3byux> (http://search.cpan.org/~lds/CGI.pm-
3.05/CGI.pm#CREATING_A_FILE_UPLOAD_FIELD)
<http://www.catb.org/~esr/faqs/smart-questions.html>
--
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)
------------------------------
Date: 9 May 2004 21:52:18 -0700
From: me4uwithluv@yahoo.com (Neo)
Subject: Very urgent: plz someone answer
Message-Id: <639fa221.0405092052.4b4c36a7@posting.google.com>
I have a question:
I am asked in an interview:
How is an array interpolated in Perl.
Though i know perl, I am not an expert and i dont know the answer. Plz
answer the question as soon as possible.
Thanks.
Neo
------------------------------
Date: 10 May 2004 05:59:23 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Very urgent: plz someone answer
Message-Id: <slrnc9u6hr.rvn.sholden@flexal.cs.usyd.edu.au>
On 9 May 2004 21:52:18 -0700, Neo <me4uwithluv@yahoo.com> wrote:
> I have a question:
>
> I am asked in an interview:
>
> How is an array interpolated in Perl.
>
>
> Though i know perl, I am not an expert and i dont know the answer. Plz
> answer the question as soon as possible.
RTFM.
Possibly the section that says:
Interpolating an array or slice [snip], so is equivalent to interpolating
[snip perl code]
--
Sam Holden
------------------------------
Date: Mon, 10 May 2004 07:41:47 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Very urgent: plz someone answer
Message-Id: <slrnc9uu4b.lc.tadmc@magna.augustmail.com>
Neo <me4uwithluv@yahoo.com> wrote:
> Subject: Very urgent: plz someone answer
[ tip: Putting "urgent" in your Subject ensures _less_ people will read it.
Pleading in your Subject ensures _less_ people will read it.
Please do not use "cutsie" spelling, it is inconsiderate of
those whose first language is not English.
Have you seen the Posting Guidelines that are posted here frequently?
]
> I have a question:
>
> I am asked in an interview:
>
> How is an array interpolated in Perl.
>
>
> Though i know perl, I am not an expert and i dont know the answer.
Then you look it up in the documentation (or at least try to)
before you ask thousands of people around the world to read
them to you.
Since your question seems to be about arrays, you might try
perldoc perldata
Arrays and slices are interpolated into double-quoted strings by ...
Since your question seems to be about quoting, you might try
the "Quote and Quote-like Operators" section in:
perldoc perlop
Interpolating an array or slice interpolates the elements in order,
separated by the value of...
> Plz
> answer the question as soon as possible.
You could have found the answer in the docs in less time than
it took you to type up your article.
Work smart!
Use the docs Luke.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 10 May 2004 12:57:03 +0200
From: "Marcus Reiter" <marcus.reiter@gmx.de>
Subject: WWW::Search::Ebay
Message-Id: <c7nn5s$11i$04$1@news.t-online.com>
Hi,
is the modul WWW::Search:Ebay working under ActiveState Perl on Win XP?
I become no Results with it!
Greetings from Germany
Marcus
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6547
***************************************