[19556] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1751 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 15 09:05:32 2001

Date: Sat, 15 Sep 2001 06:05:07 -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: <1000559107-v10-i1751@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 15 Sep 2001     Volume: 10 Number: 1751

Today's topics:
    Re: Do I need file locking <bart.lateur@skynet.be>
    Re: Do I need file locking (Martien Verbruggen)
        How can I get the absolute path of the PERL script that <!!NOSPAM_nbagadio@bigfoot.com>
    Re: http server validation <flavell@mail.cern.ch>
    Re: I need Many Very Time Efficient forks from a large  <uri@sysarch.com>
    Re: mod_perl or PHP for database drive site? <goldbb2@earthlink.net>
        Need help with this regex problem: <batormaster666@hotmail.com>
    Re: Need help with this regex problem: <Laocoon@eudoramail.com>
    Re: Need help with this regex problem: <bart.lateur@skynet.be>
        New to Perl, please help <faithlezz@hotmail.com>
    Re: New to Perl, please help <thomas@baetzler.de>
        New upgrade perl problem (Toni)
    Re: parsing large DNA files into smaller files <goldbb2@earthlink.net>
    Re: parsing large DNA files into smaller files <thomas@baetzler.de>
    Re: Pattern Matching Help Needed <bart.lateur@skynet.be>
        print name of var <bart@nijlen.com>
        sub z { my $r = shift; $r -> {a} = { b => "c"} }; z ($x (EED)
        substr match <Kalle Anka@markisspecialisten.com>
        Test Test
    Re: Urgently need help with Net::SSH::Perl / Math::Pari <ben@rhumba.pair.com>
    Re: use autouse 'Data::Dumper' => qw(Dump); (Martien Verbruggen)
    Re: Using Perl to post regular usenet messages. <simon.oliver@umist.ac.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 15 Sep 2001 10:26:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Do I need file locking
Message-Id: <hsa6qt43cp6m4okso50tjb9d7o2bfj7slt@4ax.com>

Anno Siegel wrote:

>According to Randal L. Schwartz:

>> Maybe with sysopen and syswrite, yes.
>
>I think you mean "sysseek", not "sysopen".

Too many sys* words.

So why is there a sysseek() anyway? There isn't a systell(). And at
least on one platform (MacPerl), plain tell() and sysseek() don't work
well together IIRC (see
<http://bumppo.net/lists/macperl/1998/05/thread2.html#00017>). 

-- 
	Bart.


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

Date: Sat, 15 Sep 2001 22:10:25 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Do I need file locking
Message-Id: <slrn9q6h9h.bfe.mgjv@martien.heliotrope.home>

On Sat, 15 Sep 2001 10:26:55 GMT,
	Bart Lateur <bart.lateur@skynet.be> wrote:
> Anno Siegel wrote:
> 
>>According to Randal L. Schwartz:
> 
>>> Maybe with sysopen and syswrite, yes.
>>
>>I think you mean "sysseek", not "sysopen".
> 
> Too many sys* words.
> 
> So why is there a sysseek() anyway?

History, I presume.

>                                     There isn't a systell().

probably because there is no ltell(2).

>                                                              And at
> least on one platform (MacPerl), plain tell() and sysseek() don't work
> well together IIRC (see
><http://bumppo.net/lists/macperl/1998/05/thread2.html#00017>). 

Perl still has a long way to go before it is truly crossplatform
compatible. I suspect that until some of the unixisms, direct
translations of Unix-specific C interfaces, have gone, this is going to
stay a difficult area.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Fri, 14 Sep 2001 14:00:39 -0400
From: "!!nb" <!!NOSPAM_nbagadio@bigfoot.com>
Subject: How can I get the absolute path of the PERL script that's running
Message-Id: <Nxro7.97$4W2.206@news-srv1.fmr.com>

I know about $0, but how can I get the full path and filename...
i.e.
c:\test\tryme.pl vs just $0=tryme.pl





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

Date: Sat, 15 Sep 2001 13:56:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: http server validation
Message-Id: <Pine.LNX.4.30.0109151354060.31452-100000@lxplus023.cern.ch>

On Sep 14, brian d foy inscribed on the eternal scroll:

> >   The methods GET and HEAD MUST be supported by all general-purpose
> >   servers.
>
> > ergo: any server which fails to support HEAD must be a special-purpose
> > server.   :-}
>
> of course, Alan knows the difference between compliant and non-
> compliant. :)

He also knows the meaning of Quod Erat Demonstrandum.  :-/

-- 

    "No, nothing is wrong.  It's just not doing what you want."
                                              - Dave Pawson on comp.text.xml



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

Date: Sat, 15 Sep 2001 04:06:54 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: I need Many Very Time Efficient forks from a large program
Message-Id: <x7sndpdrm5.fsf@home.sysarch.com>

>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:

  LS> In article <9nuboq$rbj$1@eskinews.eskimo.com>,
  LS> Xeno Campanoli <xeno@eskimo.com> wrote:

  >> My problem is this: I'm trying to send from a single large testing
  >> application a large number of requests to a server as close to the
  >> same time as possible without having to use threads.  My

  LS> On the other hand, if you want to send as many requests as possible at
  LS> the same time, the best thing is to use threads and have lots of
  LS> processors.  If you have too many threads or processes going at once,
  LS> they may not be able to be scheduled onto a processor in a short enough
  LS> period.  But maybe you just mean that you'd like to have several
  LS> separate but overlapping sessions with a server.  In that case, it
  LS> shouldn't be a problem.

you can do it all in one process with event programming. use Stem or POE
as the engine core. no threads, no forks. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org


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

Date: Sat, 15 Sep 2001 01:52:02 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: mod_perl or PHP for database drive site?
Message-Id: <3BA2EC82.F8217E2A@earthlink.net>

kramer wrote:
> 
> I am creating a high traffic MySQL based database site (kind of like
> one of those dating sites but different).  Anyway which is better PHP
> or mod_perl in terms of speed, stability, and development time.

mod_fastcgi

It comes close to PHP and mod_perl in terms of speed, it's more stable,
and it has shorter development time than either, particularly for those
who are used to writing CGI programs.

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Sat, 15 Sep 2001 09:29:09 +0200
From: "Batormaster666" <batormaster666@hotmail.com>
Subject: Need help with this regex problem:
Message-Id: <9nuvom$jqd$1@news1.xs4all.nl>

Hi all,

Could somebody please help me with this regex problem I need to perform for
syntax checking?
I've got to check the syntax of a string that starts with a positive integer
and is padded right by space characters up to a length of 11 characters.
This is then followed by a \n.
I 1st thought of this but it of course won't work:
^(\d+ *){11}\n$

Thanks,
Batormaster666.




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

Date: Sat, 15 Sep 2001 11:27:30 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Need help with this regex problem:
Message-Id: <Xns911D7603C3FCBLaocooneudoramail@62.153.159.134>

If i understood your question right..

/\d.{10}\n/

Now if u say 'syntax checking' what exactly do u mean? 
do u want to capture the number or something? 


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

Date: Sat, 15 Sep 2001 11:01:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Need help with this regex problem:
Message-Id: <aic6qtgrcso6qpvg395fs69hgttde6i9a2@4ax.com>

Batormaster666 wrote:

>Could somebody please help me with this regex problem I need to perform for
>syntax checking?
>I've got to check the syntax of a string that starts with a positive integer
>and is padded right by space characters up to a length of 11 characters.

IMO that's a though one to check with regexes.

>This is then followed by a \n.

I'd combine a plain "digits followed by optional spaces" with a check on
the length. At least one of the two needs to be in lookahead, because
both tests need to be working in parallel, on the same characters:

	/^(?=.{11}\n)\d+ *$/
or
	/^(?=\d+ *\n).{11}$/
or
	(/^(?=.{11}\n)(?=\d+ *$)/

Note that '$' can match before or after a final newline, or at the end
of the string if that newline is missing. So checking for "\n" and
testing for $ will require that there is a newline and that it is at the
end of the string. You can always replace that combination with a plain
and simple

	\n\z


>I 1st thought of this but it of course won't work:
>^(\d+ *){11}\n$

No. Here your trying to match a sequence of digits followed by optional
spaces, that 11 times. So you for a match need at least 11 digits
(actually 11 groups of digits), with optionally spaces between and after
them. Not at all what you wanted.

-- 
	Bart.


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

Date: Sat, 15 Sep 2001 22:21:49 +1000
From: "Kevin" <faithlezz@hotmail.com>
Subject: New to Perl, please help
Message-Id: <3ba3487c@news.iprimus.com.au>

Hi,

I am new to Perl, could some body please help me by explain what are the
following code means? Thank you very much. Also, what's the different
between 'local', 'my', 'global' variable?

 1:    sub test {
 2:        my $type = shift;
 3:        my $start = shift;
 4:        my $end = shift || $start;        # What is this line mean?
 5:        my $class = ref($type) || $type;        # Same as this line
 6:        my $self = bless {}, $class;
 7:        my ($key, $value);        # What is this line?
 8:        local $_ = "";        #What is $_ ?
 9:
10:       eval "/$start/" if defined($start);
11:       eval "/$end/" if !$@ && defined($end);        # What is $@ ?
12:
13:       $key = shift @_;
14:        ...
15:
16:       $self->quote(@_) if @_;
17:       return $self;
18:    }

Thank you,
Kevin






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

Date: Sat, 15 Sep 2001 14:54:00 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: New to Perl, please help
Message-Id: <2ri6qt4cjg0efrl8pns445pktc2kj21e6k@4ax.com>

On Sat, 15 Sep 2001, "Kevin" <faithlezz@hotmail.com> wrote:

>I am new to Perl, could some body please help me by explain what are the
>following code means? Thank you very much. Also, what's the different
>between 'local', 'my', 'global' variable?

run "perldoc -q local" for a keyword search of your installed Perl
documentation - it'll spit out (amongst other things) the relevant
text from perlfaq7.

>
> 1:    sub test {
> 2:        my $type = shift;
> 3:        my $start = shift;
> 4:        my $end = shift || $start;        # What is this line mean?

A shift without arguments peels off the front element from the @_
argument passing array. It'll return undef if there's no entry in @_
left when it was called. So "shift || $start" will do a "shift @_",
which gives us an argument or undef. If that evaluates to true, the
right side of the ||-Operator will never be checked - after all in "a
or b" it doesn't matter if b is true if a already is true. But if the
shift @_ returns an undef, because @_ was empty, or if it wasn't empty
and there was a 0 or an undef in the first element of the array, then
the right side of the or will be evaluated - and a constant evaluates
to it's value.

So the probable use of this construct was "if there's no third
argument passed, just copy the value of the second argument for it".

> 5:        my $class = ref($type) || $type;        # Same as this line
> 6:        my $self = bless {}, $class;

This is a class constructor - the first argument to a method
invocation is always either a reference to an object of the class, or
the class name itself. Now ref() returns the name of the class, too.

> 7:        my ($key, $value);        # What is this line?

Declaration of two lexcially scoped variables.

> 8:        local $_ = "";        #What is $_ ?

The default argument, accumulator, whatchamacallit.

>10:       eval "/$start/" if defined($start);
>11:       eval "/$end/" if !$@ && defined($end);        # What is $@ ?

See "perldoc perlvar" for this one. It's the result from the previous
eval.

HTH,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: 15 Sep 2001 00:41:22 -0700
From: jacapaca@navegalia.com (Toni)
Subject: New upgrade perl problem
Message-Id: <c03e0fbf.0109142341.64fe23e0@posting.google.com>

Hello!
I recently tried to upgrade my perl installation from 5.00x to 5.6.1.
The new installation was 'automatically' made at /usr/local/bin
instead of old installation /usr/local/bin. Then I deleted old
/usr/bin/perl and linked to /usr/local/bin/perl.
Now my @INC array include the new paths to modules
(/usr/local/lib/perl5/5.6.1 , ...etc). My old perl installation
modules remains, of course, in olds directories. I know I can add
paths to @INC with "use lib blahblah", but I'd prefer not to do this
in all my programs, and I don't know if this, or link old libs paths
to news, can cause version compatibility problems between old modules
and brand news or others ugly effects. What can I do to reuse them?
Thanks to any help!

Toni


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

Date: Sat, 15 Sep 2001 01:46:01 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: parsing large DNA files into smaller files
Message-Id: <3BA2EB19.35C9DB11@earthlink.net>

Jeff Gruen wrote:
> 
> Dear All:
> 
> I am a newbie to perl and unix script writing.
> I am looking for a script that will help us to parse a large DNA
> sequence file into smaller text files. 

#!/usr/bin/perl -w
use strict;
@ARGV ||= ("dna.seq");
$/ = \10000;
print "Processing...\n";
while( <> ) {
	print "Chunk ", $. + 1, "\n";
	my ($begin, $end) = ($. * 10000 + 1, $. * 10000 + length);
	my $name = "${begin}_${end}.seq";
	open( local(*FILE), ">$name" )
		or die "Couldn't open $name for writing: $!\n";
	print FILE ">", $name, "\n", $_, "\n";
	close FILE
		or die "Couldn't close $name after writing: $!\n";
}
print "Done.\n";

-- 
"I think not," said Descartes, and promptly disappeared.



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

Date: Sat, 15 Sep 2001 14:30:22 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: parsing large DNA files into smaller files
Message-Id: <8uh6qtsb2815j931kkpeu8vmudp3cu2p9e@4ax.com>

On Sat, 15 Sep 2001, Benjamin Goldberg <goldbb2@earthlink.net> wrote:

>Jeff Gruen wrote:
>> I am a newbie to perl and unix script writing.
>> I am looking for a script that will help us to parse a large DNA
>> sequence file into smaller text files. 

>#!/usr/bin/perl -w
>use strict;
>@ARGV ||= ("dna.seq");

This works only for scalars - with your Perl flags, one should see
"Can't modify array dereference in logical or assignment (||=)"
when trying to run it. Please don't post untested code! 

>$/ = \10000;

What is that supposed to do? Please see "perldoc perlvar" for an
explanation of the input record separator.

>print "Processing...\n";
>while( <> ) {

Coud've fooled me - do like you're using a filename above, then revert
to reading from STDIN :-)

>	print "Chunk ", $. + 1, "\n";

Wrong again. The $. line numbers start at one.

>	my ($begin, $end) = ($. * 10000 + 1, $. * 10000 + length);

So begin will be 10000 and end something like 3 million, because you
just slurped the whole file.

>	my $name = "${begin}_${end}.seq";

What's wrong with "$begin\_$end.seq"; ?

[...]

HTH,
-- 
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl


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

Date: Sat, 15 Sep 2001 11:14:38 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pattern Matching Help Needed
Message-Id: <8hd6qtsrpjne2ntac2f0g9lof70jlrrepv@4ax.com>

Ralph Freshour wrote:

>if ($Target[$x] =~ /^\Q$filtFilter\E$/)
>   {
>     $msg = "exact match\n";
>   }
>if ($Target[$x] =~ /^\Q$filtFilter\E/)
>   {
>     if ($Target[$x] =~ /^\Q$filtFilter\E$/)
>        {
>          $msg = "beginning match\n";
>        }
>   }
>if ($Target[$x] =~ /\Q$filtFilter\E$/)
>   {
>     if ($Target[$x] =~ /^\Q$filtFilter\E$/)
>        {
>          $msg = "ending match\n";
>        }
>   }
>if ($Target[$x] =~ /\Q$filtFilter\E/)
>   {
>     if ($Target[$x] =~ /^\Q$filtFilter\E$/)
>        {
>          $msg = "contains match\n";
>        }
>   }

So you're assigning to one variable, $msg. That tells me that you want
an "elsif" type of control flow. Here's what I think that would make
your text agree with the matching:

	if ($Target[$x] =~ /\Q$filtFilter/) #otherwise don't even bother
	   {
	     if ($Target[$x] =~ /^\Q$filtFilter\E$/)
	        {
	          $msg = "exact match\n";
	        }
	     elsif ($Target[$x] =~ /^\Q$filtFilter\E/)
	        {
	          $msg = "beginning match\n";
	        }
	     elsif ($Target[$x] =~ /\Q$filtFilter\E$/)
	        {
	          $msg = "ending match\n";
	        }
	     else
	        {
	          $msg = "contains match\n";
	        }
	   }
	   else  #you didn't have this???
	   {
	        $msg = "no match\n";
	   }

Boy I really don't like this style of indentation. Just give me "cuddled
else's" anytime.

-- 
	Bart.


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

Date: Sat, 15 Sep 2001 12:47:57 GMT
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: print name of var
Message-Id: <16Io7.54917$6x5.11770442@afrodite.telenet-ops.be>

Hi,

$b="hey";
$c="hello";
$lastvar="bye";
 ...

Is it possible to have a screen output like

Variable b is set to 'hey'.
Variable c is set to 'hello'.
Variable lastvar is set to 'bye'.
 ...

I tried arrays, hashes, but it seems very hard to print a variable's name to
screen.

Thanks for help
Bart




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

Date: Sat, 15 Sep 2001 14:51:52 +0200
From: "Alexander Farber (EED)" <eedalf@eed.ericsson.se>
Subject: sub z { my $r = shift; $r -> {a} = { b => "c"} }; z ($x); print $x ->  {a} -> {b}
Message-Id: <3BA34EE8.9085179F@eed.ericsson.se>

Hi,

why doesn't this print "c":

   maas34:eedalf {101} perl -e 'sub z { my $r = shift; $r -> {a} = { b => "c"} }; z ($x); print $x -> {a} -> {b}'

but this does:

   maas34:eedalf {102} perl -e 'sub z { my $r = shift; $r -> {a} = { b => "c"} }; $x = {}; z ($x); print $x -> {a} -> {b}'

   c

I'm asking this, because I have currently this 
code, which doesn't work (the $hohref is undef):

   my ($query, $cnaref, $hohref, $dbh);
 ...
   fetch_pacs ($dbh, $cnaref, $hohref);
 ...
   sub fetch_pacs ($$$)
   {
       my $dbh    = shift;
       my $cnaref = shift;
       my $hohref = shift;

       my $sth;

       $sth = $dbh -> prepare (sprintf $SQL2,
                                   join ', ',
                                       map $dbh -> quote ($_),
                                           keys %$cnaref);    # list of CNA ids
       $sth -> execute;

       while (my $href = $sth -> fetchrow_hashref)
       {
           my $pac = $href -> {PAC};                     # PAC or SPAC = uber-key
           $hohref -> {$pac} = { %$href };               # copy the fetched hash
       }
   }

I currently workaround this by adding these 2 lines:

   my ($query, $cnaref, $hohref, $dbh);

   $cnaref = {};
   $hohref = {};
 ...
 
But shouldn't it be unnecessary, since the "perldoc perlref" says:


     6.  References of the appropriate type can spring into
         existence if you dereference them in a context that
         assumes they exist.

Regards
Alex


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

Date: Sat, 15 Sep 2001 10:24:56 GMT
From: "Kalle Anka" <Kalle Anka@markisspecialisten.com>
Subject: substr match
Message-Id: <Y%Fo7.55787$e5.2873739@newsb.telia.net>

This will not remove when its a perfect match. Did I forget something?

# "*" IS NOT ALLOWED
 if ($email =~ tr/*?//d) {                    # = form from maillist.htm
print "NOT ALLOWED !<br>\n\n";
print qq {<a href="../remove.htm" target="_top">Try again!</a>\n} ;
} else{


    open INFILE, $filename                # = maillist.htm
or return "Couldn't open file for reading";
    @infile = <INFILE>;
    close INFILE;

# PREVENT EMTY FORM
if ( $email =~ /^\s*$/ ) {
print "The form was emty<br>\n" ;
print qq {<a href="../remove.htm" target="_top">Try again!</a>\n} ;
exit ;
}

# REMOVE IF PERFECT MATCH - This one doesnt work. Nothing seems to be
perfect match.
open INFILE, $filename or die "Can't open '$filename': $!";

$line;
  while (<INFILE>) {
    chomp; # drops trailing newlines; can omit if undesirable
    $line = $_, last if /^\Q$email/i && ! /^$/; # substr match!
  }




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

Date: 15 Sep 2001 08:09:44 GMT
From: Test
Subject: Test
Message-Id: <3ba2feb8@news.umist.ac.uk>

Test


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

Date: Sat, 15 Sep 2001 04:41:48 GMT
From: Benjamin Trott <ben@rhumba.pair.com>
Subject: Re: Urgently need help with Net::SSH::Perl / Math::Pari / @INC and loadable objects
Message-Id: <B7C82A1C.12CF8%ben@rhumba.pair.com>

> My code is quite basic so far (mostly from Net::SSH:Perl manpage
> since I want to start to be able to establish a connection before I
> develop any further):
> 
> #!/usr/bin/perl -w
> use Net::SSH::Perl;
> use strict;
> my
> ($ssh,$host,$user,$pass,$stdout,$stderr,$exit,$cmd,$port,$back,$prot);
> $host = "$ARGV[0]";
> $port = "$ARGV[1]";
> $user = "$ARGV[2]";
> $pass = "$ARGV[3]";
> $ssh = Net::SSH::Perl->new("$host", port=>($port), debug=>'true',
> protocol=>'2,1', interactive=>'true');
> $ssh->login($user, $pass);
> $back = $ssh->incoming_data;
> print "\n\nIncoming: $back\n\n";
> ($stdout, $stderr, $exit) = $ssh->cmd($cmd);

I don't know what you're doing with the 'incoming_data' method, but that's
not examples in the manpage. All you need from this is these lines:

> $ssh = Net::SSH::Perl->new("$host", port=>($port), debug=>'true',
> protocol=>'2,1', interactive=>'true');
> $ssh->login($user, $pass);
> ($stdout, $stderr, $exit) = $ssh->cmd($cmd);

Just: 'new', 'login', 'cmd'. That is the sequence of methods that you need
to call 95% of the time, I would say, at least if you're just trying to run
a command remotely.

> When I'm trying to use SSH2 I get the following error:
> Can't locate loadable object for module Math::Pari in @INC (@INC
> contains:
> /usr/local/ActivePerl-5.6/lib/5.6.1/i686-linux-thread-multi
> /usr/local/ActivePerl-5.6/lib/5.6.1
> /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/i686-linux-thread-multi
> /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1
> /usr/local/ActivePerl-5.6/lib/site_perl .)
> at
> /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/Net/SSH/Perl/Util/SSH2MP
> .pm line 6
> 
> I do have Math::Pari installed
> bash# locate Pari.pm
> /usr/local/ActivePerl-5.6/lib/5.6.1/Math/Pari.pm

Math::Pari consists of more than just a standard .pm file. It also has an XS
component, and the XS is an interface to the PARI library.

It appears that your Math::Pari was not successfully installed, because you
don't have the "loadable object" (eg. the dynamic library) that is built
from the XS and the PARI library. This would be a file like Pari.so.

bye,
Ben



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

Date: Sat, 15 Sep 2001 22:29:44 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: use autouse 'Data::Dumper' => qw(Dump);
Message-Id: <slrn9q6ido.bfe.mgjv@martien.heliotrope.home>

On Fri, 14 Sep 2001 16:31:44 +0200,
	Alexander Farber (EED) <eedalf@eed.ericsson.se> wrote:
> Hi guys,
> 
> I'd like to only load the Data::Dumper module in my CGI-script 
> if the DEBUG information is requested (by a string in PATH_INFO):
> 
>    $DEBUG = $query -> path_info =~ /DEBUG/;
> 
> So I've tried doing it this way:
> 
>    use autouse 'Data::Dumper' => qw(Dump);
> ...
>    print '<PRE>',
>          Dump ([$hohref, $cnaref], [qw(hohref cnaref)]),
>          '</PRE>' if $DEBUG;

Dump isn't exported by Data::Dumper, neither via @EXPORT or @EXPORT_OK.
I suspect that that has something to do with it.

The following works fine for me though:

#!/usr/local/bin/perl -w
use strict;

use autouse 'Data::Dumper' => qw(Dumper Dump);

my $var = { a => 2, b => [1, 2, 3] };

print Dumper($var);
print Data::Dumper->Dump([$var], ['$var']);

> I wonder if my "use ..." statement is correct. I've also tried:

I think it's the call to Dump(), without a package qualifier, _and_ the
fact that Dump isn't exported, which means that you can't do:

use autouse 'Data::Dumper' => qw(Dump);
my $var = { a => 2, b => [1, 2, 3] };
print Data::Dumper->Dump([$var], ['$var']);

I can't think of an easy way around this.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia                  | 


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

Date: Sat, 15 Sep 2001 08:07:58 +0100
From: "Simon Oliver" <simon.oliver@umist.ac.uk>
Subject: Re: Using Perl to post regular usenet messages.
Message-Id: <3ba3001b@news.umist.ac.uk>

Ok, to look at messages try:

use Net::NNTP;

my $group = 'comp.lang.perl.misc';

my $nntp = Net::NNTP->new("news");
my @group = $nntp->group($group)
  or die "Error setting group.\n";
print join("\n\n_\n", @group), "\n";
my $article = $nntp->article($group[1])
  or die "Error retieving article.\n";
print @$article;

$nntp->quit;

To send an article you need something like this:

use Net::NNTP;

my $from = 'user@host';
my $subject = 'A subject';
my $message = 'A message';
my $group = 'my.fav.grp';

my $nntp = Net::NNTP->new("news");
if ($nntp->postok()) {
 $nntp->post(
    "Newsgroups: $group\n",
    "Subject: $subject\n",
    "From: $from\n",
    "\n",
    $message
  ) or warn "Error sending article:", $nntp->message(), "\n";
} else {
 warn "Postings not allowed!\n";
}

$nntp->quit;

HIH

--
  Simon




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

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


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