[25370] in Perl-Users-Digest
Perl-Users Digest, Issue: 7615 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 6 18:05:32 2005
Date: Thu, 6 Jan 2005 15:05:12 -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 Thu, 6 Jan 2005 Volume: 10 Number: 7615
Today's topics:
"Make" Does Not Respond in Perl to Install LIBWWW <>
Re: "Make" Does Not Respond in Perl to Install LIBWWW <tony_curtis32@yahoo.com>
Re: "Make" Does Not Respond in Perl to Install LIBWWW <mritty@gmail.com>
Re: "Make" Does Not Respond in Perl to Install LIBWWW <>
Re: "Make" Does Not Respond in Perl to Install LIBWWW <>
Re: "Make" Does Not Respond in Perl to Install LIBWWW <1usa@llenroc.ude.invalid>
Re: Advice please on stripping non-printing characters (Anno Siegel)
Re: backup utility for remote hosts <botfood@yahoo.com>
checking at runtime if modul is installed <nnospam@fronti.org>
Re: checking at runtime if modul is installed <spamtrap@dot-app.org>
Having Trouble with a CGI script login WhiteFungus@gmail.com
Re: Having Trouble with a CGI script login <mritty@gmail.com>
Re: Multiple lines of html store in variable non messy <Juha.Laiho@iki.fi>
Re: Multiple lines of html store in variable non messy ioneabu@yahoo.com
Re: Multiple lines of html store in variable non messy <spamtrap@dot-app.org>
Re: Net::SSH::Perl - remoteinteract.pl -> Solution <news@chaos-net.de>
Re: Newbie Question <1usa@llenroc.ude.invalid>
Protection of tied files <jkrugman345@yahbitoo.com>
Re: Protection of tied files (Anno Siegel)
Re: Protection of tied files xhoster@gmail.com
Re: specifying use strict <carlton_gregory@yahoo.com>
Re: Trouble with returning data from recursive sub <sabio62@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 06 Jan 2005 15:10:40 -0600
From: mary <>
Subject: "Make" Does Not Respond in Perl to Install LIBWWW
Message-Id: <vv9rt0pev16njn5bkjvprhkp792t1krppv@4ax.com>
Well,
I need to have the library " libwww" installed on my
apache server. I need to execute the following:
perl makefile.pl
make
make test
make install
I get that "make" is not a "recognized command".
Where is "make". And what should I do?
Thanks a million.
mary
------------------------------
Date: Thu, 06 Jan 2005 14:15:02 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: "Make" Does Not Respond in Perl to Install LIBWWW
Message-Id: <87sm5ejovt.fsf@limey.hpcc.uh.edu>
>> On Thu, 06 Jan 2005 15:10:40 -0600,
>> mary <> said:
> Well, I need to have the library " libwww" installed on my
> apache server. I need to execute the following:
> perl makefile.pl make make test make install
> I get that "make" is not a "recognized command". Where is
> "make". And what should I do? Thanks a million.
What you need to do depends primarily on the OS. So what kind
of box is it?
t
------------------------------
Date: Thu, 06 Jan 2005 20:16:43 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: "Make" Does Not Respond in Perl to Install LIBWWW
Message-Id: <L0hDd.17428$Y57.6146@trnddc08>
<mary> wrote in message
news:vv9rt0pev16njn5bkjvprhkp792t1krppv@4ax.com...
> Well,
> I need to have the library " libwww" installed on my
> apache server. I need to execute the following:
>
> perl makefile.pl
> make
> make test
> make install
>
> I get that "make" is not a "recognized command".
> Where is "make". And what should I do?
> Thanks a million.
make is a standard unix command. The 'recognized command' error sounds
suspciously like a Windows response. Is this correct? A google search
for "make for windows" should direct you to the windows alternative,
'nmake'. This is the program you need to install perl modules in place
of the standard unix 'make' program.
Paul Lalli
------------------------------
Date: Thu, 06 Jan 2005 15:18:42 -0600
From: mary <>
Subject: Re: "Make" Does Not Respond in Perl to Install LIBWWW
Message-Id: <9oart0d5ojolld3rnqss2grhmsnnt8j6k3@4ax.com>
On Thu, 06 Jan 2005 14:15:02 -0600, Tony Curtis
<tony_curtis32@yahoo.com> wrote:
>>> On Thu, 06 Jan 2005 15:10:40 -0600,
>>> mary <> said:
>
>> Well, I need to have the library " libwww" installed on my
>> apache server. I need to execute the following:
>
>> perl makefile.pl make make test make install
>
>> I get that "make" is not a "recognized command". Where is
>> "make". And what should I do? Thanks a million.
>
>What you need to do depends primarily on the OS. So what kind
>of box is it?
>
>t
Tony,
I have the Apache server with Windows XP.
Thanks!
mary
------------------------------
Date: Thu, 06 Jan 2005 15:29:11 -0600
From: mary <>
Subject: Re: "Make" Does Not Respond in Perl to Install LIBWWW
Message-Id: <1cbrt0dheqn85jmpaj9127ptqei7sng2c8@4ax.com>
Thank you, Paul.
Nmake is already up here.
With best regards,
mary
On Thu, 06 Jan 2005 20:16:43 GMT, "Paul Lalli" <mritty@gmail.com>
wrote:
><mary> wrote in message
>news:vv9rt0pev16njn5bkjvprhkp792t1krppv@4ax.com...
>> Well,
>> I need to have the library " libwww" installed on my
>> apache server. I need to execute the following:
>>
>> perl makefile.pl
>> make
>> make test
>> make install
>>
>> I get that "make" is not a "recognized command".
>> Where is "make". And what should I do?
>> Thanks a million.
>
>make is a standard unix command. The 'recognized command' error sounds
>suspciously like a Windows response. Is this correct? A google search
>for "make for windows" should direct you to the windows alternative,
>'nmake'. This is the program you need to install perl modules in place
>of the standard unix 'make' program.
>
>Paul Lalli
------------------------------
Date: 6 Jan 2005 20:43:31 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: "Make" Does Not Respond in Perl to Install LIBWWW
Message-Id: <Xns95D69FF9FB8D3asu1cornelledu@132.236.56.8>
mary <> wrote in news:9oart0d5ojolld3rnqss2grhmsnnt8j6k3@4ax.com:
> On Thu, 06 Jan 2005 14:15:02 -0600, Tony Curtis
> <tony_curtis32@yahoo.com> wrote:
>
>>>> On Thu, 06 Jan 2005 15:10:40 -0600,
>>>> mary <> said:
>>
>>> Well, I need to have the library " libwww" installed on my
>>> apache server. I need to execute the following:
>>
>>> perl makefile.pl make make test make install
>>
>>> I get that "make" is not a "recognized command". Where is
>>> "make". And what should I do? Thanks a million.
>>
>>What you need to do depends primarily on the OS. So what kind
>>of box is it?
>>
>>t
>
> Tony,
>
> I have the Apache server with Windows XP.
Whose Perl distribution are you using? If it is ActiveState, use ppm to
install packages.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: 6 Jan 2005 20:39:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Advice please on stripping non-printing characters
Message-Id: <crk7lb$7rm$1@mamenchi.zrz.TU-Berlin.DE>
J Taylor <no@spam.please> wrote in comp.lang.perl.misc:
> Hi!
>
> I've seen various examples of stripping non-printing (and non-ascii)
> chars from a string with something like this:
>
> $string =~ s/[\000-\037]/ /g;
If you're going to use explicit character codes, you might as well use
$string =~ tr/\0-\037/ /; # untested
> I've chosen to strip all but the printable ascii chars (using hex):
>
> $string =~ s/[^\x20-\x7f]/ /g;
$string =~ tr/\x20-\x7f/ /c;
> This *seems* to work better for my purposes, I'm wondering though if are
> gotchas I'm missing.
What gotchas? The difference is obvious, and if that's what you want
"nonprinting character" to mean, who's going to stop you?
The approach has the disadvantage that it is hard to adapt to non-ascii
alphabets. POSIX character classes are locale-sensitive, so
$string =~ s/[[:print:]]/ /g;
has better chances. There is also a Unicode equivalent (see perlre).
Anno
------------------------------
Date: 6 Jan 2005 12:48:35 -0800
From: "botfood" <botfood@yahoo.com>
Subject: Re: backup utility for remote hosts
Message-Id: <1105044515.535713.193030@f14g2000cwb.googlegroups.com>
...I recently found a bug in this code (in addition to the style
critiques). Turns out that I was not calling the type() method
correctly when switching between ascii and binary modes. After some
testing and further research, the *better* solution is to call the
ascii() and binary() methods to send the correct TYPE command to the
FTP server.
so, the section of code that switches modes might better be coded as:
unless ( $LastType eq $CurrType) {
print "\t\t changing type to $CurrType \n";
print STDERR "\t\t changing type to $CurrType \n" if ($cDEBUG eq
'verbose') ;
if ( $CurrType eq 'ascii' ) {
$ftp->ascii();
} else {
$ftp->binary();
}
$LastType = $CurrType ;
}
------------------------------
Date: Thu, 06 Jan 2005 19:34:52 GMT
From: "Sam" <nnospam@fronti.org>
Subject: checking at runtime if modul is installed
Message-Id: <wpgDd.128766$AL5.100487@twister.nyroc.rr.com>
Hello,
is there a way to check if a modul is available and if so then to use it
I want to do
use Time:HiRes qw (time);
if possible; but it should also run if that is not available.
Thanks,
Sam
------------------------------
Date: Thu, 06 Jan 2005 17:04:56 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: checking at runtime if modul is installed
Message-Id: <nqudnbhIg-6UK0DcRVn-1w@adelphia.com>
Sam wrote:
> is there a way to check if a modul is available and if so then to use it
> I want to do
>
> use Time:HiRes qw (time);
>
> if possible; but it should also run if that is not available.
Wrap it up in an eval() and check for errors. Be sure to put the eval()
in a BEGIN block so it happens at compile time, like use() normally does.
BEGIN {
unless (eval "use Time::HiRes qw(time)") {
warn "Couldn't load Time::HiRes: $@";
}
}
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 6 Jan 2005 12:15:47 -0800
From: WhiteFungus@gmail.com
Subject: Having Trouble with a CGI script login
Message-Id: <1105042547.949164.230940@z14g2000cwz.googlegroups.com>
I am trying to script a program to autologin for me with the following
HTML code data. Although for some reason I can not seem to be able to
fill the password field properly with WWW::Mechanize. Is the some
hidden jewel of syntax structure I am not yet aware of? Any help
concerning this issue would be much appreciated! :)
-Thanks in advance.
_______________________________________________________________
#!usr/bin/perl
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
my $mech = WWW::Mechanize->new();
my $formfiller = WWW::Mechanize::FormFiller->new();
my $username = "user_name";
my $password = "password";
my $url = "http://www.myurl.com/default.aspx";
# Grab the home page, and click the login button to redirect to the
correct page(HTML listed below).
$mech->get($url);
$mech->click_button(number => 1);
# Set the username and password fields accordingly and submit.
$mech->set_visible( $username, [password => $password] ) ;
$mech->submit();
# Store new HTML content in a temporary file and open it for viewing.
$html = $mech->content();
open (OUT,">tmp.html");
print OUT $html;
close (OUT);
system("tmp.html");
_______________________________________________________________
<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#FFFFFF">
<form id="frmLogin" name="frmLogin" method="post"
action="Login.aspx?__ufps=933290">
<input type="hidden" name="__VIEWSTATE"
value="aDxfX1A7QDw716znrKftnYTgo4csMTs+Oz6urRmZvy6aJZj20y+gGEkgSS1/NA==">
<input type="hidden" name="__EVENTTARGET" value="">
<input type="hidden" name="__EVENTARGUMENT" value="">
<script language=javascript><!--
function __doPostBack(target, argument){
var theform = document.frmLogin
theform.__EVENTTARGET.value = target
theform.__EVENTARGUMENT.value = argument
theform.submit()
}
// -->
</script>
<font size="-1" color="Black">Authorized users, please enter your
trading user ID and password:<br>
Please enter your user ID:<br>
<input name="txtUID" size="32"/><br>
Please enter your password:<br>
<input name="txtPWD" size="32" type="password"/><br>
<input name="cmdGo" type="image" src="Brand/00/go.gif" alt="Go"/><br>
<input name="cmdHomeFromfrmLogin" type="image" src="Brand/00/home.gif"
alt="Home"/></font></form></body></html>
_______________________________________________________________
------------------------------
Date: Thu, 06 Jan 2005 20:21:43 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Having Trouble with a CGI script login
Message-Id: <r5hDd.17429$Y57.11755@trnddc08>
<WhiteFungus@gmail.com> wrote in message
news:1105042547.949164.230940@z14g2000cwz.googlegroups.com...
<snip post identical to
1104951990.067980.17290@z14g2000cwz.googlegroups.com >
Why did you start a new thread? Your last response in the other thread
indicated you'd solved your problem. If this is not the case, you
should continue the original thread. Please don't start another for no
reason.
Paul Lalli
------------------------------
Date: Thu, 6 Jan 2005 19:04:44 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Multiple lines of html store in variable non messy way
Message-Id: <crk24c$i5u$1@ichaos.ichaos-int>
"daveyand" <andrew.davey@gmail.com> said:
>fixed it, turns out and i didnt know this, but the EndOfHTML needs to
>be not indented.
Please, read the perlfaq entry on here documents;
perldoc -q "here document"
The formal documentation is in perlop documentation page
perldoc perlop
... and search for the second occurrence of <<EOF
(yes, clumsy).
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: 6 Jan 2005 12:20:17 -0800
From: ioneabu@yahoo.com
Subject: Re: Multiple lines of html store in variable non messy way
Message-Id: <1105042817.850498.274020@c13g2000cwb.googlegroups.com>
Would this be approach be mostly instead of using CGI.pm functions? I
guess if you are not dealing with forms, using CGI.pm functions in a
Perl program is just like embedding HTML in Perl code.
So you could find a format you like at a site and copy the source,
modify it, and make it into your own template using Text;:Template?
That's pretty cool.
Thanks for the tip
wana
------------------------------
Date: Thu, 06 Jan 2005 16:56:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Multiple lines of html store in variable non messy way
Message-Id: <182dnTWrG9-AKUDcRVn-tQ@adelphia.com>
ioneabu@yahoo.com wrote:
> Would this be approach be mostly instead of using CGI.pm functions? I
> guess if you are not dealing with forms, using CGI.pm functions in a
> Perl program is just like embedding HTML in Perl code.
Mostly, yes. There is one major exception though - HTML form elements.
CGI.pm has some great methods for creating new form elements that take
their default values from the incoming query. One of the most popular
uses for that is error-checking forms, where if there is a problem with
the input it one field, the same form comes back with that field
highlighted, and the others already filled out with the input you provided.
Even in that instance though, I'd most often use a template for the
surrounding page, with placeholders where the generated form elements
are to be placed.
> So you could find a format you like at a site and copy the source,
> modify it, and make it into your own template using Text;:Template?
Sure, you could do that. More to the point though, if you're working
with a designer, he can work on the HTML while you're working on the
logic. Or if you want to expand your team even further, you can have a
content developer working with strictly structured markup, a designer
styling it with CSS, and a programmer working on the logic.
Obviously there needs to be *some* coordination between the members of
the team above, but having everything in separate files gives a *lot*
more flexibility than you'd have with everything bundled up in your Perl
code. It's really a necessity, not a luxury once you start working on
bigger sites.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 6 Jan 2005 20:39:20 GMT
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Net::SSH::Perl - remoteinteract.pl -> Solution
Message-Id: <slrnctr8fo.dgm.news@saturn.maki.dom>
Finally I found the solution.
Thank you very much, A. Sinan Unur.
The excessive use of print statements (which you recommended) got me on the way.
instead of
use constant NEWPASS => 'newpass';
use constant OLDPASS => 'oldpass';
I had to do
use constant NEWPASS => "newpass\n";
use constant OLDPASS => "oldpass\n";
use constant PASS => 'oldpass';
I also found that
elsif ($str =~ /^New password:/) {
and
elsif ($str =~ /^Retype new password:/) {
matched only without the '^' althoug /^Old password:/ did match
Next step will be, to try remote interaction on my cisco router.
Thanks again for the help.
------------------------------
Date: 6 Jan 2005 21:00:40 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Newbie Question
Message-Id: <Xns95D6A2E21E0EBasu1cornelledu@132.236.56.8>
"John D. Sanders" <johnsanders@lovinthelord.org> wrote in
news:RUjCd.11$N33.31076@news.uswest.net:
> ioneabu@yahoo.com wrote:
>> I entered your script on my server and it appears to work. Browser
>> output:
>>
>> Mon Jan 3 17:41:08 2005
>>
>> wana
>>
> Do you have any ideas why id does not on mine when other Perl scripts
> work?
Because you cannot make s**t up and expect it to work!
You wrote:
"John D. Sanders" <johnsanders@lovinthelord.org> wrote in
news:7qjCd.28$od2.19958@news.uswest.net:
> I have an Apache Web Server running and I want to use Perl as my CGI
> language.
>
> I have Matt's FormMail script running properly but when I try to
> implement my own scripts I get an error.
>
> The script I am using for testing:
> #! /usr/bin/perl
>
> use warnings;
> use strict;
>
> print "content-type: text/html\n\n";
That is not correct.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: Thu, 6 Jan 2005 20:52:51 +0000 (UTC)
From: J Krugman <jkrugman345@yahbitoo.com>
Subject: Protection of tied files
Message-Id: <crk8f3$doa$1@reader1.panix.com>
Suppose that I have a Perl variable tied to some file. Does Perl
provide any facilities for preventing some other program from
modifying this file, and/or for detecting if such modification
happens? (I'm only interested in the UNIX case).
TIA!
jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
------------------------------
Date: 6 Jan 2005 21:15:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Protection of tied files
Message-Id: <crk9q6$93n$1@mamenchi.zrz.TU-Berlin.DE>
J Krugman <jkrugman345@yahbitoo.com> wrote in comp.lang.perl.misc:
>
>
>
>
> Suppose that I have a Perl variable tied to some file. Does Perl
> provide any facilities for preventing some other program from
> modifying this file, and/or for detecting if such modification
> happens? (I'm only interested in the UNIX case).
That is really a question about Unix then. Perl can only offer services
that are supported by the OS.
The answer is no. There is no way to stop a process with sufficient
permissions to change a file. There may be implementations of mandatory
locking, but that's not standard.
Neither is there a reliable means of checking if the file was changed.
The one-second resolution of file times is too coarse to be sure. The
only way is to keep a copy and compare.
All this is quite independent of the possibility that some Perl program
could have decided to tie a variable (in what sense?) to the file.
The usual solution is to set file permissions so that only collaborating
users (normally just one) have access, and use (advisory) file locking
for access control. That can be made watertight.
Anno
------------------------------
Date: 06 Jan 2005 21:26:01 GMT
From: xhoster@gmail.com
Subject: Re: Protection of tied files
Message-Id: <20050106162601.581$tG@newsreader.com>
J Krugman <jkrugman345@yahbitoo.com> wrote:
> Suppose that I have a Perl variable tied to some file. Does Perl
> provide any facilities for preventing some other program from
> modifying this file, and/or for detecting if such modification
> happens? (I'm only interested in the UNIX case).
>
> TIA!
You could unlink the filename which the variable is tied to, so that the
only remaining link to the file inode is the one held by the perl program.
That should stop all but the most dedicated superusers from messing with
it. This still leaves a brief period in which someone could grab the file,
so to be even safer, you should avoid ever creating the filename entry in
the filesystem in the first place.
perldoc -f open:
As a special case the 3 arg form with a read/write mode and the
third argument being "undef":
open(TMP, "+>", undef) or die ...
opens a filehandle to an anonymous temporary file.
Of course doing this means that the filedata will be lost as soon as your
program exits, so I hope that that is OK with you.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 6 Jan 2005 14:21:56 -0800
From: "g3000" <carlton_gregory@yahoo.com>
Subject: Re: specifying use strict
Message-Id: <1105050116.332750.202290@z14g2000cwz.googlegroups.com>
point was is that it was installed but perl was saying it was not
there.
the problem is resolved now.
------------------------------
Date: 6 Jan 2005 14:06:03 -0800
From: "sabio62" <sabio62@yahoo.com>
Subject: Re: Trouble with returning data from recursive sub
Message-Id: <1105049162.993638.250920@f14g2000cwb.googlegroups.com>
G'Day Eric,
I tried your recommendation
my $found_handle = new Tree::MultiNode::Handle($handle);
and commented out
# $found_handle=$handle;
That works fine.
Sorry, I should have looked at the manual properly.
Thank you * 1000 ;-)
PS: previous reply posters ... *really*? <grin>
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7615
***************************************