[17582] in Perl-Users-Digest
Perl-Users Digest, Issue: 5002 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 30 21:05:55 2000
Date: Thu, 30 Nov 2000 18:05:14 -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: <975636313-v9-i5002@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 30 Nov 2000 Volume: 9 Number: 5002
Today's topics:
Re: A silly. Substitution - s/// (Craig Berry)
Re: activate <no-one@home.com>
Alias STDIN to a variable bdesany@my-deja.com
Re: Alias STDIN to a variable bdesany@my-deja.com
Re: Alias STDIN to a variable <johngros@Spam.bigpond.net.au>
Can't get upload working properly igwt@mdl.net
create random number <me@privacy.net>
Re: create random number <me@privacy.net>
Re: Creating Arrays of Hashes Perlishly (Craig Berry)
Re: Data missing, rogue proccess. (Richard J. Rauenzahn)
Re: Debug a forked/exec Perl script started from anothe (Ilya Zakharevich)
Re: Do I need Java to redirect form parameters? (Craig Berry)
Re: Exporter (Tad McClellan)
Extracting the first name <todd@mrnoitall.com>
Re: Extracting the first name (Tad McClellan)
FAQ 4.28: How do I capitalize all the words on one li <faq@denver.pm.org>
gmtime help jmwjr@my-deja.com
Re: Hashes and printing values with CGI.pm (brian d foy)
Re: Hashes and printing values with CGI.pm xlr6drone@my-deja.com
Re: Hashes and printing values with CGI.pm (Tad McClellan)
Re: HELP BEFORE ME HEAD EXPLODES fallenang3l@my-deja.com
Re: HELP BEFORE ME HEAD EXPLODES <elijah@workspot.net>
Re: Help with Net::NNTP please? jjlupa@my-deja.com
Re: How do I null terminate a string ? (Honza Pazdziora)
Re: mod_perl DBI connection issue (Addendum) <pobbard@hotresponse.com>
mod_perl DBI connection issue <pobbard@hotresponse.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Nov 2000 23:26:13 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: A silly. Substitution - s///
Message-Id: <t2dogls7s086ae@corp.supernews.com>
Bart Lateur (bart.lateur@skynet.be) wrote:
: ishulz@lycosmail.com wrote:
:
: >How is it possible to reduce number of subsequent symbols? For example
: >how to replace each 5 identical symbols with only 2 of them, like this:
: >
: >Input: This is oone exxxxxample 111111111
: >
: >Output: This is oone exxample 111
:
: s/(.)\1\1\1\1/$1$1/g;
Or to make it easier to customize without hand-counting (and typing)
repetitions:
s/(.)\1{4}/$1 x 2/eg;
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Here's to the struggles of the silent war,
| here's to the closing of the age." -The Call
------------------------------
Date: Thu, 30 Nov 2000 23:35:42 GMT
From: "fudge-sicle" <no-one@home.com>
Subject: Re: activate
Message-Id: <ivBV5.733234$8u4.12052887@news1.rdc1.bc.home.com>
What if you are writing cgi files on a windows98 machine, then ftping them
to a unix server? If I copy a file that works, and rename it to the original
and overwrite the orignal with it on the server it doesn't run anymore. I
want to back up existing files to test but I can only seem to get the
originals to run. I think I need somw way to make them executable on the
Unix server.
PS, I am a poor little VB programmer thrown into a very alien world. Please
be gentle, I have looked all over the FAQs I could find but nada!
"Ed Grosvenor" <secursrver@hotmail.com> wrote in message
news:htpV5.18005$II2.1782208@newsread2.prod.itd.earthlink.net...
> Your question isn't exactly clear. What do you mean by two new pieces of
> Perl? Do you mean modules? Scripts that you have written? If Perl is
> installed on that drive, then all you should have to do is specify the
path
> to Perl on the first line of your scripts (something like
> !#usr/local/bin/perl). Then set the permissions on your script to 755
> (that's chmod). If you're running on a Windows box, then don't worry
about
> the permissions. If your problem is something more complicated, like Perl
> isn't installed on your server or you need to add modules, then we'll need
> more information to help you.
>
> Good luck!
> <neurofase@my-deja.com> wrote in message
news:904i3j$5r6$1@nnrp1.deja.com...
> > I am a complete newbie to perl. I first used it about a year ago. I
> > have never written a perl form until now, but i have modified several.
> >
> > The set up that I have is that the webserver is just another drive on
> > the netwrork. Whenever I created these 2 new pieces of perl I just
> > transfered them onto the drive, but the dont work.
> >
> > I think i remember something about having to execute perl before it
> > will work and you can do this by a FTP or Telnet program. The firewall
> > here does not allow me to FTP or Telnet.
> >
> > Do I have to execute or activate the perl sections to get them to work
> > and if so how would i do this considering they are only on another
> > drive and not transfered through FTP or Telnet????
> >
> > Thanks
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
>
------------------------------
Date: Thu, 30 Nov 2000 23:20:00 GMT
From: bdesany@my-deja.com
Subject: Alias STDIN to a variable
Message-Id: <906nap$uea$1@nnrp1.deja.com>
I have a subroutine in a package that I want to be able provide data to
in a number of ways, but I don't want to have custom routines for each
way. So I have it set up to read from <STDIN>, but if a filename is
provided to the subroutine (by the calling script) then I open a
filehandle (INPUT) and say *STDIN = *INPUT and all the parts of the
script that say things like "while <STDIN>" still work, but pull data
from the file instead of STDIN.
What I would like to do is get this effect from string data in a
variable as well. This is because I have a cgi that wants to pass the
data using a variable rather than a file. How can I make STDIN read
from a scalar variable containing a string value?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Dec 2000 00:12:23 GMT
From: bdesany@my-deja.com
Subject: Re: Alias STDIN to a variable
Message-Id: <906qd2$12r$1@nnrp1.deja.com>
In article <906nap$uea$1@nnrp1.deja.com>,
bdesany@my-deja.com wrote:
> I have a subroutine in a package that I want to be able provide data
to
> in a number of ways, but I don't want to have custom routines for each
> way. So I have it set up to read from <STDIN>, but if a filename is
> provided to the subroutine (by the calling script) then I open a
> filehandle (INPUT) and say *STDIN = *INPUT and all the parts of the
> script that say things like "while <STDIN>" still work, but pull data
> from the file instead of STDIN.
>
> What I would like to do is get this effect from string data in a
> variable as well. This is because I have a cgi that wants to pass the
> data using a variable rather than a file. How can I make STDIN read
> from a scalar variable containing a string value?
Hey I figured it out! Woo hoo! Well, actually I got the solution from
Programming Perl. But it was me who actively decided it would be a good
idea to look in that chapter... ;)
package StdinTie;
use strict;
sub TIEHANDLE {
my $class = shift;
my $self = shift;
bless $self, $class;
}
sub READLINE {
my $self = shift;
shift @$self;
}
1;
--------
tie *STDIN, "StdinTie", $arrayref;
$arrayref is the data that was previously provided from either a file
or STDIN. So now I can read data from all the sources I need to.
Coooooool.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Dec 2000 01:48:44 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Alias STDIN to a variable
Message-Id: <0sDV5.28$xW4.109@news-server.bigpond.net.au>
open(PIPE, "| STDIN") || die "cannot fork: $!";
print PIPE $a_scalar_variable_containing_a_string_value";
close(PIPE);
It may need <> around STDIN I have not used this myself.
<bdesany@my-deja.com> wrote in message news:906nap$uea$1@nnrp1.deja.com...
> I have a subroutine in a package that I want to be able provide data to
> in a number of ways, but I don't want to have custom routines for each
> way. So I have it set up to read from <STDIN>, but if a filename is
> provided to the subroutine (by the calling script) then I open a
> filehandle (INPUT) and say *STDIN = *INPUT and all the parts of the
> script that say things like "while <STDIN>" still work, but pull data
> from the file instead of STDIN.
>
> What I would like to do is get this effect from string data in a
> variable as well. This is because I have a cgi that wants to pass the
> data using a variable rather than a file. How can I make STDIN read
> from a scalar variable containing a string value?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 30 Nov 2000 23:15:12 GMT
From: igwt@mdl.net
Subject: Can't get upload working properly
Message-Id: <906n1r$uau$1@nnrp1.deja.com>
Hello Perl aces,
I'am desperately asking your help.
I included file upload option into my script and it doesn't work while
uploading file from WIN box to Unix server ( from Linux Box it works
OK).
---------------------------------
That's the error i receive :
query.cgi: Can't use string ("netcolors.gif") as a symbol ref
while "strict refs" in use at query.cgi line 406.
Script Location : query.cgi
Perl Version : 5.00503
---------------------------------------
I use sctrict in my script and CGI.pm file upload idiom.
Swithing off strict directive makes it work and create empty file on
server but it's empty. Again, it works when I call script from Linux
box.
Here is the code :
-------------------------
1my ($fileName,$buffer,$bytesread)=undef;
2 if ($q->param('attached'))
3 {
4 $fileName = $q->param('attached');
5
6 $fileName =~ s!^.*(\\|\/)!!;
7 $fileName =~ s/[^\w\.\-]+//g;
8 open (OUTFILE,">$vars{attachments_path}$fileName") or die"Can't 9
9 open file $vars{'attachments_path'}$fileName: $!";
10 while ($bytesread=read($fileName,$buffer,1024))
11 {
12 print OUTFILE $buffer;
13 }
14 close OUTFILE;
15 }
-------------------------
Thanks in advance,
Val B.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Dec 2000 01:20:36 GMT
From: "EM" <me@privacy.net>
Subject: create random number
Message-Id: <E1DV5.6171$Nw6.20866@news.iol.ie>
how do i create a random string or number using perl?
---------
Eric
------------------------------
Date: Fri, 01 Dec 2000 01:46:31 GMT
From: "EM" <me@privacy.net>
Subject: Re: create random number
Message-Id: <XpDV5.6174$Nw6.20913@news.iol.ie>
never mind
i figured it out
--------
Eric
"EM" <me@privacy.net> wrote in message
news:E1DV5.6171$Nw6.20866@news.iol.ie...
> how do i create a random string or number using perl?
>
> ---------
> Eric
>
>
------------------------------
Date: Fri, 01 Dec 2000 01:12:26 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Creating Arrays of Hashes Perlishly
Message-Id: <t2dunq9ukjfec6@corp.supernews.com>
Adam T Walton (adam.walton@btconnect.com) wrote:
: I have some data in text files that I want to read into a CGI script. The
: data is in the following format:-
[snip]
: I want to slurp this data into an array of hashes as efficiently as
: possible... I have written an unwieldly piece of code that works, but I'm
: sure it could be written more Perlishly and probably in a couple of lines.
: Here's the relevant snippet from my current script:-
:
: open MUSO_LIST, 'beatles.muso' or warn_Browser('Cannot open the muso file
: info.');
: undef $/;
:
: my @alternate_albums=split ("\n", <MUSO_LIST>);
Why go to the trouble of getting into slurp mode, then redo the work that
reading it in line mode would have done in the first place? Lose the
'undef $/;', and replace the next line with:
chomp(my @alternate_albums = <MUSO_LIST>);
The chomp() is to strip trailing newlines, which your version did by means
of the split.
: for ($i=0; $i<@alternate_albums; $i++) {
: my ($al_artist, $al_album, $al_fname)=split '#', $alternate_albums[$i];
: push @album_details, {artist=>$al_artist, album=>$al_album,
: fname=>$al_fname};
: }
foreach (@alternate_albums) {
my ($artist, $title, $fname) = split /#/;
push @album_details, { artist => $artist,
album => $title,
fname => $fname };
}
Of course, the resulting @album_details list has no structure. I'd tend
to think a hash of artist name to a list of { album, fname } hash
references would be more useful.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "There is no dark side of the moon really. Matter
| of fact, it's all dark." - Pink Floyd
------------------------------
Date: 1 Dec 2000 00:09:27 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Data missing, rogue proccess.
Message-Id: <975629366.332974@hpvablab.cup.hp.com>
"Josh" <josh@projectperl.com> writes:
>I have been having problems where a datafile is becoming corrupt at random
>times. At random times with apparently different functions being used the
>larger of two datafiles(in plaintext) will become corrupt(data is missing
>and fields are moved all over the place. I have yet to find an answer on
>this and would greatly appreciate any help. Files are always locked using
>either the non-exclusive or exclusive lock appropriately.
I suggest you show your file open/and locking code...
Rich
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014
------------------------------
Date: 30 Nov 2000 23:09:50 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debug a forked/exec Perl script started from another Perl script
Message-Id: <906mnu$pqb$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Johan Vermeire
<Johan.Vermeire@alcatel.be>],
who wrote in article <3A26C27B.AF700E56@alcatel.be>:
> When the Parent process forks a child process, the Perl debugger
> activates
> a separate x-term with the forked/exec Perl script (only when you step
> into the fork statement!).
> But when the exec process in the Child process starts, then the Perl
> debugger looses control.
Put -d into the arguments of the child.
Ilya
------------------------------
Date: Thu, 30 Nov 2000 23:22:17 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Do I need Java to redirect form parameters?
Message-Id: <t2do996ub4el4d@corp.supernews.com>
Josh Whitt (jwhitt@webaccess.net) wrote:
: 3) whip out LWP and post directly to this external script, grab that
: script's output, and print it out from your script.
The problem is that if that script produces html containing any relative
urls (in links, images, or whatever) these will all be broken.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Here's to the struggles of the silent war,
| here's to the closing of the age." -The Call
------------------------------
Date: Thu, 30 Nov 2000 18:34:56 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Exporter
Message-Id: <slrn92dp10.7rk.tadmc@magna.metronet.com>
mark@Mark-Walter.org <mark@Mark-Walter.org> wrote:
>Would like to know the reason for using the exporter modul. E.g.
You must certainly have already read the docs for the module, yes?
perldoc Exporter
What part are you unclear on?
Note in particular this part:
"Understanding the concept of modules and
how the `use' statement operates is important to
understanding the Exporter."
So, have you read up on those yet?
perldoc -f use
perldoc perlmod
>I have a script where I reference annonymus arrays. I'am able to use
>them in my main routine differencing from the script where I stored
>the variables.
Errr, what?
>I've seen this usage in the most cases while grepping
>over my linux system but where's the major field of application for
>this technique ?
I'm afraid I can't figure out what technique you are trying
to describe.
But using Exporter is useful in many (probably _all_)
major fields of application.
When your project starts getting big, you want to break it up.
Exporter helps when you have multi-file programs.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 30 Nov 2000 17:15:42 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: Extracting the first name
Message-Id: <3A26DB9C.84643696@mrnoitall.com>
Dear Persons,
I need to open a name file, get the first name, and reprint the file
with the remaining names.
I don't have a clue as to how to identify the first name on the list.
Any ideas are appreciated.
Thanks in advance for your help.
open(LIST,">$location_of_file") || &file_open_error
("$location_of_file", "Numbers txt", __FILE__, __LINE__);
while (<LIST>) {
$number = $_;
chop $number;
if($number ne ""){
$in{'user_name'} = $number;
}
}#while list
close (LIST);
unless($number eq "$in{'user_name'}"){
print LIST "$number\n";
}
------------------------------
Date: Thu, 30 Nov 2000 18:36:02 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Extracting the first name
Message-Id: <slrn92dp32.7rk.tadmc@magna.metronet.com>
Todd Anderson <todd@mrnoitall.com> wrote:
>I don't have a clue as to how to identify the first name on the list.
>open(LIST,">$location_of_file") || &file_open_error
> ("$location_of_file", "Numbers txt", __FILE__, __LINE__);
>
>while (<LIST>) {
perldoc perlvar
Have a look at the $. special variable.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 01 Dec 2000 01:17:00 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ 4.28: How do I capitalize all the words on one line?
Message-Id: <g_CV5.37$_g6.135469568@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I capitalize all the words on one line?
To make the first letter of each word upper case:
$line =~ s/\b(\w)/\U$1/g;
This has the strange effect of turning "`don't do it'" into "`Don'T Do
It'". Sometimes you might want this, instead (Suggested by brian d.
foy):
$string =~ s/ (
(^\w) #at the beginning of the line
| # or
(\s\w) #preceded by whitespace
)
/\U$1/xg;
$string =~ /([\w']+)/\u\L$1/g;
To make the whole line upper case:
$line = uc($line);
To force each word to be lower case, with the first letter upper case:
$line =~ s/(\w+)/\u\L$1/g;
You can (and probably should) enable locale awareness of those
characters by placing a `use locale' pragma in your program. See the
perllocale manpage for endless details on locales.
This is sometimes referred to as putting something into "title case",
but that's not quite accurate. Consider the proper capitalization of the
movie *Dr. Strangelove or: How I Learned to Stop Worrying and Love the
Bomb*, for example.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep comming up. If you are some how irritated by
seeing these postings you are free to ignore them or add the sender
to your killfile. If you find errors or other problems with these
postings please send corrections or comments to the posting email
address.
If you are not able to find this or other Perl documentation from
your installation you may access it via the web by following the
appropriate links from one of the addresses listed below.
http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search
http://www.perldoc.com
http://www.cpan.org
http://www.perl.com
Answers to questions about LOTS of other stuff, mostly not related to
Perl, can be found at
news:news.answers
and in the many thousands of other useful Usenet news groups.
The perlfaq manual pages contain the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
When included as an integrated part of the Standard
Distribution of Perl or of its documentation (printed or
otherwise), this work is covered under Perl's Artistic
License. For separate distributions of all or part of
this FAQ outside of that, see the perlfaq manpage.
Irrespective of its distribution, all code examples here
are public domain. You are permitted and encouraged to
use this code and any derivatives thereof in your own
programs for fun or for profit as you see fit. A simple
comment in the code giving credit to the FAQ would be
courteous but is not required.
--
This space intentionally left blank
------------------------------
Date: Fri, 01 Dec 2000 01:29:44 GMT
From: jmwjr@my-deja.com
Subject: gmtime help
Message-Id: <906uu2$4qh$1@nnrp1.deja.com>
When I run gmtime using the following script:
#! /usr/bin/perl
($sec, $min, $hour, $mday, $month, $year, $wday, $yday) = gmtime();
print "Sec: $sec\n";
print "Min: $min\n";
print "Hour: $hour\n";
print "Mday: $mday\n";
print "Month: $month\n";
print "Year: $year\n";
print "Wday: $wday\n";
print "Yday: $yday\n";
I get the following:
D:\Perls\Apps\Bypass>time.pl
Sec: 15
Min: 20
Hour: 1
Mday: 1
Month: 11
Year: 100
Wday: 5
Yday: 335
Actual date & time
D:\Perls\Apps\Bypass>date
The current date is: Thu 11/30/2000
D:\Perls\Apps\Bypass>time
The current time is: 20:20:00.69
I would have thought the hour would be 20 not 1 and
the mday 30 not 1.
I am set up with GMT-05:00 Eastern
Win 2000
ActiveState Perl 5.6 Build 620
What am I missing?
Thanks Mike Wilson
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 30 Nov 2000 18:52:38 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Hashes and printing values with CGI.pm
Message-Id: <brian-ya02408000R3011001852380001@news.panix.com>
In article <906j2t$qr9$1@nnrp1.deja.com>, dtbaker_dejanews@my-deja.com posted:
> In article <906eom$mkm$1@nnrp1.deja.com>,
> xlr6drone@my-deja.com wrote:
> > I am trying to obtain the values from a fill out form using CGI.pm
> you are making this harder than it needs to be i think.... If you are
> using CGI.pm, then a call to param() returns an array of all variable
> names.
well, it returns a list at least. if you want to store that in an
array, that's up to you. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 30 Nov 2000 23:55:48 GMT
From: xlr6drone@my-deja.com
Subject: Re: Hashes and printing values with CGI.pm
Message-Id: <906pe1$dl$1@nnrp1.deja.com>
In article <906j2t$qr9$1@nnrp1.deja.com>,
dtbaker_dejanews@my-deja.com wrote:
> In article <906eom$mkm$1@nnrp1.deja.com>,
> xlr6drone@my-deja.com wrote:
> > Hello,
> >
> > I am trying to obtain the values from a fill out form using CGI.pm
> ---------
> you are making this harder than it needs to be i think.... If you are
> using CGI.pm, then a call to param() returns an array of all variable
> names. You could then go thru and load up all the values. Be careful
> whether you get the values in scalar or list context depending on how
> the data is loaded into the variable!
>
Thank you for your reply,
OK the form fields are stored in the %FIELD hash (check first post to see
all of the code for this script)
%FIELDS = ('Personal Information' =>['Name','Address','Telephone','Fax'],
'References' => ['Personal Reference 1','Personal
Reference 2'],
'Assets' => ['Savings Account','Home','Car']
);
I have been successful in obtaining individual values from param(). This
is what I have used
@names = param('Address');
print MAIL "@names\n";
This works but why do you have to assign 'Address' which is one value to
an array? Why not just create a scalar called $names?
Also I am still uncertain on how to load up all the values into an array
from param() and then print it to the screen. Can you provide a code
example of this? Also what would be the differences in code between
scalar and list context?
best,
Tim
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 30 Nov 2000 18:23:53 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Hashes and printing values with CGI.pm
Message-Id: <slrn92doc9.7rk.tadmc@magna.metronet.com>
brian d foy <brian@smithrenaud.com> wrote:
>In article <906j2t$qr9$1@nnrp1.deja.com>, dtbaker_dejanews@my-deja.com posted:
>
>> In article <906eom$mkm$1@nnrp1.deja.com>,
>> xlr6drone@my-deja.com wrote:
>
>> > I am trying to obtain the values from a fill out form using CGI.pm
>
>> you are making this harder than it needs to be i think.... If you are
>> using CGI.pm, then a call to param() returns an array of all variable
>> names.
>
>well, it returns a list at least. if you want to store that in an
>array, that's up to you. :)
For those of you wondering what brian is talking about,
see the Perl FAQ, part 4:
"What is the difference between a list and an array?"
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 01 Dec 2000 00:26:29 GMT
From: fallenang3l@my-deja.com
Subject: Re: HELP BEFORE ME HEAD EXPLODES
Message-Id: <906r7f$1sn$1@nnrp1.deja.com>
In article <906l5b$sht$1@nnrp1.deja.com>,
neurofase@my-deja.com wrote:
> I am a complete novice with perl, even though i first starting using
it
> a year ago.
>
> All I do is use edit pad to cut and paste and alter perl forms that I
> already have. I am trying to make up a new bit of perl but i keep
> hitting brick walls.
>
> Is there any good programs which most people use, like using
> Dreamweaver for HTML.
>
> Thanks for your help
>
> neurofase@yahoo.com
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Buy a few good books like Learning Perl, Programming Perl 3rd Edition
and The Perl Cookbook all from a publisher called O'Reilly. You won't
be sorry and you will learn to do _it_ the right way (even tho there
may be several).
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 1 Dec 2000 01:15:11 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: HELP BEFORE ME HEAD EXPLODES
Message-Id: <eli$0011301755@qz.little-neck.ny.us>
In comp.lang.perl.misc, <neurofase@my-deja.com> wrote:
> All I do is use edit pad to cut and paste and alter perl forms that I
> already have. I am trying to make up a new bit of perl but i keep
> hitting brick walls.
>
> Is there any good programs which most people use, like using
> Dreamweaver for HTML.
voice over: And here we witness the demise of Neurofase, who
failed to understand that programming cannot be
a WYSIWYG affair.
s/fx: earth-shattering boom, with long lingering reverberations
Elijah
------
use X11::Protocol;$X=new X11::Protocol;END{$X->FreeGC($G);undef$X}map{$$_=$X->
new_rsrc}(W,F,G);$X->event_handler('queue');$X->CreateWindow($W,$X->root,'Inp'
.'utOutput',$D=$X->root_depth,'CopyFromParent',(0,0),300,30,4,'event_mask',01,
background_pixel=>2**$D-1);$X->CreateGC($G,$W);$X->MapWindow($W);$X->PolyText8
($W,$G,25,28,[0,'Eli the Bearded:Just Another Perl Hacker']);$X->handle_input;
------------------------------
Date: Fri, 01 Dec 2000 00:00:57 GMT
From: jjlupa@my-deja.com
Subject: Re: Help with Net::NNTP please?
Message-Id: <906pnl$ip$1@nnrp1.deja.com>
OK, I'm now experimenting with using message numbers, I think it should
be easy enough as long as message numbers always increase.
Thanks to the people who mailed.
-Jonathan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 29 Nov 2000 18:21:48 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How do I null terminate a string ?
Message-Id: <G4stoC.7H7@news.muni.cz>
On Wed, 29 Nov 2000 11:21:43 -0600, Neil Trenholm <neil@alaweb.com> wrote:
>
> I don't know how I missed this in the docs ... but ... I have a string that
> needs to be null terminated before being shipped off to a Win32::API
>
> $this_string = "StringContents";
$this_string .= "\000";
Yours,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Thu, 30 Nov 2000 18:23:28 -0500
From: "Philip Obbard" <pobbard@hotresponse.com>
Subject: Re: mod_perl DBI connection issue (Addendum)
Message-Id: <0gBV5.3349$am4.35987@e420r-sjo3.usenetserver.com>
Addendum: mod_perl is definitely *working*, because test scripts using
CGI.pm work fine. It's only when the DBI gets involved that everything seems
to stop...
Thanks,
Philip
"Philip Obbard" <pobbard@hotresponse.com> wrote in message
news:qdBV5.3338$am4.35638@e420r-sjo3.usenetserver.com...
> Everything was working great - I've got mod_perl working on two test boxes
> and running my DBI connections just fine - but I can't make a connection
to
> my Oracle database (which is on another server) using mod_perl on my
> production Sun box.
>
> -Perl 5.005_03 is working great.
> -mod_perl 1.24_01 is working great with apache 1.3.14
> -DBI 1.14 connections are working great with DBD Oracle 1.06
>
> The problem occurs whether I do
> PerlModule Apache::DBI
> ...in my httpd.conf or not.
>
> Essentially, I can connect to test.cgi and produce the output with
> Options +ExecCGI
> SetHandler cgi-script.
>
> But when I use:
> Options +ExecCGI
> SetHandler perl-script
> PerlHandler Apache::Registry
>
> ... I get no error message in the error_log, and a simple "The page cannot
> be displayed" in the browser. I know that test.cgi is being found since I
> have a 'warn' message in it which appears correctly in the error_log. I
get
> no *specific* DBI message, but it seems as if the code just quits once it
> needs to use the DBI.
>
> My test code looks like this:
>
> #!/usr/local/bin/perl
> use strict;
> use DBI;
> warn "hello!";
> use CGI qw(:standard);
>
> my $query = new CGI;
> my $dbh = DBI->connect( 'dbi:Oracle:MAINDB',
> 'foo',
> 'bar',
> {
> RaiseError => 1,
> AutoCommit => 0
> }
> ) || die "Database connection not made:
$DBI::errstr";
>
> my $sql = qq{ select survey_id, my_id, start_date, end_date from ted};
> my $sth = $dbh->prepare( $sql );
> $sth->execute();
>
> my( $id, $pub_id, $start, $end );
> $sth->bind_columns( undef, \$id, \$my_id, \$start, \$end );
>
> print $query->header;
> while( $sth->fetch() ) {
> print "$pub_id, $start, $end\n\n";
> }
>
> $sth->finish();
>
> $dbh->disconnect();
> --------------
>
> Any help would be greatly appreciated!
>
> Thanks,
> Philip
>
>
>
>
>
>
>
------------------------------
Date: Thu, 30 Nov 2000 18:20:42 -0500
From: "Philip Obbard" <pobbard@hotresponse.com>
Subject: mod_perl DBI connection issue
Message-Id: <qdBV5.3338$am4.35638@e420r-sjo3.usenetserver.com>
Everything was working great - I've got mod_perl working on two test boxes
and running my DBI connections just fine - but I can't make a connection to
my Oracle database (which is on another server) using mod_perl on my
production Sun box.
-Perl 5.005_03 is working great.
-mod_perl 1.24_01 is working great with apache 1.3.14
-DBI 1.14 connections are working great with DBD Oracle 1.06
The problem occurs whether I do
PerlModule Apache::DBI
...in my httpd.conf or not.
Essentially, I can connect to test.cgi and produce the output with
Options +ExecCGI
SetHandler cgi-script.
But when I use:
Options +ExecCGI
SetHandler perl-script
PerlHandler Apache::Registry
... I get no error message in the error_log, and a simple "The page cannot
be displayed" in the browser. I know that test.cgi is being found since I
have a 'warn' message in it which appears correctly in the error_log. I get
no *specific* DBI message, but it seems as if the code just quits once it
needs to use the DBI.
My test code looks like this:
#!/usr/local/bin/perl
use strict;
use DBI;
warn "hello!";
use CGI qw(:standard);
my $query = new CGI;
my $dbh = DBI->connect( 'dbi:Oracle:MAINDB',
'foo',
'bar',
{
RaiseError => 1,
AutoCommit => 0
}
) || die "Database connection not made: $DBI::errstr";
my $sql = qq{ select survey_id, my_id, start_date, end_date from ted};
my $sth = $dbh->prepare( $sql );
$sth->execute();
my( $id, $pub_id, $start, $end );
$sth->bind_columns( undef, \$id, \$my_id, \$start, \$end );
print $query->header;
while( $sth->fetch() ) {
print "$pub_id, $start, $end\n\n";
}
$sth->finish();
$dbh->disconnect();
--------------
Any help would be greatly appreciated!
Thanks,
Philip
------------------------------
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 V9 Issue 5002
**************************************