[15545] in Perl-Users-Digest
Perl-Users Digest, Issue: 2959 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 5 12:19:00 2000
Date: Fri, 5 May 2000 08:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957539113-v9-i2959@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 5 May 2000 Volume: 9 Number: 2959
Today's topics:
Re: A problem about setuidperl! <rootbeer@redcat.com>
And htmlencode? <russ@css2.com>
Color under MS-DOS/WINNT <fyd@u-picardie.fr>
Re: Cookie & redirect <stephane@siw.ch>
Re: daily pics script <rootbeer@redcat.com>
DBI::ProxyServer & ODBC ammar_aganovic@my-deja.com
DIRHANDLE problems <djberg96@hotmail.com>
Re: file upload <adams1015@worldnet.att.net>
Re: First Perl Program <kent@darwin.eeb.uconn.edu>
Re: getting started with perl on unix (David Knapik)
Re: getting started with perl on unix <sue@pennine.com>
Re: getting started with perl on unix <susan.jaeckleNOsuSPAM@kodak.com.invalid>
Re: getting started with perl on unix <kent@darwin.eeb.uconn.edu>
GnuPG conflicts with SSL <mark-malkasian@home.com>
Re: Good Perl website? <rootbeer@redcat.com>
Re: help reqd. for 'new' method (Bart Lateur)
Re: help reqd. for 'new' method <aqumsieh@hyperchip.com>
Re: Help running my app from cron. Enviromental varl i <rootbeer@redcat.com>
Re: Hierscript in perl <rootbeer@redcat.com>
Re: How can I run auto-download file in browser ? <rootbeer@redcat.com>
Re: How does argument order affect long string variable <rootbeer@redcat.com>
I thought i had this right, plz help <robert.zakaria@usa.net>
Re: LWP POST syntax @{@$%??} dplynn@dmrtc.net
Re: LWP POST syntax @{@$%??} <rootbeer@redcat.com>
need prebuilt XML::Parser <rwilson@connectex.com>
Re: Parse a String <sariq@texas.net>
Re: Perl 5.6 stable?? bryan@NoSpam.panix.com
Re: problem with "system" and file copy <rootbeer@redcat.com>
Re: Refresh problem <rootbeer@redcat.com>
Re: Regex for not matching a particular string <rootbeer@redcat.com>
Re: Stored Cookie <stephane@siw.ch>
Re: Stored Cookie <stephane@siw.ch>
Re: Trim A String To 16 Characters (John Rappe)
Re: Trim A String To 16 Characters <billy@arnis-bsl.com>
Re: Trim A String To 16 Characters <sariq@texas.net>
Re: unlink ( deleting file) not working (Bart Lateur)
Re: unlink ( deleting file) not working <aqumsieh@hyperchip.com>
urlencode? <russ@css2.com>
Re: Variable -> filehandle / PerlMagick read from varia <rootbeer@redcat.com>
web browser ftp cgi script? pkey@sghms.ac.uk
WIN32::ODBC using MoreResults() <yesmail_99NOyeSPAM@yahoo.com.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 5 May 2000 06:41:17 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: A problem about setuidperl!
Message-Id: <Pine.GSO.4.10.10005050639130.6766-100000@user2.teleport.com>
On Thu, 4 May 2000, Peter Tang wrote:
> I have a program which have the permission 4755(rwsr-xr-x) and owned
> by root, the program will create a '.forward' file in user's
> directory.
>
> All user's directory is owned by nobody and have permission (rwxr-xr-x).
Why are users' directories owned by nobody? That sounds like a bad
configuration, but maybe I don't understand something.
> But when a execute the program, the following error will appear
> "Insecure Dependency in open while running setuid ...".
Check the perlsec manpage. If you still have questions after reading that,
read it again. :-) If you _still_ have questions, though, ask again here.
Making set-id programs - especially ones set-id to root - is potentially
dangerous. Be careful!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 14:46:00 GMT
From: "Russell England" <russ@css2.com>
Subject: And htmlencode?
Message-Id: <I8BQ4.3759$tQ3.397105@news3.cableinet.net>
Is there aslo a perl equivalent to the asp function server.htmlencode()?
------------------------------
Date: Fri, 05 May 2000 16:22:06 +0200
From: Francois Dupradeau <fyd@u-picardie.fr>
Subject: Color under MS-DOS/WINNT
Message-Id: <3912D90D.3635895C@u-picardie.fr>
Hello !
I have a problem to get colors under MS-DOS with Windows NT. I have
installed the Term-ANSIColor module with PPM.
When I run the test.pl script , perl show the color code instead of the
colors.
test.pl
-------
use Term::ANSIColor qw(:constants color colored);
print RED, "This text is in red !", RESET;
------------------------------------------------------------------------
And here is the result:
?[31mThis text is in ed !
I don't understand why this result. Someone can help me please ? Thanks
Francois
------------------------------
Date: Fri, 05 May 2000 13:28:42 GMT
From: "Chello" <stephane@siw.ch>
Subject: Re: Cookie & redirect
Message-Id: <e0AQ4.81387$6X3.1967888@news.chello.at>
And also:
my $cookie=$q->cookie(-name=>'moonkey_exchange',-value=>'not so
cool',-expires=>'+1y');
print $q->header(-cookie=>$cookie,-uri=>$url,-nph=>1);
It doesn't work... I'm redirected to my URL but the cookie isn't
writted..... What can I do??? Does someone has The SOLUTION?????
Help very, very, very WELCOME!!!
Thanks in advance.
Stéphane
"Chello" <stephane@siw.ch> wrote in message
news:nqzQ4.81331$6X3.1965238@news.chello.at...
>
> I'd like to send a cookie and then redirect, but it doesn't work at all.
> Here is my portion of code:
>
> my
>
$cookie=$q->cookie(-name=>'moonkey_exchange',-value=>'Hi',-expires=>'+37y');
>
> print $q->header(-cookie=>$cookie);
>
> #print CGI->redirect(-uri=>$url,-nph=>1);
>
>
>
> I also tried:
>
>
>
> my
>
$cookie=$q->cookie(-name=>'moonkey_exchange',-value=>'Hi',-expires=>'+37y');
>
> print $q->header(-cookie=>$cookie);
>
> print "Location: $url \n\n";
>
> HTH;
>
>
>
>
>
> Help really welcome. Thanks in advance.
>
>
>
> Stéphane
>
>
>
------------------------------
Date: Fri, 5 May 2000 06:41:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: daily pics script
Message-Id: <Pine.GSO.4.10.10005050641290.6766-100000@user2.teleport.com>
On Thu, 4 May 2000, ringo wrote:
> I need CGI (perl) script to DAILY rotation of pics or links
> Where can i found it?
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 13:17:04 GMT
From: ammar_aganovic@my-deja.com
Subject: DBI::ProxyServer & ODBC
Message-Id: <8euhk2$pf3$1@nnrp1.deja.com>
I know there is this DBI::ProxyServer module which is supposed to be
acting as a proxy to the DB... here are my questions:
- Is it possible to use a ODBC to connect to a Proxy, or it must be a
perl script with DBD::Proxy module acting?
- Must I have root privilages to install the script, or can I also be a
regular user and start the daemon (do I have to install the module?).
(for a port >1024).
regards,
Ammar
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 5 May 2000 09:16:05 -0500
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: DIRHANDLE problems
Message-Id: <3912d5c9$0$63041@news.execpc.com>
Hi all,
I'm running perl & tk on Win98 here. Just teaching myself tk,
and I came across a problem with DIRHANDLE. Essentially,
whenever I change directories (via win32dirselect - which is
why I'm posting in the tk newsgroup), I can no longer read the
files in the (new) current directory.
In other words, I no longer get a return value from
'telldir DIRHANDLE'. I've tried various permutations
of rewinddir and seekdir, all to no avail.
Here's a snippet of code to give you an idea:
$cwd = cwd;
opendir(DIRHANDLE, "$cwd") || die "\nCouldn't open directory : $!";
while(defined ( $fileName = readdir (DIRHANDLE) ) ){
if( -f "$fileName" ){
open(FILE, "$fileName") || die "\nUnable to open file $filename :
$!";
$curDir = telldir DIRHANDLE;
print "\n$curDir";
}
else{ next; }
while(<FILE>){
...
}
The program I'm working on works fine on startup, i.e. in the initial
directory it starts in and I get return values from 'telldir'. Any attempt
to change the directory barfs it (no return values from 'telldir'),
even though I get no error messages of any kind. That's what led me
to believe the DIRHANDLE file pointer was somehow not resetting.
Could this be a win32dirselect problem?
Thanks in advance for any help.
Dan
--
In the immortal words of Socrates, "I drank what?"
------------------------------
Date: Fri, 05 May 2000 13:48:59 GMT
From: "Veronica Adams" <adams1015@worldnet.att.net>
Subject: Re: file upload
Message-Id: <fjAQ4.50410$WF.2694119@bgtnsc04-news.ops.worldnet.att.net>
Jonathan Lee <jlee@totalise.co.uk> wrote in message
news:3911c3b6.0@news2.cluster1.telinco.net...
> Help!!
>
> I'm trying to write a file upload script that will take a file, rename it
> and then place it in a directory. I'm using cgi-lib.pl and I'm taking a
> user inputted variable that takes in an id number and this is the id
number
> that I want to use for the filename.
>
> If I enter a constant value for filepre then it will accept it but when I
> try to pass a variable to file pre it's having none of it.
>
> Can anybody help me with this or give me any help with file uploads in
> general that won't require cgi-lib. I'm a bit stuck in a project that I
> don't know much about so any good samaritans out there, your help would be
> much appreciated!!
>
> Johnny
>
>
use cgi.pm If your host doesn't have it installed you can install it into
your cgi-bin directory. Goto cpan.org and look around in the modules. You'll
find the help you need there with installing it. You'll also find the
documentation for using cgi.pm.
------------------------------
Date: 05 May 2000 09:56:22 -0400
From: Kent Holsinger <kent@darwin.eeb.uconn.edu>
Subject: Re: First Perl Program
Message-Id: <m0aei5je2h.fsf@darwin.eeb.uconn.edu>
Take a look at the docs for CGI.pm (perldoc CGI). That should get you
started (and is likely to have everything you need).
Kent
--
Kent E. Holsinger kent@darwin.eeb.uconn.edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-3043
-- Storrs, CT 06269-3043
------------------------------
Date: Fri, 05 May 2000 13:14:33 GMT
From: dknapik@primenet.com (David Knapik)
Subject: Re: getting started with perl on unix
Message-Id: <3912c87b.44351284@news.primenet.com>
So can you execute perl?
$perl
If you have sufficient privilages it should give you a blank line.
(^C to exit).
You can also try:
$perl db.pl
also, the top line whould be something like
#!/usr/bin/perl
On Fri, 05 May 2000 05:16:54 -0700, Susan
<susan.jaeckleNOsuSPAM@kodak.com.invalid> wrote:
>I'm a little lost. I see perl5 on my unix box but don't
>know how to use it. I created a small perl script and get a
>message "permission denied". It looks to me like all of the
>files in the perl5 subdirectories can be read by anyone.
>Help!
>
>
>* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: 5 May 2000 05:49:25 -0700
From: Sue Spence <sue@pennine.com>
Subject: Re: getting started with perl on unix
Message-Id: <8eug0l$95o@drn.newsguy.com>
In article <2e00cd7c.8c57e10b@usw-ex0110-076.remarq.com>, Susan says...
>
>I ran the script in one of my own directories. Here it is:
>
>#!/usr/local/lib/perl5/5.00503
The above line looks incorrect to me.
>package main;
>print "1 \n";
>
>print "Sid $sid variables are:\n";
>
>print "******************************************\n";
>print "ADMIN - $ENV{'ADMIN'}\n";
>print "LOGS - $ENV{'LOGS'}\n";
>
>
>* Sent from AltaVista http://www.altavista.com Where you can also find related
>Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Fri, 05 May 2000 07:59:02 -0700
From: Susan <susan.jaeckleNOsuSPAM@kodak.com.invalid>
Subject: Re: getting started with perl on unix
Message-Id: <1cb3e3d0.aefe5565@usw-ex0110-076.remarq.com>
Thanks. I had the wrong first line but used whereis perl to
discover my mistake.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: 05 May 2000 10:03:51 -0400
From: Kent Holsinger <kent@darwin.eeb.uconn.edu>
Subject: Re: getting started with perl on unix
Message-Id: <m066stjdq0.fsf@darwin.eeb.uconn.edu>
>>>>> "Susan" == Susan <susan.jaeckleNOsuSPAM@kodak.com.invalid> writes:
Susan> #!/usr/local/lib/perl5/5.00503
You need the path to the Perl executable after the shebang (#!). It
looks to me as if you're pointing to the 5.00503 directory in the Perl
library, not the perl executable. It's more likely that you want
something like
#!/usr/local/bin/perl -w
#!/usr/local/bin/perl5.00503 -w
Turning on warnings with -w is always a good idea.
Kent
--
Kent E. Holsinger kent@darwin.eeb.uconn.edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-3043
-- Storrs, CT 06269-3043
------------------------------
Date: Fri, 05 May 2000 14:08:58 GMT
From: Mark Malkasian <mark-malkasian@home.com>
Subject: GnuPG conflicts with SSL
Message-Id: <3912D6DD.26F08E53@home.com>
Hi All,
I've set up GnuPG on a web site hosted remotely by the mammoth Verio web
hosting company. A CGI script in Perl I wrote issues commands through a
form to the gpg executable for encryption and decryption. (For an
industrial-strength interface with GnuPG, please see Frank Tobin's
GnuPG-Interface module at http://GnuPG-Interface.sourceforge.net/.) If
the form is submitted without SSL, GnuPG works fine. However, if the
form is submitted under SSL, I get the following error message:
gpg: failed to create temporary file
`/www69/web/myaccount/cgi-local/.gnupg/.#lk100d2918.www69.22793859':
Permission denied
gpg: fatal: /www69/web/myaccount/cgi-local/.gnupg/trustdb.gpg: can't
create lock
secmem usage: 1408/1408 bytes in 2/2 blocks of pool 1408/16384
I'm using the server's shared certificate for SSL. I've double-checked
the paths and they're correct. (My script ran fine without GnuPG.) In a
post to one of Verio's mailing lists, I read that someone had the same
problem with PGP. The source of the problem was apparently related to
file/directory permissions that only the superuser could change.
Unfortunately, the person making the post is long gone from Verio and
the first line of tech support is a bit baffled. Is there a way around
this obstacle?
Thanks,
Mark Malkasian
------------------------------
Date: Fri, 5 May 2000 07:30:02 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Good Perl website?
Message-Id: <Pine.GSO.4.10.10005050722320.6766-100000@user2.teleport.com>
On Fri, 5 May 2000, Tse wrote:
> Anyone know of any good Perl reference web site?
Sure, but before I tell you, could you please do something to help all of
us who help people with Perl? We want the websites like the ones you
describe to be listed with all of the major search engines in such a way
that they're easy to find. What searches did you perform which failed to
find what you wanted? Once we know what search failed you, we may be able
to take steps to ensure that other people who do the same search will find
what they want.
But here's one place to get you started.
http://www.perl.com/reference/
Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 13:04:47 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: help reqd. for 'new' method
Message-Id: <3918c51b.4356211@news.skynet.be>
sambitm@my-deja.com wrote:
>Is it OK practice to load the 'new'
>method with lots of work and Data?
>
>And is there a way to rename the 'new'
>method with something else(though
>i dont think that wud be functionally
>of any more help!)
"new" is not a reserved name in Perl. You can call this function however
you want. You may do in it whatever you want. However, you have to call
the method with the name you gave it (instead of "new"), and you're
supposed to return a blessed reference to the object.
package Foo::Bar;
sub get_me_a {
my $self = shift;
my $class = ref $self || $self;
return bless { data => $_[0] }, $class;
}
package main;
my $instance = get_me_a Foo::Bar ( 'biscuit' );
print "$instance | $instance->{data}\n";
-->
Foo::Bar=HASH(0xffe891e0) | biscuit
--
Bart.
------------------------------
Date: Fri, 05 May 2000 13:20:12 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: help reqd. for 'new' method
Message-Id: <7ahfcdp20i.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
sambitm@my-deja.com writes:
> Is it OK practice to load the 'new'
> method with lots of work and Data?
What are you talking about?
> And is there a way to rename the 'new'
> method with something else(though
> i dont think that wud be functionally
> of any more help!)
If you are talking about the constructor method of some object, then
yes. In Perl, there is nothing special about the constructor method,
and you can call it whatever you want. Most people call it 'new',
though, for obvious reasons.
--Ala
------------------------------
Date: Fri, 5 May 2000 07:17:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help running my app from cron. Enviromental varl issue..?
Message-Id: <Pine.GSO.4.10.10005050708030.6766-100000@user2.teleport.com>
On Fri, 5 May 2000, Dave LaPorte wrote:
> But when I try to execute the program using a cron entry for root, the
> program seems to stop about halfway through.
Generally, when a program that works at the command line doesn't work the
same way under cron, it's relying upon something in the environment - an
environment variable, or the current directory, or something like that.
Go through the program and look for anything which may be doing this,
including external programs. Here are a couple of things I spotted in your
code which relate to other issues:
> eval{ open(NAMES, "/home/scripts/namefile") || die "error" };
> if ( $@ =~ m/^error/)
It's simpler (and probably faster, and certainly more common) to write
that sort of thing like this:
unless (open NAMES, "/home/scripts/namefile") {
# error handling here, perhaps using $!
}
> return($mailname);
> last;
Of course, any code after an unconditional return isn't ever going to be
executed. Perl should warn you about this, but it looks as if it doesn't.
> return("NO"); # No match found exit with an error.
>
>
> } # End while
So, you want to return every time through the loop? I think something is
wrong here.
> $control =~ s/.quote/.control/; # strip and replace extensions
Perhaps that should have s/\.quote$/.control/ instead. Not likely to bite
you in this program until you have a file named something like
"famous_quotes.quote", though.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 5 May 2000 06:47:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Hierscript in perl
Message-Id: <Pine.GSO.4.10.10005050644170.6766-100000@user2.teleport.com>
On Thu, 4 May 2000, Bernard Polarski wrote:
> I am trying to port Shell script from Ksh Unix onto perl. The following
> procedure work perfectly uder difital Unix :
>
> $a=`sqlplus <<EOF bpa/bpa\@NOSIQA
> set feed off head off
> select sysdate from dual ;
> exit
> EOF`;
> printf "a=$a";
> But the code does not work under Perl NT :
Well, on Unixish machines, backticks are run through a Unixish shell,
which seems capable of handling here documents. On NT, I'd guess that
command.com isn't capable of the same syntax. Change what's in the
backticks to be valid syntax for command.com, and you should be set.
One idea would be to write those lines to a temporary file, then make the
command pull the data from that file.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 5 May 2000 07:54:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How can I run auto-download file in browser ?
Message-Id: <Pine.GSO.4.10.10005050752310.6766-100000@user2.teleport.com>
On Fri, 5 May 2000, Jonathan Kazmierczak wrote:
> Can you give me names of these groups ? I haven't found them.
If you need help in finding appropriate newsgroups (or other forums) on a
given topic, start by reading the messages in news.announce.newusers.
But for most CGI-type questions, you should start reading
comp.infosystems.www.authoring.cgi. After you've read for a while, you may
be ready to post. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 5 May 2000 06:57:27 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How does argument order affect long string variables
Message-Id: <Pine.GSO.4.10.10005050655280.6766-100000@user2.teleport.com>
On Thu, 4 May 2000 jvbrantley@my-deja.com wrote:
> Arguments are being passed from jscript to perlscript in this order:
>
> To, From, Subject, Body, Protocol, Server, Port, debug
>
> As long as the body is less than 1790 characters everything works fine,
> but once it goes past that length the page blows up, IIS crashes and I
> have to reboot the IIS machine to get it back up.
Sounds like a problem with IIS. Perhaps you should search for the docs,
FAQs, and newsgroups about IIS. Maybe it offers a workaround. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 13:33:18 GMT
From: Robert Zakaria <robert.zakaria@usa.net>
Subject: I thought i had this right, plz help
Message-Id: <8euiit$q8o$1@nnrp1.deja.com>
Hi!
I am trying to delete files older than 2 days in a directory NT4 NTFS
#!c:/perl/bin/perl.exe
use Win32::File;
$cat = "c:/windows/dist";
#checking if the dir exists
opendir(KAT, $cat) || die "can't opendir $cat: $!";
#readdir reads everything into @katalog except . & ..
@katalog = grep { /[^\.+]/ } readdir (KAT);
closedir (KAT);
foreach $fil (@katalog) {
chomp ($fil);
#checking if fil is older than 2 days
if(-M $fil > 2) {
#deleting fil if older than 2 days
unlink ($fil);
};
}
any idea what to do?
--
Thank you for yuor time and help.
/robert
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 05 May 2000 13:26:44 GMT
From: dplynn@dmrtc.net
Subject: Re: LWP POST syntax @{@$%??}
Message-Id: <8eui62$q47$1@nnrp1.deja.com>
In article <8esdfg$eo6$1@nnrp1.deja.com>,
dplynn@dmrtc.net wrote:
> Greetings!
>
> I'm a newbie to perl, bought the 'dummies book', etc... but I'm stuck
> on syntax with lists, etc...
> Specifically, I'm try to POST to a form with a lot of variables, and
an
> upload file.
>
> use LWP;
> use LWP::UserAgent;
> use HTTP::Cookies;
> use HTTP::Request::Common qw(POST);
>
> <snip .. got cookies to work here :-) >
> my $req = POST $myURL,Content_Type => 'form-data',
> Content => [ func => 'll',
> versionFile => [$document],
> objAction => 'create2'
> ...long list of form variables ...
> ];
> </snip>
>
> When this is all spelled out, (iaw lwpcook), things work great.
> As a check, I do a print $req->as_string to look at the output.
>
> But, the form variables that I'm filling might change in the future,
and
> I want to try to deal with that by storing the form variables in a CSV
> file (or dynamically parsing them:-)), and loop thru an ASCII file
> containing actual form data. So, as interim step, I decided to try to
> figure out what the POST syntax would be.
>
> I'm shooting for a final statement that looks something like:
>
> my $req = POST $myurl, [Content_Type => 'form-data', %Content];
---- later in the day ----
I'm answering my own question here, but after a couple of hours work,
and more RTFM-ing, I've got the multiple line POST statement boiled down
to this:
my req$ = POST $myurl, [%Content, versionFIle => [$fname]],
Content_Type=>'form-data';
I was close on some previous attempts, but order seems to be important.
I'm not sure if I can reduce this any further. This works for what I
need.
Maybe this will be of help to someone else...:-)
/dave/
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 5 May 2000 06:54:50 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: LWP POST syntax @{@$%??}
Message-Id: <Pine.GSO.4.10.10005050651420.6766-100000@user2.teleport.com>
On Thu, 4 May 2000 dplynn@dmrtc.net wrote:
> I think there's two questions that need to be answered:
> a. The upload file [$document].. syntax may not be right (or is it a
> push(...);?
> b. the my req$ = POST ... syntax.
What you want seems to be unclear. But don't the docs for LWP, including
lwpcook, show you how to do what you want? If you step through your code
in the debugger, you should be able to make sure that you're passing the
right arguments to LWP's functions. If you're still stuck, cut your code
down to just one or two lines which aren't doing what you want, perhaps
along with a couple of additional lines for context. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 10:11:04 -0400
From: Ron Wilson <rwilson@connectex.com>
Subject: need prebuilt XML::Parser
Message-Id: <3912D678.29DBC115@connectex.com>
I need to install XML::Parser on a machine without working
development tools (yes, I've tried installing gcc, etc, but
I don't have OS install media to install certain things
needed for gcc to work.)
The machine is an Ultra 1 (sun4u) running Solaris 7. I
installed Perl from a package on the "Sun Freeware" site.
It is Perl 5.00503, installed under /usr/local/lib/perl5
If some one could make available a tar file of the built
XML::Parser, I can then install from that. Currently using
ver 2.26 ox XML::Parser.
Thanks in advance.
Ron Wilson
------------------------------
Date: Fri, 05 May 2000 09:03:27 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Parse a String
Message-Id: <3912D4AF.C1752865@texas.net>
Larry Rosler wrote:
>
> A reply to my bug report pointed me at the following from perlsub, which
> indicates that the error may be inadequate documentation of $hasargs in
> `perlfunc -f caller`:
<perlsub quote snipped>
> After much re-reading, I conclude that $hasargs means that a @_ has been
> set up for this call, though the list may be null. The only situation
> in which no @_ is set up is the plain &foo; call, for which $hasargs is
> zero.
Which, IMO, makes $hasargs pretty much useless. Oh well.
> So, to reach up a lot of levels in this thread, the only way to
> distinguish a subroutine call without arguments from a subroutine call
> with a null list of arguments is to use the &foo; form for the former.
> (How's that for alliteration?)
You could've thrown the word 'forementioned' in there someplace.
- Tom
------------------------------
Date: 5 May 2000 14:54:59 GMT
From: bryan@NoSpam.panix.com
Subject: Re: Perl 5.6 stable??
Message-Id: <8eunc3$hps$1@news.panix.com>
Dick Latshaw <latsharj@my-deja.com> wrote:
: In article <8etbgl$5ik$2@news.panix.com>,
: bryan@NoSpam.panix.com wrote:
:> I known this is considered a stable and Production release, but since
:> I don't know when it was released.
: Depends on your definition of stability. Have a look at
: bugs.activestate.com for the current 'issues'.
Sorry, I meant Perl 5.6 for UNIX. The NT version as far as I'm concerned is
a completely different animal.
------------------------------
Date: Fri, 5 May 2000 08:00:13 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: problem with "system" and file copy
Message-Id: <Pine.GSO.4.10.10005050758140.6766-100000@user2.teleport.com>
On Fri, 5 May 2000, Morbus Iff wrote:
> In article <391159cd.108765115@news.icn.siemens.de>,
> andreas.boerner@icn.siemens.de wrote:
>
> > $command = "cp ~/dir1/*.c ~dir2";
> > print $command;
> > $rc = system($command);
> > print "rc=$rc\n";
>
> When executing commands on the system, you must use backticks instead of
> quotes:
>
> $command = `cp ~/dir1/*.c ~dir2";
That's not what the quoted code needs. Using backticks instead of the
double quotes will make it do something totally different! Do you see what
it will do?
I suspect that the author of that line of code wants $command to be a
command, not the output from a command. It's not named $output, after all.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 5 May 2000 06:49:57 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Refresh problem
Message-Id: <Pine.GSO.4.10.10005050648080.6766-100000@user2.teleport.com>
On Thu, 4 May 2000, Bruce McFarlane wrote:
> but if the user then clicks their browsers refresh or reload the
> script creates another file (the script checks for duplicates and
> increments the file name). How can I avoid this "refresh/reload"
> problem?
This sounds as if you are trying to get a CGI program to work differently.
Perhaps you should search for the docs, FAQs, and newsgroups about
programming for the web. The newsgroup comp.infosystems.www.authoring.cgi
may be a good start. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 5 May 2000 08:03:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Regex for not matching a particular string
Message-Id: <Pine.GSO.4.10.10005050802230.6766-100000@user2.teleport.com>
On 5 May 2000 nobull@mail.com wrote:
> BTW: For giving such moronic advice why have I not been flamed,
> publicly flogged or worse still likened to Godzilla?
Perhaps because you take responsibility for your human failings, as an
adult should. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 13:31:27 GMT
From: "Chello" <stephane@siw.ch>
Subject: Re: Stored Cookie
Message-Id: <P2AQ4.81395$6X3.1967784@news.chello.at>
:-)))
LOL
Stéphane
"W Kemp" <bill.kemp@wire2.com> wrote in message
news:957529537.11610.0.nnrp-09.c3ad6973@news.demon.co.uk...
>
> Tony L. Svanstrom wrote in message
> <1ea5x24.1v3ousl1wgz6qoN%tony@svanstrom.com>...
> >Chello <stephane@siw.ch> wrote:
> >
> >> I'm looking to create stored cookie. In fact I need a cookie who is
> stored
> >> on th HD. How can I do it? Do somebody have a code example?
> >
>
> >A second x-post just 3 hours after asking the same question... Sorry,
> >you screwed it up for yourself, now you won't get any serious replies
> >from the people you really want to reply to your questions...
>
>
> Is this carte blanche to be silly then?
>
> Don't store cookies on the HD it is potentially very damaging. People
will
> steal the chocolate chips, and the crumbs and nuts can get caught in the
> bearings, causing premature wear and HD failiure.
>
>
------------------------------
Date: Fri, 05 May 2000 13:38:59 GMT
From: "Chello" <stephane@siw.ch>
Subject: Re: Stored Cookie
Message-Id: <T9AQ4.81408$6X3.1967233@news.chello.at>
Sorry for the "double" post about the cookie, but I didn't understand why
some cookie are in my Cookies Folder and mine is not! In factin your
previous answer I got my trouble when you said: "Some webbrowsers keep all
cookies in RAM until you quit 'em, maybe that's it?". That's why I asked my
second question about Persistant cookie... Persistant for me was stored on
HD, now I understand my mistake.
I'm really sorry about my second question.
Stéphane
"Tony L. Svanstrom" <tony@svanstrom.com> wrote in message
news:1ea5x24.1v3ousl1wgz6qoN%tony@svanstrom.com...
> Chello <stephane@siw.ch> wrote:
>
> > I'm looking to create stored cookie. In fact I need a cookie who is
stored
> > on th HD. How can I do it? Do somebody have a code example?
>
> A second x-post just 3 hours after asking the same question... Sorry,
> you screwed it up for yourself, now you won't get any serious replies
> from the people you really want to reply to your questions...
>
>
> /Tony
> --
> /\___/\ Who would you like to read your messages today? /\___/\
> \_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
> --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
> DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82 78A6 647F F247 9363 F1DB
> ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
> \O/ \O/ ©1999 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: 5 May 2000 14:25:17 GMT
From: jmrappe@excite.com (John Rappe)
Subject: Re: Trim A String To 16 Characters
Message-Id: <slrn8h5mc7.1no5.jmrappe@rufus.localdomain>
spurcell <skpurcell@hotmail.com> wrote:
>Hello,
>I had a request to take a bunch of strings and truncate (cut off) the string
>at 16 characters. In the Camel, there is a section about splitting into
>substrings, p220-222, but I don't know if that is the answer. (doesn't look
>right to me). I could also do a reg exp, but I want to build it correctly,
>and do it right.
>
>Could someone direct me to the proper documentation for this topic?
How about
perldoc -tf substr
--
john
------------------------------
Date: Fri, 05 May 2000 14:17:00 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: Trim A String To 16 Characters
Message-Id: <8eul4c$thu$1@nnrp1.deja.com>
In article <3912c2d9$0$11849@wodc7nh1.news.uu.net>,
"spurcell" <skpurcell@hotmail.com> wrote:
> Hello,
> I had a request to take a bunch of strings and truncate (cut off) the
string
> at 16 characters. In the Camel, there is a section about splitting
into
> substrings, p220-222, but I don't know if that is the answer. (doesn't
look
> right to me). I could also do a reg exp, but I want to build it
correctly,
> and do it right.
>
perldoc -f substr
$string = substr $string, 0, 16;
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 05 May 2000 09:30:34 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Trim A String To 16 Characters
Message-Id: <3912DB0A.C5AB7C97@texas.net>
spurcell wrote:
>
> Hello,
> I had a request to take a bunch of strings and truncate (cut off) the string
> at 16 characters.
>
> Could someone direct me to the proper documentation for this topic?
perlfaq4
- Tom
------------------------------
Date: Fri, 05 May 2000 12:56:48 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: unlink ( deleting file) not working
Message-Id: <3917c4a3.4236365@news.skynet.be>
robbie_pa@my-deja.com wrote:
>#checking if the dir exists
>opendir(KAT, $cat) || die "can't opendir $cat: $!";
>
>#readdir reads everything into @katalog except . & ..
>@katalog = grep { /[^\.+]/ } readdir (KAT);
>closedir (KAT);
>foreach $fil (@katalog) {
> chomp ($fil);
Not necessary. You're not reading fro ma file, so there's no newline at
the end.
>#checking if fil is older than 2 days
> if(-M $fil > 2) {
>#deleting fil if older than 2 days
> unlink ($fil);
> };
>}
readdir() returns bare file names. Simple solution: chdir to $cat before
attempting this. (i.e. before the loop).Also, print out $! if unlink
fails.
--
Bart.
------------------------------
Date: Fri, 05 May 2000 13:18:18 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: unlink ( deleting file) not working
Message-Id: <7ak8h9p23p.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
nobull@mail.com writes:
> Should be:
>
> unlink("$cat/$fil") || dir "Unlink $fil: $!";
>
> Or, arguably better:
>
> use File::Spec;
> unlink(File::Spec->catfile($cat,$fil)) ||
> dir "Unlink $fil: $!";
s/dir/die/g;
of course :-)
--Ala
------------------------------
Date: Fri, 05 May 2000 14:39:11 GMT
From: "Russell England" <russ@css2.com>
Subject: urlencode?
Message-Id: <j2BQ4.3754$tQ3.396090@news3.cableinet.net>
Is there a perl equivalent of the ASP function server.urlencode()?
------------------------------
Date: Fri, 5 May 2000 07:52:01 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Variable -> filehandle / PerlMagick read from variable
Message-Id: <Pine.GSO.4.10.10005050735270.6766-100000@user2.teleport.com>
On Fri, 5 May 2000, Kim Saunders wrote:
> I have an image in a variable, (from an SQL database). I want to Read
> this with PerlMagick.
>
> Is it possible to get PerlMagick to Read from a variable instead of a
> file or filehandle??? I don't think so, it's not in any of my docs or
> books.
If it's not documented, that only makes it a greater challenge. :-) But
since the best solution in this case might be to patch PerlMagick, that
may be beyond your abilities. (But hey! give it a try.)
> How can I put my variable into a filehandle somehow, so that perlmagic
> will find load the filehandle and get the contents of the sting?
You may be able to use a tied filehandle. If that fails, a temporary file
should always work, but there ought to be a way to pass an image directly
to PerlMagick. I don't have PerlMagick installed on any handy machine at
the moment, and the PerlMagick webpage doesn't seem to list any way to do
this.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 05 May 2000 13:07:35 GMT
From: pkey@sghms.ac.uk
Subject: web browser ftp cgi script?
Message-Id: <3912c6af.17175726@news.sghms.ac.uk>
hi
anyone know of any perl CGI scripts that allow a user to FTP through a
webrowser?
i.e. the script presents an HTML form and the user enters their server
choice, username & password. The script then grabs the connection and
the web browser handles the display.
cheers
paul
------------------------------
Date: Fri, 05 May 2000 07:00:15 -0700
From: yasin <yesmail_99NOyeSPAM@yahoo.com.invalid>
Subject: WIN32::ODBC using MoreResults()
Message-Id: <1415c574.02516dc7@usw-ex0106-044.remarq.com>
Hello,
I have been using the perl win32::ODBC for two months, and it works
great, however recently I have a stored procedure that returns more
than one result set.
The first result set is fetched and everything works fine. The problem
arises when I use the MoreResult function to check for any other
existing result set after the first result set.
This returns true which is also fine however, the field names or the
column names are still the same as that of the first result set but the
actual data is of the second result set. So the data fetched is correct
but the fieldnames or column names are different.
I have been stuck on this for several weeks, therefore I would really
appreciate it if antone can shed some light on this matter.
Thanks in advance
Yasin
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
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 2959
**************************************