[19177] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1372 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 24 18:10:35 2001

Date: Tue, 24 Jul 2001 15:10:15 -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: <996012615-v10-i1372@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 24 Jul 2001     Volume: 10 Number: 1372

Today's topics:
    Re: Need Perl User Login Source code <pne-news-20010724@newton.digitalspace.net>
    Re: Need Perl User Login Source code <jeff@vpservices.com>
    Re: Newbie problem: if(<STDIN> =~ /^[yY]/) control stru <pne-news-20010724@newton.digitalspace.net>
    Re: Newbie problem: if(<STDIN> =~ /^[yY]/) control stru <bart.lateur@skynet.be>
    Re: Newbie problem: if(<STDIN> =~ /^[yY]/) control stru (remove the obvious)
    Re: newbie question about arrays <myself@hi.i.com>
        Perl and Apache? <bcoon@sequenom.com>
    Re: Perl and Apache? <curtish@ourtownusa.net>
        PERL/CGI script_implementation of UserAgent (Nipa)
        Regular Expression Reduction (Moonshiner)
    Re: scope for recursive sub (Abigail)
    Re: Screen Resolution (Abigail)
    Re: single user mode? (Abigail)
    Re: sizes of strings in Activeperl ? <krahnj@acm.org>
    Re: sizes of strings in Activeperl ? <bart.lateur@skynet.be>
    Re: Sorting an array of strings by 'closeness' to anoth (Abigail)
    Re: Splitting Peculiar HTML (Alexis Machin)
    Re: Splitting Peculiar HTML <godzilla@stomp.stomp.tokyo>
    Re: The wonderful world of SSH <rsherman@ce.gatech.edu>
        use of unintialized value  <mkonrad@syr.edu>
    Re: use of unintialized value <jeff@vpservices.com>
    Re: use of unintialized value <jeff@vpservices.com>
    Re: use of unintialized value <mkonrad@syr.edu>
    Re: use of unintialized value <jeff@vpservices.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 24 Jul 2001 22:17:04 +0200
From: Philip Newton <pne-news-20010724@newton.digitalspace.net>
Subject: Re: Need Perl User Login Source code
Message-Id: <iplrlt0v2rtgcn9dckgnhtvhdvg2f5ursq@4ax.com>

[alt.perl snipped]

On Tue, 24 Jul 2001 10:51:44 +0200, Tassilo von Parseval
<Tassilo.Parseval@post.rwth-aachen.de> wrote:

> Swim Boy wrote:
> 
> >Hello I need user login, password authentication source
> >via html pages
>
> You need that, eh? You don't expect us to write that for you, do you?

Maybe he wants us to send him our rate cards?

> >1) interacting with flat ascii file
>
> perldoc -f open etc.

Possibly also DBD::CSV, Text::CSV_XS, and/or Text::ParseWords.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: Tue, 24 Jul 2001 13:17:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Need Perl User Login Source code
Message-Id: <3B5DD7E1.BD552832@vpservices.com>

Philip Newton wrote:
> 
> On Tue, 24 Jul 2001 10:51:44 +0200, Tassilo von Parseval
> <Tassilo.Parseval@post.rwth-aachen.de> wrote:
> 
> > Swim Boy wrote:
> >
> > >1) interacting with flat ascii file
> >

[snipped line reinserted: 2) interacting with mysql database]

> > perldoc -f open etc.
> 
> Possibly also DBD::CSV, Text::CSV_XS, and/or Text::ParseWords.

Or, since this invloves both flatfile and a DBI database, DBD::AnyData
(formerly called DBD::RAM) which handles both the flatfile and the
MySQL.

-- 
Jeff



------------------------------

Date: Tue, 24 Jul 2001 22:24:42 +0200
From: Philip Newton <pne-news-20010724@newton.digitalspace.net>
Subject: Re: Newbie problem: if(<STDIN> =~ /^[yY]/) control structure returns true if i type y-How
Message-Id: <e8mrlt8obki98jvc5h9foq67rfg8m6kua2@4ax.com>

On 24 Jul 2001 07:12:37 -0700, prabuanand@excite.com (prabu) wrote:

> " if (<STDIN>=~ /[^yY]/) "

Do you mean /[^yY]/ or /^[yY]/ ? Your subject says one thing and your
text another. They mean two different things to Perl, since ^ acts
differently depending on whether it's inside or outside a character
class.

Maybe this already provides the answer to your question.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


------------------------------

Date: Tue, 24 Jul 2001 20:25:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Newbie problem: if(<STDIN> =~ /^[yY]/) control structure returns true if i type y-How
Message-Id: <ndmrlt0rutfc8c2uknu4ms76d83ojllf7g@4ax.com>

prabu wrote:

>Then in pg 85 i foud the above control structure
>" if (<STDIN>=~ /[^yY]/) "
>returns true as return value if i type anything starting with y or Y.

"starting"? That's not relevant. You're asking for anything that is not
"Y" or "y". For example, a newline. Er... that's it. You press Return,
or perl won't continue.

>From my earlier understanding "^" means negation operator.So how come
>looking(seraching) for a non yY character in my <STDIN> returns true
>if i type yY.

The end of line character. That is not "y" or "Y".

-- 
	Bart.


------------------------------

Date: Tue, 24 Jul 2001 20:34:00 GMT
From: "--Rick" <no_trick@my-de(remove the obvious)ja.com>
Subject: Re: Newbie problem: if(<STDIN> =~ /^[yY]/) control structure returns true if i type y-How
Message-Id: <YYk77.5308$LP2.546080@bgtnsc06-news.ops.worldnet.att.net>


| prabu (prabuanand@excite.com) wrote:
| : I'm a perl newbie.I'm using llama book to learn.In the perl regular
| : expressions unit i learnt that "^" is a negation operator.--pg.79 in
| : 2nd edition
|
| More specifically, as the first character inside a character class
| specifier, it negates that class.
|
| : Then in pg 85 i found the above control structure
| : " if (<STDIN>=~ /[^yY]/) "

: if(<STDIN> =~ /^[yY]/)    ## pasted from the subject line

If you use the top expression from your post, then ^ means negated
character class.

If you use the expression I pasted from the subject line of your post,
then ^ means the start of the string.

--
--Rick




------------------------------

Date: Tue, 24 Jul 2001 19:44:14 +0100
From: "$@" <myself@hi.i.com>
Subject: Re: newbie question about arrays
Message-Id: <9jkf7v$te1$1@news6.svr.pol.co.uk>

Pffftt!

Look, I can do the same in 5 lines, that must mean I'm 70% better than
Godzilla...


#!/usr/local/bin/perl

my @ip=qw(123.123 123.234 123.345 123.456);
my @data=("234.123 Lucy Lawless","123.234 Susan Anton","123.456 Joan Of
Arc");

for(@data){
  print "$_\n" if(index("@ip",substr($_,0,index($_," ")))>-1);
}





------------------------------

Date: Tue, 24 Jul 2001 13:57:25 -0700
From: BCC <bcoon@sequenom.com>
Subject: Perl and Apache?
Message-Id: <3B5DE135.A83F5415@sequenom.com>

My apologies for a slightly off topic question...
To use mod_perl, I just need to install the perl Apache module,
recompile apache and install? I think this patches apache with mod_perl
support...

Also what is the best book to learn about mod_perl?

Thanks!
Bryan

P.S.  I had heard that Apache 1.3.xx already has mod_perl included.  Is
that true?


------------------------------

Date: Tue, 24 Jul 2001 16:44:12 -0500
From: "Curtis Hawthorne" <curtish@ourtownusa.net>
Subject: Re: Perl and Apache?
Message-Id: <C%l77.14069$fo2.2499@newsfeed.slurp.net>

mod_perl can either be compiled into Apache when you first build it from
sources, or it can be loaded as a module.  Using it as a module is the
easier route if you already have Apache installed, and especially if your
distribution came with the mod_perl module.  The best place to find out more
about mod_perl is http://perl.apache.org/.  The mod_perl to CGI doc
(http://perl.apache.org/dist/cgi_to_mod_perl.html) and the mod_perl FAQ
(http://perl.apache.org/faq/) are good places to start.

Curtis H.

"BCC" <bcoon@sequenom.com> wrote in message
news:3B5DE135.A83F5415@sequenom.com...
> My apologies for a slightly off topic question...
> To use mod_perl, I just need to install the perl Apache module,
> recompile apache and install? I think this patches apache with mod_perl
> support...
>
> Also what is the best book to learn about mod_perl?
>
> Thanks!
> Bryan
>
> P.S.  I had heard that Apache 1.3.xx already has mod_perl included.  Is
> that true?




------------------------------

Date: 24 Jul 2001 12:31:07 -0700
From: npatel@webley.com (Nipa)
Subject: PERL/CGI script_implementation of UserAgent
Message-Id: <24d1a4c3.0107241131.640ea4a9@posting.google.com>

Hello,

I have a question about scripting of a user agent. I have absolutly no
idea on how to go about doing this.

Let me eloborate more:
here's the scenario: ( it is related to SIP)

I have a web page that acts as a form. The user comes to site and
types his/her sip url and clicks on submit button. My perl/cgi script
would take that sip url and dial the number indicated in sip url.

sip url looks soomthing like this: 
"sip: username@host" (for example : "sip:4445556666@207.25.7.130")

Now my script would parse the query string(which would have sip url)
and get the phone number( the username part shown above ).

So far I kind of know how to do that. BUT the problem is that I would
need to write a script that would act as a user agent and would call
that number.(the phone should actually ring :)  :)    )

Some one earlier suggested that I should use LWA::UserAgent.
But I am not sure what does that do?

Would somebody please provide me with some insight on this issue. I
really need help with this? I would really appriciate any kind of
help, hints, comments, concerns.


Thanks


------------------------------

Date: 24 Jul 2001 12:38:39 -0700
From: douglas.neufeld@cisf.af.mil (Moonshiner)
Subject: Regular Expression Reduction
Message-Id: <fdda4b64.0107241138.2dfd89af@posting.google.com>

I am looking for anything to help me reduce the size of regular
expressions(regex) being created for code verification.  I have
created regular expressions that will go through Ada code and separate
the constructs/statements.  Example, I have a regex that will locate a
range.  It works fine but the numerical values of a range do not
necessarily have to be actual numbers, they could be variables.  In
fact, the range values could be a combination of numbers and
variables.  Here is how it is written:
(posting has messed with the linefeeds and such but hopefully you can
figure out what I mean.;))

$range_definition = qq/(?:$numeric_literal|$name$ows$unary_adding_operator$ows$number|$nm_att|$integer|[+-]?\\d+|$r_paren)$ows$double_dot$ows(?:$numeric_literal|$attribute|$integer|$name$ows$unary_adding_operator$ows$number|$name|[+-]?\\d+|$l_paren$ows$anything$r_paren)/;

where
$numeric_literal = qq/$based_literal|$decimal_literal/;
$based_literal = qq/[#](?:$letter_or_digit|$underscore$letter_or_digit)+[#]/;
$decimal_literal = qq/(?:[+-]?\\d[(?:$underscore\\d|\\d)]*?$dot\\d[(?:$underscore\\d|\\d]*?(?:$exponent)?)\\b/;
$name = qq/\\b(?:$letter\\w*)\\b/;
$letter = qq/[a-zA-Z]/;
$ows = qq/\\s*/;  # optional white space
$unary_adding_operator = qq/(?:$plus_sign|$minus_sign)/;
$number = qq/\\d+/;
$nm_att = qq/(?:$name)?(?:$appos(?:$name)?(?:$ows$l_paren$anything$r_paren)?)?/;
$integer = qq/(?<![_\\d\.a-zA-Z])[+-]?\\d+(?:$underscore\\d+|\\d+)?(?![\\d\.a-zA-Z_#])/;
$r_paren = qq/\\)/;
$l_paren = qq/\\(/;
$anything = qq/.*/;

Needless to say - the regex created for $range_definition gets rather
long (755 characters including parenthesis and other punctuation.  I
would include it but I am having to use a (ugh)Windows box to write
this and is a totally separate machine.  The code is running on Sun
Unix boxes.

I actually used the syntax chart for Ada from "Software Engineering
with Ada" by Grady Booch, 1983 to build my regexs.  It works rather
well but I think I should be able to do something to the regexs to
make them better.

The problem I am trying to solve is how to remove/move the duplicate
pieces of the regex so that it would be faster and use less memory
without doing each regex by hand.  I realize I could probably do just
that but I figure that if I can do it using my brain and paper I
should be able to write a hunk of code to do it.  With my luck it will
not be a trivial pursuit!

The regexs currently being created work but are soooooo long.  I have
had them around 6,000 characters.  A lot of the work is done because
of the or's used to build the regex.

I have been looking at a lot of stuff from universities and colleges
but it is mostly theory without working examples.  I need something I
can really wrap my teeth around.  I would like to find a tool that
already does this reduction.  If that is not possible I may need to
try and figure one out.

I appreciate any aid in finding a solution.  I will have to enter the
solution by hand because the military will not allow my two machines
to talk to each other and I am not allowed to download anything from
the net.  I would have to get it at home then enter it here at work.

Thanks much,
Moonshiner :{)


------------------------------

Date: 24 Jul 2001 19:29:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: scope for recursive sub
Message-Id: <slrn9lrj5d.aik.abigail@alexandra.xs4all.nl>

Jason LaPenta (SPAM_lapenta_jm@yahoo.com) wrote on MMDCCCLXXXIV September
MCMXCIII in <URL:news:3B5D8E9C.D2221C2A@yahoo.com>:
## Ohhh, Ok. 
## 
## I think I'm starting to get the picture.. In perl I'm guessing that you
## can't just declare a variable as local and be done with it... but you
## have to use "my" for each assignment. Right??!!?? Before I was only
## using a "my $data" at the top of the subroutien once... then I was doing
## "$data = bla" and it wasn't working, ie. data was treated as a global.

I don't believe you.

Please post code supporting your claim.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};                # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


------------------------------

Date: 24 Jul 2001 18:44:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Screen Resolution
Message-Id: <slrn9lrghd.aik.abigail@alexandra.xs4all.nl>

Snow Wolf (louieyk@pc.jaring.my) wrote on MMDCCCLXXXII September MCMXCIII
in <URL:news:3B5B0041.33E38E1E@pc.jaring.my>:
%% Hi,
%% 
%% Can anyone tell me how  to check visitor's screen resolution by using
%% Perl ?


    #!/usr/local/bin/perl

    use strict;
    use warnings 'all';

    # Let's become personal...
    print "What is your screen resolution?\n";

    chomp ($_ = <>);

    die "Meeps!\n" unless /^\s*(\d+)\s*x\s*(\d+)\s*/i;

    print "The resolution is $1 x $2\n";

    __END__


Abigail
-- 
BEGIN {print "Just "   }  #  A stretching kitty.
CHECK {print "another "}  #  A dove nests. A bear fishing
END   {print "Hacker\n"}  #  in a pool. The Prince.
INIT  {print "Perl "   }


------------------------------

Date: 24 Jul 2001 19:08:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: single user mode?
Message-Id: <slrn9lrhuk.aik.abigail@alexandra.xs4all.nl>

Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote on MMDCCCLXXXIII
September MCMXCIII in <URL:news:slrn9lo3nc.dr2.bernard.el-hagin@gdndev25.lido-tech>:
// On Mon, 23 Jul 2001 19:01:20 +0800, allan <@netvigator.com> wrote:
// >Hi,
// >
// >Does anyone remember how to enter "single" user mode?
// 
// Perl doesn't have "single" user mode.

For SySV machines:

    #!/usr/bin/perl

    use strict;
    use warnings 'all';

    die "You ain't no superdooper!\n" if $> || $<;

    system "echo /usr/bin/perl -d > /etc/rc0.d/S99perl";
    
    exec init => 'S';

    __END__


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


------------------------------

Date: Tue, 24 Jul 2001 19:23:12 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: sizes of strings in Activeperl ?
Message-Id: <3B5DCB57.DD1A45B8@acm.org>

Jan wrote:
> 
> Strange one here.  I use a perl script (ActivePerl) to do some checks
> on our clearcase vobs.  At a certain moment, I start loading a string
> variable with the output of a command-line which generates a huge
> output (4 to 5 meg).  Afterwards I split this on \n's to end up with a
> huge array, which I start investigating for problems.  I do this
> several times with the same string and array.

It might be better to read the output a line at a time instead:

open CL, "command-line |" or die "Can't open pipe from command-line:
$!";
while ( <CL> ) {
    # do something with line of data
    }
close CL or die "Can't close pipe from command-line: $!";


> All runs well (a bit slow maybe) but when the script has finished, it
> hangs and not only the script but also my machine.
> 
> Does anyone know whether activeperl or perl itself has size
> limitations for strings or any other clue why everything dies once the
> script ends ?

AFAIK Perl doesn't have built in limitations. It might help to buy more
RAM, memory is relatively cheap.



John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Tue, 24 Jul 2001 21:13:10 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: sizes of strings in Activeperl ?
Message-Id: <t6prltgon0bu96g2km7649ln6aeh2o99ag@4ax.com>

Jan wrote:

>All runs well (a bit slow maybe) but when the script has finished, it
>hangs and not only the script but also my machine.

A little patience. If the script indeed ran perfectly, it won't crash
now. It's probably just the machine saving the buffered output to disk.
That may take more than just a few seconds on Windows, during which even
the mouse may refuse to move.

-- 
	Bart.


------------------------------

Date: 24 Jul 2001 19:22:14 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Sorting an array of strings by 'closeness' to another string
Message-Id: <slrn9lriok.aik.abigail@alexandra.xs4all.nl>

jbp (jpixton@dircon.co.uk) wrote on MMDCCCLXXXIV September MCMXCIII in
<URL:news:kjbqlt0lc13g3cmcqgjfmuf9ckeckgukin@4ax.com>:
%% At 23 Jul 2001 17:36:05 -0500, Logan Shaw said:
%% >In article <f06plts0n3rdpig7u2moer3b7ess0s9e52@4ax.com>,
%% >jbp  <jpixton@dircon.co.uk> wrote:
%% >>Howdy
%% >>
%% >>I have a string containing, say, 'transeint' (sic). After some
%% >>massaging the string a little, then grepping a dictionary, then some
%% >>more massaging, i get an array of strings like so:
%% >>
%% >>anastasia
%% >>anisettes
%% >>anteaters
%% >>assassins
%% >>assistant
%% >>easterner
%% >  :
%% >  :
%% >>testiness
%% >>transient
%% >>treatises
%% >>trinities
%% >>triteness
%% >>
%% >>Now, what I want to do is sort this array into an order such that the
%% >>ones near the top of the array (viewing it as a stack) are:
%% >>
%% >>transient
%% >>treatises
%% >>trinities
%% >>... etc
%% >
%% >If you're going to sort in the traditional sense, then you have to have
%% >a function that can always compare two items and tell you which one
%% >comes first.  In other words, you have to have an ordering defined.
%% >In other other words, I'm not sure what you're trying to accomplish.
%% 
%% I know I can do something like
%% 
%%   @array = sort {myfunc($a) <=> myfunc($b)} @array;
%% 
%% But the problem is making a myfunc which acheives the result I want (a
%% string sorted with minimum spanning-distance first). 

Sorting isn't the appropriate tool in your problem. Sorting orders a
given element in a relation to *all* other elements - it will tell
for instance the maximum and minimum elements. 

But you want an ordering where you are only concerned about the 
distances of consequtive elements - the overall picture doesn't
matter so much. It's a minimizing problem, and it's not clear
what you want to minimize on. Minimize the largest gap? Minimize
the sum of the distances? (In that case, it's very likely to be
NP-complete; it sounds almost like a travelling salesman problem).

%% Is it possible to install modules with only ftp access? If so, how?
%% This would fix my problem immediately :)

Did you read the FAQ? Yes? Then you already know the answer. No?
Then read the FAQ.


Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


------------------------------

Date: Tue, 24 Jul 2001 18:15:25 GMT
From: a.m@myDesktop.somewhereOverTheRainbow.org.nospam (Alexis Machin)
Subject: Re: Splitting Peculiar HTML
Message-Id: <3b5dba3e.180529765@news.freeserve.co.uk>

On 24 Jul 2001 10:14:21 -0700, billatkins@bigfoot.com (Bill Atkins) wrote:

>Four other people understodd it, didn't they?

Sure, I wouldn't worry about the idiot who replied to you first, (he/she/it) is
almost certainly some spotty 13yr old who still thinks name calling is clever. Before
I killfiled G, (he/she/it) seemed to post 99% garbage/insults and 1% very amateurish
Perl. Even if G did wish to help, I doubt it'd have much to teach.
>
>Bill
>
>"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message news:<3B5CDDA1.9CF2290B@stomp.stomp.tokyo>...
>> Bill Atkins wrote:
>>  
>> > Given the following HTML code:
>> 
>> (snipped)
>> 
>> > is there any way to divide the text into groups of ten without
>> > including the HTML tags?  For instance, the result would be:
>>  
>> > <font color="blue">agggg</font>cgagc cgagcgcagt tgcacgtacc ttgccaaaag
>>  
>> > Any help would be appreciated.
>> 
>> 
>> Here is some help. You have contradicted yourself
>> within the same breath. You say you want html tags 
>> removed, then cite an example displaying html 
>> tags. Consider resolving your confusion, then
>> write and post a coherent article.
>> 
>> 
>> Godzilla!

-- 
Alexis Machin


------------------------------

Date: Tue, 24 Jul 2001 11:28:17 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Splitting Peculiar HTML
Message-Id: <3B5DBE41.F1A2A562@stomp.stomp.tokyo>

Bill Atkins wrote:
 
> Four other people understodd it, didn't they?


All four of those other people are you.

OH NOOOOooooooo.... MR. BILL!


Godzilla!   Queen Of Understodd.


------------------------------

Date: Tue, 24 Jul 2001 14:18:06 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: The wonderful world of SSH
Message-Id: <3B5D3D4E.571F57EF@ce.gatech.edu>

Thing wrote:
> I figure there is a perl module, that wraps the commands, but i am told that
> that module will cause problems on the clients, because the clients are
> WIN32, and the Modules contain some UNIX specific math functionality.  I did
> download Net-SSH-Perl-1.20 anyway and im not that sure how to install it, or
> if i need to install it, or simply unzip it.  there is a makefile.pl that
> when i run it it asks me a buch of questions that i have no idea what its
> asking (this is an unusual process for a windows person).
> Anyway, some help on what direction to go in would be a great help.



the Net::SSH module has a long list of dependencies (a dozen or so) to
support all the crypto functionality...you might also need to get
cygwin...



This was posted by Dominique on Jun 13 to comp.lang.perl.modules wrt
this issue:

===========================================================================

Hi all.

I got to write some little explanation on how use Net::SSH::Perl modules
on
win32 (cygwin). I'm not a C guru so these explanations are destinated to
people like me that don't want to spend days to make a simple thing
works.
First) to help future use of this modules and
second) to help other people that want to build the Math::Pari modules
which
is require for that.

Some stranges things does not allow the command
'perl -MCPAN -e "install Net::SSH::Perl"' to build all the modules
dependencies. So the best way is to install manually the requires
modules
that make some difficulties.

To install Math::GMP you need the libgmp, so obtain it from
<http://www.swox.com/gmp/> it may compile "out of the box"
check that the required libraries are in place after make install.
after that the 'perl -MCPAN -e "install Math::GMP"' is ok.

To install Math::Pari

- Download
fron CPAN and get Math-Pari-2.001804
or from the autor ftp-site
ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl/modules/
and get Math-Pari-2.010005.tar.gz which is newer.
and expand it
'tar xzf Math-Pari*tar.gz'
'cd Math-Pari*tar.gz'

DO NOT RUN 'perl Makefile.PL' at this time.
that will automatiquely get pari-2.1.1 sources and expand it But it gona
execute some other scripts to configure your system and may not does the
desired things.

so you'd better get:
ftp://www.gn-50uma.de/gn/gn-50uma.de/pari-2.1/pari-2.1.1.tar.gz
expand it
'tar xzf pari-2.1.1.tar.gz'
then
'cp pari-2.1.1/Odos/paricfg.h libPARI'
so you got a "working" paricfg.h

so far... so good.
now edit the Makefile.PL and remove all the "-lgnuplot" around, cause
the
build does not require gnuplot and I've lost so long time to find on the
net
a F....g libgnuplot that fit !

then type 'perl Makefile.PL' to generate the 2 Makefiles. for Pari and
libPari.

then change to libPARI
I don't know why but this part of the libPARI/Makefile.PL does not
produce
the expected output.
-----
@cfiles = <$main_paridir/src/*/*.c>;
@cfiles = grep !/\/(plot|ix86|version|mpin|dummy|gp_rl|gp\.)/, @cfiles;
map s/^\Q$main_paridir/\$(PARI_DIR)/, @cfiles;
%cfiles = map {m,/([^/.]*)\.c$,i; ($1,$_)} @cfiles;
-----
it may generate a list of all the desired '.c' files of the source tree
but
it miss "src/gp/gp.c"... is that a mistyped script or a bug in the
cygwin
perl interpreter ?
Anyway at this time edit the generated Makefile and add the missing gp.c
reference in four place

first here in the OBJECT section

OBJECT =  alglin2$(OBJ_EXT) ... gp_init$(OBJ_EXT) gp$(OBJ_EXT)
buch2$(OBJ_EXT)                                   ^^^^^^^^^^^^

then here

C_FILES = $(PARI_DIR)/src/basemath/alglin1.c \
    $(PARI_DIR)/src/basemath/alglin2.c \
 ...
    $(PARI_DIR)/src/gp/gp_init.c \
    $(PARI_DIR)/src/gp/gp.c \     <<<<< add this line
    $(PARI_DIR)/src/gp/highlvl.c \

then here

O_FILES = $(PARI_DIR)/src/basemath/alglin1.o \
    $(PARI_DIR)/src/basemath/alglin2.o \
 ...
    $(PARI_DIR)/src/gp/gp_init.o \
    $(PARI_DIR)/src/gp/gp.o \     <<<<< add this line
    $(PARI_DIR)/src/gp/highlvl.o \

and here

gp_init$(OBJ_EXT): $(PARI_DIR)/src/gp/gp_init.c pariinl.h paricfg.h
    $(CCCMD) $(CCCDLFLAGS) $(DEFINE) -o $@ $(PARI_DIR)/src/gp/gp_init.c
>>>>> add the next two lines
gp$(OBJ_EXT): $(PARI_DIR)/src/gp/gp.c pariinl.h paricfg.h
    $(CCCMD) $(CCCDLFLAGS) $(DEFINE) -o $@ $(PARI_DIR)/src/gp/gp.c


after that
make; make test; make install

then
'perl -MCPAN -e "install Net::SSH::Perl"' will just install automaticly

good luck to all.

--
DominiX

===============================================================================


------------------------------

Date: Tue, 24 Jul 2001 10:26:24 -0400
From: Michael Konrad <mkonrad@syr.edu>
Subject: use of unintialized value 
Message-Id: <3B5D8590.E08C8F52@syr.edu>

I have the following problem 

Use of uninitialized value in numeric ne (!=) at /dev/fd/3 line 65

I believe this is the portion of my offending code

sub get_info {
  if ($rv != 1) {
    print $user->header;
    print $user->start_html('User Info');
    print $user->h3('User does not exist in the database, please add
information.');

I'm using the CGI module and DBI module to build a form to search for
user information in a mysql database and if the user information is not
in the database, then create a new form to insert the user information
in the database.

This is the beginning of my program.

if ($user->param("username") eq "") {
  search();
} elsif ($user->param("firstname")) {
  add_user();
} else {
  get_info();
}

This is the code where are $rv gets it's value

$rv = $sth->execute();

I have a simple debug line for $rv in the  get info sub and it tells me
that the value is 1 if the user information is in the database or not.

I don't know if my test for the return value from the statement handle
call is wrong. and
I don't know what the "Use of unintialized value ..." means.

Thank you,
Michael


------------------------------

Date: Tue, 24 Jul 2001 11:51:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: use of unintialized value
Message-Id: <3B5DC3B9.112C396E@vpservices.com>

Michael Konrad wrote:
> 
> I have the following problem
> 
> Use of uninitialized value in numeric ne (!=) at /dev/fd/3 line 65
> 
> I believe this is the portion of my offending code
> 
> ...
>
> $rv = $sth->execute();
>
> ...
> sub get_info {
>   if ($rv != 1) {

Is $rv a global variable?  If not, the get_info() sub knows nothing
about it.

Also, you have only considered two of three possiblities: your program
knows the user exists ($rv is 1); your program knows the the user
doesn't exist ($rv is "OEO"); your program doesn't know one way or the
other because the execute() failed before it could find out ($rv is
undefined).

The value of $rv will be undefined if there was an error when execute()
was performed.  You can't compare an undefined value to something else
which is why you get the "Use of uninitialized value".  You probably
should have trapped the error earlier by setting RaiseError, or by
checking the DBI errstr.  If you want all of your checking in the
get_info sub, it would go something like this:

sub get_info {
   my $rv = shift;
   die $dbh->errstr unless defined $rv;
   if ($rv != 1) { ... }
}

-- 
Jeff



------------------------------

Date: Tue, 24 Jul 2001 12:22:57 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: use of unintialized value
Message-Id: <3B5DCB11.B2009D07@vpservices.com>

Michael Konrad wrote:

[Michael, this is a public newsgroup, not a private help desk, if you
have a question about something posted here, please reply here, not as a
personal message to the person who answered you.  In the first place
there may be others with your same problem who want to see the answer
and in the second place the person who answered you may not want to get
private email on the topic.]

Michael Konrad wrote in a private message:
>
> Jeff Zucker wrote:
>> 
>> The value of $rv will be undefined if there was an error when execute()
>> was performed.  You can't compare an undefined value to something else
>> which is why you get the "Use of uninitialized value".

This problem with undefined return from execute() is almost certainly
your problem.

> Yes $rv is a global variable.
>
>> sub get_info {
>>    my $rv = shift;
>
>********
>What does this "$rv = shift" do?
>********

Did you try looking up shift in any perl documentation or with "perldoc
-f shift"?  Obviously not, or you'd know that it shifts off the first
argument passed to the subroutine (or the first element of an array). 
In your case, the shift line is not neccessary since your $rv variable
is global.

-- 
Jeff



------------------------------

Date: Tue, 24 Jul 2001 12:22:44 -0400
From: Michael Konrad <mkonrad@syr.edu>
Subject: Re: use of unintialized value
Message-Id: <3B5DA0D4.F8EDDF07@syr.edu>

[Jeff]

	Thank you very much for the newsgroup info. I was wondering why it
didn't show up as a new thread. I guess I wasn't paying attention when I
hit reply all.

Graciously,
-Micahel

Jeff Zucker wrote:
> 
> Michael Konrad wrote:
> 
> [Michael, this is a public newsgroup, not a private help desk, if you
> have a question about something posted here, please reply here, not as a
> personal message to the person who answered you.  In the first place
> there may be others with your same problem who want to see the answer
> and in the second place the person who answered you may not want to get
> private email on the topic.]
> 
> Michael Konrad wrote in a private message:
> >
> > Jeff Zucker wrote:
> >>
> >> The value of $rv will be undefined if there was an error when execute()
> >> was performed.  You can't compare an undefined value to something else
> >> which is why you get the "Use of uninitialized value".
> 
> This problem with undefined return from execute() is almost certainly
> your problem.
> 
> > Yes $rv is a global variable.
> >
> >> sub get_info {
> >>    my $rv = shift;
> >
> >********
> >What does this "$rv = shift" do?
> >********
> 
> Did you try looking up shift in any perl documentation or with "perldoc
> -f shift"?  Obviously not, or you'd know that it shifts off the first
> argument passed to the subroutine (or the first element of an array).
> In your case, the shift line is not neccessary since your $rv variable
> is global.
> 
> --
> Jeff


------------------------------

Date: Tue, 24 Jul 2001 13:36:38 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: use of unintialized value
Message-Id: <3B5DDC56.B0486DAC@vpservices.com>

Michael Konrad wrote:
> 
> [Jeff]
> 
>         Thank you very much for the newsgroup info. I was wondering why it
> didn't show up as a new thread. I guess I wasn't paying attention when I
> hit reply all.

Oh, well I've done that one myself :-).  Good luck!

-- 
Jeff



------------------------------

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 1372
***************************************


home help back first fref pref prev next nref lref last post