[32333] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3600 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 27 06:09:27 2012

Date: Fri, 27 Jan 2012 03:09:08 -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           Fri, 27 Jan 2012     Volume: 11 Number: 3600

Today's topics:
        basic hash question <nospam@lisse.NA>
    Re: basic hash question <jimsgibson@gmail.com>
    Re: basic hash question <ben@morrow.me.uk>
    Re: basic hash question <tadmc@seesig.invalid>
    Re: basic hash question <derykus@gmail.com>
    Re: basic hash question <nospam@lisse.NA>
    Re: basic hash question <nospam@lisse.NA>
    Re: basic hash question <nospam@lisse.NA>
        eval()ing a pattern substitution under 'use strict' and <bew_ba@gmx.net>
    Re: eval()ing a pattern substitution under 'use strict' <ben@morrow.me.uk>
    Re: eval()ing a pattern substitution under 'use strict' <bew_ba@gmx.net>
    Re: eval()ing a pattern substitution under 'use strict' <bew_ba@gmx.net>
    Re: ssh tullen <veatchla@yahoo.com>
    Re: ssh tullen <nospam@lisse.NA>
    Re: ssh tunnel <nospam@lisse.NA>
    Re: ssh tunnel <tadmc@seesig.invalid>
    Re: ssh tunnel <nospam@lisse.NA>
        Verbose output from perlbug? (Seymour J.)
    Re: Verbose output from perlbug? <ben@morrow.me.uk>
    Re: Verbose output from perlbug? (Seymour J.)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Jan 2012 01:41:59 +0200
From: Dr Eberhard W Lisse <nospam@lisse.NA>
Subject: basic hash question
Message-Id: <9oe6lrFkdaU1@mid.individual.net>

Hi,

I have an anonymous hash with two elements and can print
them out like so.

foreach my $record (@$hash_records) {
        print "$record->{A},$record->{B}\n";
}

However, I have several records of A with variable numbers of B (n=1 to
5) and would like

print one line of each A with B1, B2, B3, ..., Bn

can someone point me somewhere to read this up, or provide me with a
code fragment that does this?

greetings, el

-- 
If you want to email me, replace nospam with el


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

Date: Thu, 26 Jan 2012 16:21:03 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: basic hash question
Message-Id: <260120121621034649%jimsgibson@gmail.com>

In article <9oe6lrFkdaU1@mid.individual.net>, Dr Eberhard W Lisse
<nospam@lisse.NA> wrote:

> Hi,
> 
> I have an anonymous hash with two elements and can print
> them out like so.
> 
> foreach my $record (@$hash_records) {

So $hash_records is a reference to an array.

>         print "$record->{A},$record->{B}\n";

So the elements of the array are references to a hash, which always has
two elements with keys 'A' and 'B'.

> }
> 
> However, I have several records of A with variable numbers of B (n=1 to
> 5) and would like

Do you mean that you have multiple (1 to 5) hashes wherein the value of
the element with key 'A' is the same while the value of the elements
with key 'B' vary, and this pattern repeats with multiple values of the
'A' elements?

> 
> print one line of each A with B1, B2, B3, ..., Bn
> 
> can someone point me somewhere to read this up, or provide me with a
> code fragment that does this?

Here are two ways:

#!/usr/local/bin/perl
use strict;
use warnings;

my $hash_records = [
  { A => 1, B => 1 },
  { A => 3, B => 6 },
  { A => 2, B => 3 },
  { A => 3, B => 7 },
  { A => 3, B => 8 },
  { A => 2, B => 4 },
  { A => 1, B => 2 },
  { A => 3, B => 9 },
  { A => 2, B => 5 },
  { A => 3, B => 10 },
];

my $key = 0;
for my $record ( sort { $a->{A} <=> $b->{A} } @$hash_records ) {
  my $new_key = $record->{A};
  if( $new_key == $key ) {
    print "  $record->{B}";
  }else{
    print "\n$record->{A}:  $record->{B}";
  }
  $key = $new_key;
}
print "\n\n";

my %output;
for my $record ( @$hash_records ) {
  push( @{$output{$record->{A}}}, $record->{B} );
}
for my $key ( sort keys %output ) {
  print "$key: ", join(', ', @{$output{$key}}), "\n";
}

Use 'cmp' and 'eq' instead of '<=>' and '==' if you are dealing with
text data instead of numerical data.

-- 
Jim Gibson


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

Date: Fri, 27 Jan 2012 00:27:06 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: basic hash question
Message-Id: <qj79v8-nrn1.ln1@anubis.morrow.me.uk>


Quoth nospam@lisse.NA:
> 
> I have an anonymous hash with two elements and can print
> them out like so.
> 
> foreach my $record (@$hash_records) {
>         print "$record->{A},$record->{B}\n";
> }
> 
> However, I have several records of A with variable numbers of B (n=1 to
> 5) and would like
> 
> print one line of each A with B1, B2, B3, ..., Bn

It's not clear from this what your data structure looks like. Is it
something like

    $hash_records = [
        { A => "foo", B1 => "bar", B2 => "baz" },
        { A => "blib", B1 => "blab", B3 => "blob" },
    ];

or something else?

If that's the right structure, then you want to reorganise it so it
looks like

    $hash_records = [
        { A => "foo", B => ["bar", "baz"] },
        { A => "blib", B => ["blab", "blob"] },
    ];

since it will make manipulating it much easier. As a general rule of
thumb, when you start using names ending in numbers, you should probably
be using an array instead.

It would be best to do this reorganisztion at the point where you create
the data structure, since it better represents the structure of the
data, but if necessary you can use something like

    for my $record (@$hash_records) {
        my $A = $record->{A};
        my @B = map $record->{$_},
                sort
                grep /^B/,
                keys %$record;
        print "$A, " . join ", ", @B;
    }

to pull the keys you need out afterwards.

Ben



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

Date: Thu, 26 Jan 2012 22:20:29 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: basic hash question
Message-Id: <slrnji49v0.bt5.tadmc@tadbox.sbcglobal.net>

Dr Eberhard W Lisse <nospam@lisse.NA> wrote:


> I have an anonymous hash with two elements 


So, let's see the declaration of your anonymous hash with two elements.


> However, I have several records of A with variable numbers of B (n=1 to
> 5) and would like


Show us an example of this different data structure.

How to manipulate a data structure is entirely dependent on how
the data is structured.

Show us a data structure (a real one, not a pseudo ambiguous one) and
we will help you access it any way that you need.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Thu, 26 Jan 2012 23:36:55 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: basic hash question
Message-Id: <e03fc809-2289-482d-ae69-6b7d1210e65a@k6g2000vbz.googlegroups.com>

On Jan 26, 3:41=A0pm, Dr Eberhard W Lisse <nos...@lisse.NA> wrote:

> ...
> can someone point me somewhere to read this up, or provide me with a
> code fragment that does this?
>

Perl data structures is a good tutorial
with lots of examples:

   perldoc perldsc

--
Charles DeRykus


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

Date: Fri, 27 Jan 2012 11:10:29 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: basic hash question
Message-Id: <4F226A05.7020407@lisse.NA>

Thanks, will read.

el

on 2012-01-27 09:36 C.DeRykus said the following:
> On Jan 26, 3:41 pm, Dr Eberhard W Lisse <nos...@lisse.NA> wrote:
> 
>> ...
>> can someone point me somewhere to read this up, or provide me with a
>> code fragment that does this?
>>
> 
> Perl data structures is a good tutorial
> with lots of examples:
> 
>    perldoc perldsc
> 
> --
> Charles DeRykus



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

Date: Fri, 27 Jan 2012 11:26:40 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: basic hash question
Message-Id: <4F226DD0.4060803@lisse.NA>

Sorry for being unclear,

foreach my $record (@$hash_records) {
        print "$record->{A},$record->{B}\n";
}

results in:

A,a1
A,a2
B,b1
B,b2
B,b3
C,c1
C,c2
C,c3
C,c4
C,c5


but I need it to print out as something like

A,a1,a2,,,
B,b1,b2,b3,,
C,c1,c2,c3,c4,c5

Actually I use DNS::ZoneParse to parse a zone file with variable numbers
of name servers per domain.

greetings, el

on 2012-01-27 02:21 Jim Gibson said the following:
[...]
> Do you mean that you have multiple (1 to 5) hashes wherein the value of
> the element with key 'A' is the same while the value of the elements
> with key 'B' vary, and this pattern repeats with multiple values of the
> 'A' elements?

[...]


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

Date: Fri, 27 Jan 2012 12:57:55 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: basic hash question
Message-Id: <4F228333.8020100@lisse.NA>

Jim,

This oes what I want, and I'll use the weekend to try and understand it
:-)-O

Thank you very much.

el


on 2012-01-27 02:21 Jim Gibson said the following:
[...]
> Here are two ways:
> 
> #!/usr/local/bin/perl
> use strict;
> use warnings;
> 
> my $hash_records = [
>   { A => 1, B => 1 },
>   { A => 3, B => 6 },
>   { A => 2, B => 3 },
>   { A => 3, B => 7 },
>   { A => 3, B => 8 },
>   { A => 2, B => 4 },
>   { A => 1, B => 2 },
>   { A => 3, B => 9 },
>   { A => 2, B => 5 },
>   { A => 3, B => 10 },
> ];
> 
> my $key = 0;
> for my $record ( sort { $a->{A} <=> $b->{A} } @$hash_records ) {
>   my $new_key = $record->{A};
>   if( $new_key == $key ) {
>     print "  $record->{B}";
>   }else{
>     print "\n$record->{A}:  $record->{B}";
>   }
>   $key = $new_key;
> }
> print "\n\n";
> 
> my %output;
> for my $record ( @$hash_records ) {
>   push( @{$output{$record->{A}}}, $record->{B} );
> }
> for my $key ( sort keys %output ) {
>   print "$key: ", join(', ', @{$output{$key}}), "\n";
> }
> 
> Use 'cmp' and 'eq' instead of '<=>' and '==' if you are dealing with
> text data instead of numerical data.
> 



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

Date: Wed, 25 Jan 2012 08:39:22 -0800 (PST)
From: bernd <bew_ba@gmx.net>
Subject: eval()ing a pattern substitution under 'use strict' and lexical scope
Message-Id: <ee076a25-2e47-4a5b-8dcb-808215cccfa5@k6g2000vbz.googlegroups.com>

Hi folks,

I have two perl progs, both expected to do the same, eval()ing a
pattern substitution expression using variables for the substitution
pattern and the replacement (to be used in a subroutine later on).

The first prog uses 'use strict' and lexical variables and looks like
this:

#!/usr/bin/perl -w

use strict;
my $old = 'test this one';
my $pat = 'this';
my $repl = 'that';
my $mods = '';
my $new;

eval('($new = $old) =~ s/$pat/$repl/ee . $mods');

print $new . "\n";

($mods can take a string containing one or more modifiers (like 'g')
to the s/// operator).

The output is

Use of uninitialized value in substitution iterator at (eval 1) line
1.
test  one

In the second version I dispensed with 'use strict' and lexical
variables:

#!/usr/bin/perl -w

$old = 'test this one';
$pat = 'this';
$repl = 'that';
$mods = '';

eval('($new = $old) =~ s/$pat/$repl/ee . $mods');

print $new . "\n";

And the output is as expected:

Name "main::repl" used only once: possible typo at ./subst_nostrict.pl
line 5.
Name "main::new" used only once: possible typo at ./subst_nostrict.pl
line 10.
Name "main::old" used only once: possible typo at ./subst_nostrict.pl
line 3.
Name "main::pat" used only once: possible typo at ./subst_nostrict.pl
line 4.
Name "main::mods" used only once: possible typo at ./subst_nostrict.pl
line 6.
Unquoted string "that" may clash with future reserved word at (eval 2)
line 2.
test that one

Unfortunately, in the project in which the eval-stuff should be
integrated I have to use 'strict' and lexical scoping.

Can somebody explain the differences in the output and how I could
reach the desired output 'test that one'?

TIA


Bernd


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

Date: Wed, 25 Jan 2012 19:33:31 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: eval()ing a pattern substitution under 'use strict' and lexical scope
Message-Id: <b126v8-h382.ln1@anubis.morrow.me.uk>


Quoth bernd <bew_ba@gmx.net>:
> 
> I have two perl progs, both expected to do the same, eval()ing a
> pattern substitution expression using variables for the substitution
> pattern and the replacement (to be used in a subroutine later on).

I don't know what you're trying to do, but I'm *certain* there's a
better way of doing it. Maybe if you explained why you're doing this
someone could suggest a less-insane alternative.

> The first prog uses 'use strict' and lexical variables and looks like
> this:
> 
> #!/usr/bin/perl -w
> 
> use strict;
> my $old = 'test this one';
> my $pat = 'this';
> my $repl = 'that';
> my $mods = '';
> my $new;
> 
> eval('($new = $old) =~ s/$pat/$repl/ee . $mods');
> 
> print $new . "\n";
> 
> ($mods can take a string containing one or more modifiers (like 'g')
> to the s/// operator).
> 
> The output is
> 
> Use of uninitialized value in substitution iterator at (eval 1) line
> 1.
> test  one

OK, you have multiple levels of 'eval' here, so we need to step through
them carefully to understand what's going on.

First we eval the single-quoted string

    '($new = $old) =~ s/$pat/$repl/ee . $mods'

Since this is single-quoted there's no interpolation, so the eval has
exactly the same effect as writing the code out normally. (Did you mean
the '. $mods' to come outside the string?) So now we are executing

    ($new = $old) =~ s/$pat/$repl/ee . $mods

s///ee starts by interpolating $pat on the LHS, so we're searching for

    /this/

(as a regular expression). For each instance it finds, it runs

    eval "$repl"

(note the double-quotes, they're important). This is equivalent to

    eval 'that'

which is equivalent to

    that;

as a standalone Perl statement. 

Since this is all under 'use strict "subs"', and there is no 'sub that'
in scope, this throws a 'Bareword "that" not allowed while "strict subs"
in use' error. The eval catches the error, stuffs it into $@, and
returns undef. The s///ee takes the undef and inserts it into $new in
place of the 'this' it found, which gives an 'uninitialized value'
warning.

> In the second version I dispensed with 'use strict' and lexical
> variables:

The reason this 'worked' is not because you stopped using 'strict
"refs"' and lexicals, but because you stopped using 'strict "subs"'.

Perl 4 had a completely bizarre bit of behaviour: if it saw an
expression like

    that;

and there was no 'sub that' defined, it assumed you had meant

    'that';

and carried right on. This means that once the chain of evals above gets
that far, it simply turns the bareword back into a string (without
complaining) and you get the substitution you were expecting.

Now, how much of that did you want? I suspect you will get what you
meant if you just remove the 'ee' (and put the $mods outside the
string), but the whole thing is enormously unsafe. What if someone gives
you a $pat of

    '//; system "rm -rf /"; s/'

?

Ben



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

Date: Thu, 26 Jan 2012 04:06:12 -0800 (PST)
From: bernd <bew_ba@gmx.net>
Subject: Re: eval()ing a pattern substitution under 'use strict' and lexical scope
Message-Id: <b424e120-6173-4eb1-bc92-cc53abff5727@t2g2000yqk.googlegroups.com>

Hi Ben,

thanks for the elaborate explanations.

> Did you mean the '. $mods' to come outside the string?

Exactly, and in the original code it was like that. I changed this to
the statement posted during testing and "forgot" to change it back
since it seemed to have no effect anyway (but this was an erroneous
assumption, caused by the fact that $mods was the empty string during
all of these tests). So, the outer eval was intended to "glue" the
modifier string to the s///ee expression, what it actually does if
$mods is outside of the single quoted string.

My intention with this code was to use it in a subroutine which
executes pattern substitution with $pat and $repl read from a
configuration file. The double evaluation of the substitution operator
is strictly necessary since it could be possible that the replacement
read from the configuration file could contain backreference variables
($1, $2, ...).

So, what did I do after reading Your post?:

I changed back the eval-statement as mentioned above, introduced the
subroutine, in which I placed the code, with 'no use "subs"' (so that
'use "vars"' is still in effect and lexicals are forced) and switched
off warnings for the statement containing the pattern substitution
('no warnings'/'use warnings').

> What if someone gives
> you a $pat of

>    '//; system "rm -rf /"; s/'

>?

Hm. The only users who could do something like this would be able to
execute 'rm -rf' on the UNIX command line anyway (and then they would
mess around with their own workplace ;-)). If a black hat from outside
would be able to do this we would have a much bigger problem with our
it-security and therefore this particular thread is neglectable. :->>

Cheers


Bernd



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

Date: Thu, 26 Jan 2012 04:07:08 -0800 (PST)
From: bernd <bew_ba@gmx.net>
Subject: Re: eval()ing a pattern substitution under 'use strict' and lexical scope
Message-Id: <419fae7f-3352-47d8-aea3-205ff31f96e9@t7g2000vbg.googlegroups.com>

On Jan 25, 8:33=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth bernd <bew...@gmx.net>:
>
>
>
> > I have two perl progs, both expected to do the same, eval()ing a
> > pattern substitution expression using variables for the substitution
> > pattern and the replacement (to be used in a subroutine later on).
>
> I don't know what you're trying to do, but I'm *certain* there's a
> better way of doing it. Maybe if you explained why you're doing this
> someone could suggest a less-insane alternative.
>
>
>
>
>
>
>
>
>
> > The first prog uses 'use strict' and lexical variables and looks like
> > this:
>
> > #!/usr/bin/perl -w
>
> > use strict;
> > my $old =3D 'test this one';
> > my $pat =3D 'this';
> > my $repl =3D 'that';
> > my $mods =3D '';
> > my $new;
>
> > eval('($new =3D $old) =3D~ s/$pat/$repl/ee . $mods');
>
> > print $new . "\n";
>
> > ($mods can take a string containing one or more modifiers (like 'g')
> > to the s/// operator).
>
> > The output is
>
> > Use of uninitialized value in substitution iterator at (eval 1) line
> > 1.
> > test =A0one
>
> OK, you have multiple levels of 'eval' here, so we need to step through
> them carefully to understand what's going on.
>
> First we eval the single-quoted string
>
> =A0 =A0 '($new =3D $old) =3D~ s/$pat/$repl/ee . $mods'
>
> Since this is single-quoted there's no interpolation, so the eval has
> exactly the same effect as writing the code out normally. (Did you mean
> the '. $mods' to come outside the string?) So now we are executing
>
> =A0 =A0 ($new =3D $old) =3D~ s/$pat/$repl/ee . $mods
>
> s///ee starts by interpolating $pat on the LHS, so we're searching for
>
> =A0 =A0 /this/
>
> (as a regular expression). For each instance it finds, it runs
>
> =A0 =A0 eval "$repl"
>
> (note the double-quotes, they're important). This is equivalent to
>
> =A0 =A0 eval 'that'
>
> which is equivalent to
>
> =A0 =A0 that;
>
> as a standalone Perl statement.
>
> Since this is all under 'use strict "subs"', and there is no 'sub that'
> in scope, this throws a 'Bareword "that" not allowed while "strict subs"
> in use' error. The eval catches the error, stuffs it into $@, and
> returns undef. The s///ee takes the undef and inserts it into $new in
> place of the 'this' it found, which gives an 'uninitialized value'
> warning.
>
> > In the second version I dispensed with 'use strict' and lexical
> > variables:
>
> The reason this 'worked' is not because you stopped using 'strict
> "refs"' and lexicals, but because you stopped using 'strict "subs"'.
>
> Perl 4 had a completely bizarre bit of behaviour: if it saw an
> expression like
>
> =A0 =A0 that;
>
> and there was no 'sub that' defined, it assumed you had meant
>
> =A0 =A0 'that';
>
> and carried right on. This means that once the chain of evals above gets
> that far, it simply turns the bareword back into a string (without
> complaining) and you get the substitution you were expecting.
>
> Now, how much of that did you want? I suspect you will get what you
> meant if you just remove the 'ee' (and put the $mods outside the
> string), but the whole thing is enormously unsafe. What if someone gives
> you a $pat of
>
> =A0 =A0 '//; system "rm -rf /"; s/'
>
> ?
>
> Ben



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

Date: Wed, 25 Jan 2012 20:34:05 -0600
From: l v <veatchla@yahoo.com>
Subject: Re: ssh tullen
Message-Id: <jfqe2s$58q$1@dont-email.me>

On 1/16/2012 1:59 AM, Dr Eberhard Lisse wrote:
> Hi,
>
> I have a PostgreSQL database behind a firewall which I can access from a
> fixed IP address but obviously not while on the road where I must issue
> something like:
>
> 	ssh -N -C  user@host.domain.DOMAIN -L 5433/localhost/5432
>
> and then run my script to generate the report.
>
> I can in a slightly different context using Net::SSH issue commands
> to the remote host, but I have been unable to figure out how to open a
> tunnel from within the perl script (preferably with a module, but that's
> not really the issue), then do my usual thing, and then close the tunnel
> again.
>
> Is this a unique problem? Or can someone point me to a code fragment
> that does something like this...
>
> el

How about trying Net::OpenSSH?  I have not used this module.

http://search.cpan.org/~salva/Net-OpenSSH-0.57/lib/Net/OpenSSH.pm#Tunnels

<quote>

tunnel => $bool

Instead of executing a command in the remote host, this option instruct 
Net::OpenSSH to create a TCP tunnel. The arguments become the target IP 
and port.

Example:

  my ($in, $out, undef, $pid) = $ssh->open_ex({tunnel => 1}, $IP, $port);

</quote>

-- 
Len



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

Date: Fri, 27 Jan 2012 01:35:42 +0200
From: Dr Eberhard W Lisse <nospam@lisse.NA>
Subject: Re: ssh tullen
Message-Id: <4F21E34E.4040409@lisse.NA>

Have you got a code fragment for this elderly Gyneaecologist?

Didn't manage to get OpenSSH to work either.

thanks, el

On 2012-01-26 04:34 , l v wrote:
[...]
> 
> How about trying Net::OpenSSH?  I have not used this module.
-- 
If you want to email me, replace nospam with el


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

Date: Fri, 27 Jan 2012 01:36:10 +0200
From: Dr Eberhard W Lisse <nospam@lisse.NA>
Subject: Re: ssh tunnel
Message-Id: <4F21E36A.5040600@lisse.NA>

Thanks, that helps.

el

On 2012-01-21 13:19 , Peter J. Holzer wrote:
> On 2012-01-17 11:46, Ben Morrow <ben@morrow.me.uk> wrote:
>> Try system("ssh -f -L... ... sleep 10") instead of open3. It's important
>> with -f to use 'sleep 10' rather than -N, otherwise the ssh process will
>> never exit. (It doesn't seem to be very easy to find its pid to kill it
>> manually.)
> 
> open($fh, '-|', ...) returns the pid, so does fork. The following script
> works for me, at least on linux:
> 
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> use IO::Socket::INET;
> 
> $| = 1;
> print "opening tunnel ... ";
> my $pid = open(my $fh, '-|',
>                'ssh', '-N', 'hjp@mri.DOMAIN', '-L', '10007:chronos.DOMAIN:7'
>               ) or die;
> print " done (pid=$pid)\n";
> 
> sleep 5;
> system('lsof', '-i', ':10007');
> sleep 5;
> 
> print "opening socket ... ";
> my $sock = IO::Socket::INET->new(PeerHost => 'localhost', 
>                                  PeerPort => 10007,
>                                  Proto => 'tcp');
> print " done\n";
> 
> print "sending request ... ";
> print $sock "test123\n";
> print " done\n";
> 
> print "reading response ... ";
> my $resp = <$sock>;
> print " done (resp = $resp)\n";
> 
> print "closing socket ... ";
> close($sock);
> print " done\n";
> 
> sleep(5);
> system('lsof', '-i', ':10007');
> sleep(5);
> 
> print "closing tunnel ... ";
> kill(15, $pid);
> my $rc = waitpid($pid, 0);
> print " done (rc = $rc)\n";
> 
> sleep(5);
> system('lsof', '-i', ':10007');
> __END__
> 
> 	hp
> 
> 


-- 
If you want to email me, replace nospam with el


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

Date: Thu, 26 Jan 2012 22:23:33 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: ssh tunnel
Message-Id: <slrnji4a4o.bt5.tadmc@tadbox.sbcglobal.net>

Dr Eberhard W Lisse <nospam@lisse.NA> wrote:

> Thanks, that helps.
>
> el


Perhaps you do not realize it, but you appear to be rude.

You should learn Usenet manners if you intend to post to Usenet.

Do not top-post.

Do not full-quote.


    http://web.presby.edu/~nnqadmin/nnq/nquote.html


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Fri, 27 Jan 2012 11:10:52 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: ssh tunnel
Message-Id: <4F226A1C.2090502@lisse.NA>

And you can go and see Isak N. Jacobsen.

el


on 2012-01-27 06:23 Tad McClellan said the following:
> Dr Eberhard W Lisse <nospam@lisse.NA> wrote:
> 
>> Thanks, that helps.
>>
>> el
> 
> 
> Perhaps you do not realize it, but you appear to be rude.
> 
> You should learn Usenet manners if you intend to post to Usenet.
> 
> Do not top-post.
> 
> Do not full-quote.
> 
> 
>     http://web.presby.edu/~nnqadmin/nnq/nquote.html
> 
> 



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

Date: Tue, 24 Jan 2012 12:18:10 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Verbose output from perlbug?
Message-Id: <4f1ee7d2$7$fuzhry+tra$mr2ice@news.patriot.net>

Are there any guidelines on when to use -v on perlbug? Is there a down
side to always using it?

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Tue, 24 Jan 2012 23:01:51 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Verbose output from perlbug?
Message-Id: <vrp3v8-agr.ln1@anubis.morrow.me.uk>


Quoth Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>:
> Are there any guidelines on when to use -v on perlbug? Is there a down
> side to always using it?

Well, it's quite a lot of information, all of which will be posted to
p5p and archived in rt.perl.org and so on. I wouldn't include it unless
you suspect there's something peculiar about your system that's causing
the bug you're reporting. After all, if the information does turn out to
be necessary someone can always ask for it later.

Ben



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

Date: Wed, 25 Jan 2012 07:42:57 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Verbose output from perlbug?
Message-Id: <4f1ff8d1$9$fuzhry+tra$mr2ice@news.patriot.net>

In <vrp3v8-agr.ln1@anubis.morrow.me.uk>, on 01/24/2012
   at 11:01 PM, Ben Morrow <ben@morrow.me.uk> said:

>I wouldn't include it unless you suspect there's something 
>peculiar about your system that's causing the bug you're reporting.

Okay, I'll omit it in the future, unless asked. Thanks.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 3600
***************************************


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