[22570] in Perl-Users-Digest
Perl-Users Digest, Issue: 4791 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 31 03:10:38 2003
Date: Mon, 31 Mar 2003 00:10:11 -0800 (PST)
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, 31 Mar 2003 Volume: 10 Number: 4791
Today's topics:
Re: Multiple POSTS and GETS from one perl script <tore@aursand.no>
Re: Multiple POSTS and GETS from one perl script <meanblue@rascalsdesign.biz>
Re: Multiple POSTS and GETS from one perl script <tore@aursand.no>
Re: Multiple POSTS and GETS from one perl script <meanblue@rascalsdesign.biz>
Perl & XPath <ngroups@ians-netNOSPAM.co.uk>
Re: Perl and AIM question. <goldbb2@earthlink.net>
Re: Perl and objects <tore@aursand.no>
Re: seemingly simple problem <wksmith@optonline.net>
Re: seemingly simple problem <tore@aursand.no>
Re: suid not working (David Efflandt)
Re: suid not working <me@verizon.invalid>
Re: webhosts that support perl well? <anthony@nospam.safferconsulting.com>
Why no buzz about Intel 7.0-Compiled Perl?? (Seth Brundle)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 31 Mar 2003 07:38:41 +0200
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Multiple POSTS and GETS from one perl script
Message-Id: <pan.2003.03.30.22.50.48.294565@aursand.no>
On Sun, 30 Mar 2003 18:01:51 +0100, Andrew Newlands wrote:
> I have been told about the system function, now the first argument is
> the filename of the script that you wish to run, what can I do with the
> other arguments? Is this function what I am looking for? can it be used
> to run another script while my first is being run? Can I pass data for
> varialbles in the second script?
You can pass variables to the system() function [1], but I really don't
know if it's what you're looking for. According to the documentation;
"Does exactly the same thing as "exec LIST", except that a fork is
done first, and the parent process waits for the child process to
complete."
In other words, you might like to check out the exec() [2] function
instead, or try playing around with threads [3].
However; What's the purpose of your two scripts? Having to do things the
way you request, almost always leads to problems. If you tell us what the
scripts are doing - or are supposed to do - we might help you even
further.
[1] perldoc -f system
[2] perldoc -f exec
[3] perldoc threads
--
Tore Aursand
------------------------------
Date: Mon, 31 Mar 2003 07:40:21 +0100
From: Meanblue <meanblue@rascalsdesign.biz>
Subject: Re: Multiple POSTS and GETS from one perl script
Message-Id: <tsnf8v82kjkrf3p74238i4vmgq9dptjpgc@4ax.com>
On Mon, 31 Mar 2003 07:38:41 +0200, "Tore Aursand" <tore@aursand.no>
wrote:
>On Sun, 30 Mar 2003 18:01:51 +0100, Andrew Newlands wrote:
>> I have been told about the system function, now the first argument is
>> the filename of the script that you wish to run, what can I do with the
>> other arguments? Is this function what I am looking for? can it be used
>> to run another script while my first is being run? Can I pass data for
>> varialbles in the second script?
>
>You can pass variables to the system() function [1], but I really don't
>know if it's what you're looking for. According to the documentation;
>
> "Does exactly the same thing as "exec LIST", except that a fork is
> done first, and the parent process waits for the child process to
> complete."
>
>In other words, you might like to check out the exec() [2] function
>instead, or try playing around with threads [3].
>
>However; What's the purpose of your two scripts? Having to do things the
>way you request, almost always leads to problems. If you tell us what the
>scripts are doing - or are supposed to do - we might help you even
>further.
>
>[1] perldoc -f system
>[2] perldoc -f exec
>[3] perldoc threads
My basic concern is security.
Script A takes infromation from a user, and passes this infromation to
a script B that enters the information into a database, however the
user never sees script B as script A continues to run having posted
the users data to script B and once finished forwards the user to
script C that simply confirms what has happened.
If the database activity was positioned on script C there would be a
possiblility of clever users skipping script A.
I am aware that their are other ways of achieving this arrangement and
remaining secure, however I was interested if it was possible to run
multiple scripts without leaving one main control script.
Thanks for your time,
Andrew
------------------------------
Date: Mon, 31 Mar 2003 09:23:26 +0200
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Multiple POSTS and GETS from one perl script
Message-Id: <pan.2003.03.31.07.22.32.150170@aursand.no>
On Mon, 31 Mar 2003 07:40:21 +0100, Meanblue wrote:
> Script A takes infromation from a user, and passes this infromation to a
> script B that enters the information into a database, however the user
> never sees script B as script A continues to run having posted the users
> data to script B and once finished forwards the user to script C that
> simply confirms what has happened.
>
> If the database activity was positioned on script C there would be a
> possiblility of clever users skipping script A.
If you're concerned about that, then you're doing Something (tm) wrong (or
could have done Something Else (tm) different).
One script should be able to cover all the scripts mentioned above. You
have to do the security checks no matter what. Trying to "hide" a certain
set of code, and thus thinking your solution is more secure, tends to fail
in most cases.
Why don't you just tell us _excactly_ what your script(s) is trying (or
supposed) to do? With a real-life example, it's much easier for us (at
least for me) to assist you with the ideal solution.
> I am aware that their are other ways of achieving this arrangement and
> remaining secure, however I was interested if it was possible to run
> multiple scripts without leaving one main control script.
It is.
--
Tore Aursand
------------------------------
Date: Mon, 31 Mar 2003 08:29:41 +0100
From: Meanblue <meanblue@rascalsdesign.biz>
Subject: Re: Multiple POSTS and GETS from one perl script
Message-Id: <parf8vooh4sanhn3qt3baapmdkvcmcv30p@4ax.com>
On Mon, 31 Mar 2003 09:23:26 +0200, "Tore Aursand" <tore@aursand.no>
wrote:
>On Mon, 31 Mar 2003 07:40:21 +0100, Meanblue wrote:
>> Script A takes infromation from a user, and passes this infromation to a
>> script B that enters the information into a database, however the user
>> never sees script B as script A continues to run having posted the users
>> data to script B and once finished forwards the user to script C that
>> simply confirms what has happened.
>>
>> If the database activity was positioned on script C there would be a
>> possiblility of clever users skipping script A.
>
>If you're concerned about that, then you're doing Something (tm) wrong (or
>could have done Something Else (tm) different).
>
>One script should be able to cover all the scripts mentioned above. You
>have to do the security checks no matter what. Trying to "hide" a certain
>set of code, and thus thinking your solution is more secure, tends to fail
>in most cases.
>
>Why don't you just tell us _excactly_ what your script(s) is trying (or
>supposed) to do? With a real-life example, it's much easier for us (at
>least for me) to assist you with the ideal solution.
>
>> I am aware that their are other ways of achieving this arrangement and
>> remaining secure, however I was interested if it was possible to run
>> multiple scripts without leaving one main control script.
>
>It is.
I have no script of my own that I need to perform this arrangement,
however I am working with a payment gateway that posts data to a POST
URL as well as forwarding users to a GET URL.
The POST URL alters my database as I see fit, the GET URL displays the
payment results.
For my scripts in the future I am interested to learn how I can do
this - it does seem a rather 'cleaner' way of working than that which
I use at present.
I run an online community site and each movement within the site
requires different database entries to be altered, if I could include
a way of branching off from each page so that a separate script purely
there to alter these db entries, but the continue to run the original
script alot of space would be saved! :)
------------------------------
Date: Mon, 31 Mar 2003 07:20:50 +0100
From: Ian Gregory <ngroups@ians-netNOSPAM.co.uk>
Subject: Perl & XPath
Message-Id: <b68mo0$28dl$1@godfrey.mcc.ac.uk>
Hi,
I'm trying to change parts of an XML file which are identified by an
XPath expression. I have a variable $xpath which identifies the part of
the file to be changed and $newxml which contains a textual
representation of the XML to be added at that point. I've been using the
XML::Xpath module which allows be to change the text of a node - but it
doesn't seem to have a 'setNodeXML' method?
my $xp = XML::XPath->new(xml => $xml);
print $xp->setNodeText($xpath ,$newxml);
Am I going about this the right way or is there a better way of doing
this (I use XML::LibXML elsewhere so if it can be done with that...)
Thanks in advance,
Ian
------------------------------
Date: Mon, 31 Mar 2003 00:00:52 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl and AIM question.
Message-Id: <3E87CB84.9C5793EB@earthlink.net>
PJ wrote:
>
> I have developed a basic HTML grabber that checks my favorite news
> site every 30 seconds. When if finds something cool, it emails me the
> headline.
>
> I would now like it to send IM me the headline.
>
> I have installed Net:AIM but can't figure out how to send a basic
> message.
>
> This is what I have:
>
> use Net::Aim;
Perl is case-sensitive. The module's name is Net::AIM, not Net::Aim.
The only reason that this "worked" is because your filesystem is
case-insensitive. If the module were written to export functions, this
incorrect 'use' line would have failed to import them. If you were on a
real filesystem (a case-sensitive one), then this would have failed
immediately.
Also, you are missing "use strict" and "use warnings".
> my $username = 'somename';
> my $password = 'somepassword';
> my $conn = $aim->newconn(Screenname => $username, Password =>
> $password)
> or die "Can't connect to Aim Server.\n";
Where do you initialize $aim with a new Net::AIM object?
> while(1) {
>
> if grabber finds a new headline {
> $aim->send_im('user', $headline);
> }
>
> sleep 30;
> }
>
> ### End Code
>
> So, what do I need to add or change so that it simply IMs me the
> headline?
Try this:
#!C:/somepath/ActivePerl/bin/perl -w
use strict;
use warnings;
use Net::AIM::Connection;
my $aimc = Net::AIM::Connection->new( {
Screenname => 'perlaim',
Password => 'yaddayadda',
TocServer => 'toc.oscar.aol.com',
TocPort => 80,
AuthServer => 'login.oscar.aol.com',
AuthPort => 5159,
} );
while( $aimc->connected() ) {
my $headline = get_next_news_header();
if( !$headline ) { sleep 30; next }
$aimc->send_im( "user", $headline );
}
# define sub get_next_news_header here.
__END__
[untested]
Actually, though, this will probably eventually block (it *may* even
cause the server to eventually block!), due to your never reading from
the socket. Try writing the loop as:
my $sel = $aimc->{_select};
while( 1 ) {
if( my $headline = get_next_news_header() ) {
$aimc->send_im( "user", $headline );
}
$aimc->read_and_parse() while $sel->can_read(0);
$aimc->read_and_parse() if $sel->can_read(30);
}
[also untested]
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Mon, 31 Mar 2003 08:35:03 +0200
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Perl and objects
Message-Id: <pan.2003.03.31.06.01.45.618156@aursand.no>
On Sun, 30 Mar 2003 18:20:08 -0600, Joe Creaney wrote:
> Yes I am very confused.
So am I, 'cause you're top-posting. Please don't do that.
> I have been trying to read up on it but don't realy get what they are
> trying to say.
What is it that you don't understand in 'perltoot'? Maybe you should head
out and buy the excellent "Object Oriented Perl" (by Damian Conway)?
--
Tore Aursand
------------------------------
Date: Mon, 31 Mar 2003 05:08:59 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: seemingly simple problem
Message-Id: <L3Qha.815$%U1.373897@news4.srv.hcvlny.cv.net>
"Jan Snajder" <jsnajder@inet.hr> wrote in message
news:5d736387.0303301217.529e5dba@posting.google.com...
--snip--
> I need a script that will convert all pathnames contained within a
> file into pathnames with uppercase.
>
--snip example--
>
> I've just spent 3 hours trying to figure out how to do it...
> It seems so simple :)
>
Were you unable to match the pathnames or were you unable to convert the
match to upper case? I will assume that your problem is with the
conversion. The regular expression in the following script does a
rather crude job of matching pathnames. It will process any substring
which starts with a slash and consists of letters, numbers, periods and
slashes. This string is replaced by a call to the uc function on that
string. The /e option tells perl to execute that function. Refer to the
/e option of S/PATTERN/REPLACEMENT/ in perldoc perlop.
Note: I added a leading slash to the pathname in your example. If this
is not appropriate, you must fix the regex. You really should change it
anyway to more accurately reflect pathnames in your operating system.
use strict;
use warnings;
while (<DATA>){
s!(/[\w/.]+)!uc($1)!e;
print;
}
__END__
blah blah /../../Installer/SystemFiles blah blah
Good Luck,
Bill
------------------------------
Date: Mon, 31 Mar 2003 07:38:41 +0200
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: seemingly simple problem
Message-Id: <pan.2003.03.30.22.56.05.820865@aursand.no>
On Sun, 30 Mar 2003 12:17:52 -0800, Jan Snajder wrote:
> I am new to Perl, to this will be a silly question for most of you guys.
Please put the subject of your message in the Subject.
> I need a script that will convert all pathnames contained within a file
> into pathnames with uppercase.
perldoc -f uc
> For example, a line within a file containing "blah blah
> ../../Installer/SystemFiles blah blah" shall be converted to
> "blah blah ../../INSTALLER/SYSTEMFILES blah blah".
If you have other data than the string stored in your scalar, you have to
find a way to extract the path only. For example;
my $path = 'Application is in /usr/bin or /usr/local/bin';
You could of course use some nifty regular expression to extract the paths
from the string above, but do you really want to do that? You have to
check for those /'es, but what about Win32 platforms (or other platforms
which uses other characters as path delimiter)?
You might want to reconsider your solution to make it store the path
_only_.
--
Tore Aursand
------------------------------
Date: Mon, 31 Mar 2003 03:08:33 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: suid not working
Message-Id: <slrnb8fc9h.qr5.efflandt@typhoon.xnet.com>
On Sun, 30 Mar 2003, Phil Langerholc <root@localhost.spam.me.not> wrote:
> Here are my permissions settings
>
> kenny:/usr/local/bin# ls -l suidtest.pl
> -rwsr-xr-x 1 root system 350 Mar 29 16:35 suidtest.pl
>
> As you can see they are 4755, and the script still gives the results I have
> indicated below. I'm wondering if this has something to do with the way IBM
> compiled Perl when they shipped it with AIX....
Yes, but what are permissions of 'suidperl'? If that is not suid root
then the perl -U switch is not going to work. Note from 'perldoc
perlsec':
Prior to release 5.6.1 of Perl, bugs in the code of suidperl
could introduce a security hole.
--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Mon, 31 Mar 2003 03:40:24 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: suid not working
Message-Id: <IMOha.1452$tr2.1003@nwrdny03.gnilink.net>
"David Efflandt" <efflandt@xnet.com> wrote in message
news:slrnb8fc9h.qr5.efflandt@typhoon.xnet.com...
> On Sun, 30 Mar 2003, Phil Langerholc <root@localhost.spam.me.not> wrote:
> > Here are my permissions settings
> >
> > kenny:/usr/local/bin# ls -l suidtest.pl
> > -rwsr-xr-x 1 root system 350 Mar 29 16:35 suidtest.pl
> >
> > As you can see they are 4755, and the script still gives the results I
have
> > indicated below. I'm wondering if this has something to do with the way
IBM
> > compiled Perl when they shipped it with AIX....
>
> Yes, but what are permissions of 'suidperl'? If that is not suid root
> then the perl -U switch is not going to work. Note from 'perldoc
> perlsec':
>
> Prior to release 5.6.1 of Perl, bugs in the code of suidperl
> could introduce a security hole.
>
I've been on one system that disallowed suid programs from remote file
systems like NFS. Another system restricted setuid scripts (compiled
programs were fine, just not scripts).
Could this be the problem?
I think both of these were simply settings in a config file.
dw
------------------------------
Date: Sun, 30 Mar 2003 20:13:51 -0600
From: "Anthony Saffer" <anthony@nospam.safferconsulting.com>
Subject: Re: webhosts that support perl well?
Message-Id: <3e87a4e4_2@nntp2.nac.net>
> anyway, if anyone has a couple hosts they like to use, that support
> custom perl scripts in user cgi-bin, and hopefully other common
> features like .htaccess for specific password protection, please post
> their URL so I can go check them out....
Personally, I use Sun Networks at http://www.sun-network.com for hosting and
they seemt o be pretty good. Over the past 6 months we've not been down at
all and they support Perl, PHP, ASP, and all of the .NET stuff. They also
offer MySQL and support for MS Access if that's your taste. One of the
really big plusses for us is that they are willing to install modules they
don't already have if you supply them with it. They offer email, etc.
Everything you'd expect from a standard webhost. All for about $7 a month
for 100 MB space. Definately worth checking out.
Good Luck,
Anthony Saffer [Founder and CEO]
SCS Consulting Services
Professional Web Application, MySQL & PC Software Development
Rates Starting at only $35 USD Per Hour!
Authorized MySQL Partner!
www.safferconsulting.com
------------------------------
Date: 30 Mar 2003 18:10:21 -0800
From: brundlefly76@hotmail.com (Seth Brundle)
Subject: Why no buzz about Intel 7.0-Compiled Perl??
Message-Id: <53e2ec95.0303301810.7fbe6297@posting.google.com>
I posted earlier this month about seeing a +21% increase in perlbench
when compiling Perl with the new Intel 7.0 Compiler for Linux vs. gcc.
But I havent heard one other piece of buzz about the Intel Compiler in
this forum or people's experience with it. Isnt anyone interested in a
free 21% performance increase???
Here's the link to the free download ( i used the noncommercial
version):
http://www.intel.com/software/products/global/eval.htm
Anyways, I was hoping that someone else would want to take a crack at
figuring out why Errno doesnt compile with the Intel compiler. There
is no descriptive error message. Anyways, the perl still works for me
and everything else compiles fine....
------------------------------
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.
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 4791
***************************************