[21729] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3933 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 8 11:09:48 2002

Date: Tue, 8 Oct 2002 08:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 8 Oct 2002     Volume: 10 Number: 3933

Today's topics:
        $dynamic_file_upload (sven)
    Re: Anyone who uses Perl on VAX <jpagnew@vcu.edu>
    Re: Anyone who uses Perl on VAX <jpagnew@vcu.edu>
        Decode X.420 IPM P22 header using BER.pm ? <cingram@pjocsNOSPAMORHAM.demon.co.uk>
        Flag processing (tî'pô)
    Re: Forking woes <nobull@mail.com>
    Re: Help me understand *foo = \... <heather710101@yahoo.com>
    Re: Help me understand *foo = \... <mjcarman@mchsi.com>
    Re: Help ME understand *foo{ARRAY} = [... <REMOVEsdnCAPS@comcast.net>
    Re: Help ME understand *foo{ARRAY} = [... <Tassilo.Parseval@post.rwth-aachen.de>
        help with perl map??? (Mike)
    Re: net::pop3 problem news@roaima.freeserve.co.uk
    Re: newb here learning Perl (Alex)
        On Windows:  if ($pid = open(CHILD, "|-")) { <rhedin@aquifer.geology.uiuc.edu>
    Re: Perl shortcut question news@roaima.freeserve.co.uk
    Re: Problem with SIG handling on WinNT <nwang@panix.com>
    Re: sendmail and perl <richard@zync.co.uk>
    Re: Split a string <garry@ifr.zvolve.net>
        synonymous subroutines <johannes.fuernkranz@t-online.de>
        udp (deita)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 8 Oct 2002 03:09:29 -0700
From: seven21@webstudio.de (sven)
Subject: $dynamic_file_upload
Message-Id: <56766779.0210080209.2b2a78fd@posting.google.com>

i have a problem with uploading large files (100mb or larger).
now iheard with http::request::common and $dynamic_file_upload it's
possible to do this.
but i found no good example.
can someone explain how to implement this?


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

Date: Tue, 08 Oct 2002 10:37:00 -0400
From: Jim Agnew <jpagnew@vcu.edu>
To: Joseph Norris <jozefn@newbolt.sonic.net>
Subject: Re: Anyone who uses Perl on VAX
Message-Id: <3DA2ED8C.8EA2FF7E@vcu.edu>

Joseph Norris wrote:
> 
> Tom,
> 
> You are right - I should have said openvms.  I did not know that this was
> going to be the OS when I orginally sent the email.  The manager just
> said "Vax box".
> 
> BTW.  I understand that you can get a hobbist version of OpenVms but
> I don't know where.  Any Ideas?
> 
> Thanks.
> 
> #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
> print @c=map chr $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
> -68,4,-3,-1,7,1,14,-68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
> 
> On Tue, 8 Oct 2002, Tom Beer wrote:
> 
> > Jim Agnew wrote in message <3DA1DC51.382DBAF7@vcu.edu>...
> > >jozefn wrote:
> > >> I now have a project on a VAX. Have not seen the box yet - don't know
> > about the OS - as you can see - very green.
> > >>
> > >Welcome to one of the finest os's around. Definitely not a desktop
> > >except for the very hard-core..
> >
> > Technically, VAX refers to the hardware (and I think VAXs are now obsolete -
> > replaced by Alphas). The OS is most likely to be VMS.
> >
> > Tom.
> >
> >
> >


ok the hobbyist is avail from http://www.montagar.com/

but you do need to be a (free) member of encompass, the old DECUS users
group..

the VMS FAQ, opensource links, etc is at:

http://www.openvms.compaq.com/

enjoy..


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

Date: Tue, 08 Oct 2002 10:38:27 -0400
From: Jim Agnew <jpagnew@vcu.edu>
Subject: Re: Anyone who uses Perl on VAX
Message-Id: <3DA2EDE3.6C5B4B06@vcu.edu>

"Alan J. Flavell" wrote:
> 
> On Oct 7, pkent inscribed on the eternal scroll:
> 
> > A Vax is the hardware platform, and it runs the operating system
> > OpenVMS. I don't think Vaxen run Digital UNIX.
> 
> Sort-of.  VAX is a (now obsolete) hardware platform, which usually ran
> VAX/VMS - what has now become OpenVMS.
> 
> However, the VAX hardware could run some kind of unix.  But anyone who
> was doing that would say so up front - if you're told nothing more
> than that it's a VAX, it's a near certainty that the OS is VMS, I
> would say.
> 
> > > What is it similar to - UNIX? MPEIX? Dos?
> >
> > I'd say it's different from all of them, in various ways :-)
> 
> Indeed ;-)
> 
> Its habit of keeping multiple versions of the same file would be quite
> welcome - now that disk space has become so cheap.  Back then we were
> forever purging old versions to retrieve some of the precious disk
> space.

I agree, there is Ultrix, bsd, and maybe another one or two.. but if
they call it a vax, chances are it's VMS  (ok, excuse me, OpenVMS)...
;-)


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

Date: Tue, 8 Oct 2002 13:55:18 +0100
From: "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk>
Subject: Decode X.420 IPM P22 header using BER.pm ?
Message-Id: <anukkj$bot$1$8302bc10@news.demon.co.uk>

I have an X.400 Mailer which separates an X.400 Inter-personal Message (IPM)
(in P22 format) into its component Heading and Body.  I want to decode the
Heading and extract just 3 out of about 16 Heading components:

    - originator
    - first primary-recipient
    - in-reply-to-IPM-ID

I do not need to further decode these 3 octet-streams into their components.

Now I thought decoding would be easy, having just discovered Graham Barr's
excellent BER.pm (Perl module for Basic Encoding Rules encoding/decoding),
and found how easy it is to encode an IPM.

See http://theoryx5.uwinnipeg.ca/CPAN/data/Convert-BER/BER.html

But my attempt to use the BER::decode function fails to write to any of the
variables I have prepared.  So the first BER::dump call after my decoding
function  complains of unitialized variable.

Any helpful suggestions much appreciated.  Also, I was not quite sure how to
decode a SEQUENCE_OF primary-recipients.  Is there any way I can abbreviate
the decoder's hash defining the PDU, in order to avoid catering for fields
that I am not interested in capturing?

Excuse the long (though abbreviated) smaple output, and source code, but
this highlights the errors and spell out exactly how I am using BER::decode.
I read the IPM Heading PDU in from file - the first call to BER::dump
verifies it is what I expect.

Regards,
Clyde

(Cross-posted to comp.lang.perl.misc and comp.protocols.iso)

Enclosed:
    - 1. Output on running the BER decoding script
    - 2. Perl source of BER decoding script


1. Output on running the BER decoding script:


0000 31   -1: SET {
0002 6B   40:   APPLICATION [11] {
0004 13   38:     UNIVERSAL [19]
0005        :       2F 47 . . .
002C        :   }
002C A0   -1:   CONTEXT [0] {
002E 60   -1:     APPLICATION [0] {
                    . . .
00BE        :     }
00BE 80   10:     CONTEXT [0]
00BF        :       43 . . .
00CC        :   }
00CC A2   88:   CONTEXT [2] {
00CE 31   86:     SET {
00D0 A0   77:       CONTEXT [0] {
00D2 60   65:         APPLICATION [0] {
00D4 30   44:           SEQUENCE {
                          . . .
0102        :           }
0102 31   17:           SET {
                        . . .
0115        :           }
0115        :         }
0115 80    8:         CONTEXT [0]
0116        :           74 . . .
011F        :       }
011F 81    2:       CONTEXT [1]
0120        :         05 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ ..
0123 82    1:       CONTEXT [2]
0124        :         00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ .
0126        :     }
0126        :   }
0126 A5  106:   CONTEXT [5] {
0128 60   65:     APPLICATION [0] {
                    . . .
016B        :     }
016B 13   37:     UNIVERSAL [19]
016C        :       2D 32 . . .
0192        :   }
0192 A8   12:   CONTEXT [8] {
0194 14   10:     UNIVERSAL [20]
0195        :       52 65 61 64 3A 20 54 65 73 74 __ __ __ __ __ __ Read:
Test
01A0        :   }
01A0 8C    1:   CONTEXT [12]
01A1        :     01 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ .
01A3 8E    1:   CONTEXT [14]
01A4        :     00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ .
01A6 AF    0:   CONTEXT [15] {
01A8        :   }
01AA        : }
Entering decode_hdr_p22
Leaving decode_hdr_p22
Use of uninitialized value at mydecoder line 35.
Originator pdu:

Use of uninitialized value at /opt/clyde/perllib/Convert/BER.pm line 464.

Originator:

Use of uninitialized value at /opt/clyde/perllib/Convert/BER.pm line 464.

Recipient:

Use of uninitialized value at /opt/clyde/perllib/Convert/BER.pm line 464.

RepliedToIPMId:



2. Perl source of BER decoding script


#!/bin/perl -w

use strict;
use English;
use lib qw( /opt/clyde/perllib );
use Convert::BER;

my $p2hdr_file = "/opt/clyde/asn1/hdr.p22";

open( P2HDR, $p2hdr_file ) or die "$p2hdr_file: Failed to open file:
$ERRNO";
binmode( P2HDR );
binmode( STDOUT );

my $pdu_buffer;
my $hdr_p22_pdu = new Convert::BER;
read( P2HDR, $pdu_buffer, 8 * 2**10 );

$hdr_p22_pdu->buffer( $pdu_buffer );

$hdr_p22_pdu->dump();

my (
    $originator,
    $recipient,
    $repliedToIPMId,
) = ();

&decode_hdr_p22(
    $hdr_p22_pdu,
    \$originator,
    \$recipient,
    \$repliedToIPMId,
);

print STDERR "Originator pdu: " . unpack( "H*", $originator ) . "\n\n";

my $originator_pdu = new Convert::BER;
$originator_pdu->buffer( $originator );
print STDERR "\nOriginator:\n\n";
$originator_pdu->dump();

my $recipient_pdu = new Convert::BER;
$recipient_pdu->buffer( $recipient );
print STDERR "\nRecipient:\n\n";
$recipient_pdu->dump();

my $repliedToIPMId_pdu = new Convert::BER;
$repliedToIPMId_pdu->buffer( $repliedToIPMId );
print STDERR "\nRepliedToIPMId:\n\n";
$repliedToIPMId_pdu->dump();

exit 1;

#-----------------------------------------------------------------------
# function decode_hdr_p22
#
# From ITU X.420 (using IMPLICIT tags):
#
# Heading ::= SET {
#    this-IPM                        ThisIPMField,
#    originator                 [0]  OriginatorField            OPTIONAL,
#    authorizing-users          [1]  AuthorizingUsersField      OPTIONAL,
#    primary-recipients         [2]  PrimaryRecipientsField     OPTIONAL,
#    copy=recipients            [3]  CopyRecipientsField        OPTIONAL,
#    blind-copy-recipients      [4]  BlindCopyRecipientsField   OPTIONAL,
#    replied-to-IPM             [5]  RepliedToIPMField          OPTIONAL,
#    . . .
#    extensions                 [15] ExtensionsField            DEFAULT { }
# }
#
# PrimaryRecipientsField ::= SEQUENCE OF PrimaryRecipientsSubField
#
#
#-----------------------------------------------------------------------

sub decode_hdr_p22 {

    print STDERR "Entering decode_hdr_p22\n";

    my (
        $hdr_p22_pdu,
        $originator_ref,
        $recipient_ref,
        $repliedToIPMId_ref,
    ) = @_;


    # Heading fields to ignore
    my (
        $ThisIPMField,
        $AuthorizingUsersField,
        $PrimaryRecipientsField,
        $SubjectField,
        $ImportanceField,
        $SensitivityField,
        $ExtensionsField,
    );

    my $PrimaryRecipientCount;
    my @PrimaryRecipientSpecifier_list;

    $hdr_p22_pdu->decode(

            'SET' => [  # Heading

                [ 'SET' => &Convert::BER::BER_APPLICATION |
                           &Convert::BER::BER_CONSTRUCTOR | 11 ] =>
[           # this-IPM
                    \$ThisIPMField,
                ],

                'OPTIONAL' => [
                    [ 'SET' => &Convert::BER::BER_CONTEXT |
                               &Convert::BER::BER_CONSTRUCTOR | 0 ] =>
[        # originator
                        $originator_ref,
                    ],
                ],

                'OPTIONAL' => [
                    [ 'SET' => &Convert::BER::BER_CONTEXT |
                               &Convert::BER::BER_CONSTRUCTOR | 1 ] =>
[        # authorizing-users
                        \$AuthorizingUsersField,
                    ],
                ],

#               'OPTIONAL' => [
#                   [ 'SEQUENCE' => &Convert::BER::BER_CONTEXT |
#                              &Convert::BER::BER_CONSTRUCTOR | 2 ] =>
[        # primary-recipients
#                       \$PrimaryRecipientsField,
#                   ],
#               ],

                'OPTIONAL' => [
                    [ 'SEQUENCE_OF' => &Convert::BER::BER_CONTEXT |
                                       &Convert::BER::BER_CONSTRUCTOR | 2 ]
=> [        # primary-recipients
                        \$PrimaryRecipientCount,
                        'BER' => sub {
                                    $PrimaryRecipientSpecifier_list[$_[0]] =
undef;
                                    \$PrimaryRecipientSpecifier_list[$_[0]]
                                 },
                    ],
                ],


                'OPTIONAL' => [
                    [ 'SET' => &Convert::BER::BER_CONTEXT |
                               &Convert::BER::BER_CONSTRUCTOR | 5 ] =>
[        # replied-to-IPM
                        $repliedToIPMId_ref,
                    ],
                ],

                'OPTIONAL' => [
                    [ 'SEQUENCE' => &Convert::BER::BER_CONTEXT |
                                    &Convert::BER::BER_CONSTRUCTOR | 8 ] =>
[   # subject
                        'T61String' => \$SubjectField,
                    ],
                ],

                'OPTIONAL' => [
                    [ 'ENUM' => &Convert::BER::BER_CONTEXT |
                                &Convert::BER::BER_PRIMITIVE | 12 ] =>
[        # importance
                        \$ImportanceField,
                    ],
                ],

                'OPTIONAL' => [
                    [ 'ENUM' => &Convert::BER::BER_CONTEXT |
                                &Convert::BER::BER_PRIMITIVE | 13 ] =>
[        # sensitivity
                        \$SensitivityField,
                    ],
                ],

                'OPTIONAL' => [
                    [ 'SET' => &Convert::BER::BER_CONTEXT |
                               &Convert::BER::BER_CONSTRUCTOR | 15 ] =>
[       # extensions
                        \$ExtensionsField,
                    ],
                ],
            ],
    );

    # Return just first PrimaryRecipient
    $$recipient_ref = $PrimaryRecipientSpecifier_list[0];

    print STDERR "Leaving decode_hdr_p22\n";
    return 1;
}



Ends.




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

Date: Tue, 08 Oct 2002 16:10:24 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Flag processing
Message-Id: <f7p5quo2qogn9j3o6vr8kfi9k14h40a8or@4ax.com>

I'm maintaining some old code loops over lots of stuff looking for
flags. For example:
if($flag =~ /^-dir:/ ) {
	$flag = $';
	...
} 
elsif($flag =~ /^-user:/ ) {
	$flag = $';
	...
}

I think I remember seeing somewhere that $' is not efficient and
should be avoided so I changed some of these to:
if($flag =~ /^-dir:(.*)/o ) { # added the o modifier too
	$flag = $1;
	...
} 
elsif($flag =~ /^-user:(.*)/o ) {
	$flag = $1;
	...
}

I then thought that it might be simpler to uses s//:
if( $flag =~ s/^-dir//o ) {
	...
}
elsif( $flag =~ s/^-user//o ) {
	...
}

What's the preferred way to do stuff like this?

-- 
print "Just another Perl newbie.\n";


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

Date: 08 Oct 2002 12:50:09 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Forking woes
Message-Id: <u965wdw3ny.fsf@wcl-l.bham.ac.uk>

"Mark Morgan" <morganm@qualcomm.com> writes:

>   Hoping someone can offer some insight here.  :)

Maybe someone here can, but I doubt this actually has much to do with Perl.

>  I have a perl script I've
> written whos job it is to do some work, fork a child (daemon) and then exit.
> This seems to work great in most circumstances.  I had some initial issues
> with closing out file descriptors which gave me woes early on, but I've
> worked those out now.

Are you sure you got them all?

Come to think of it, just how does one get a Perl program to close a
non-standard (i.e. not 0,1,2) pre-exisiting file descriptor?
Hmmm... perhaps this is a FAQ.... oh yes so it is: "How do I close a
file descriptor by number?".

>   So here's the issue.  We run a third-party solution also written in C,
> which also makes system calls.  When setting up this program to call my perl
> script, however, it hangs and waits for the child process to return.
> Obviously since the child is a daemon, it never returns, and thus the call
> never returns in the third party software.  Obviously bad behaviour.
> 
>   Obviously, I don't have the vendor's code to look at to see exactly how
> they're calling exec/wait.

Most Unicies have a debugging utility that allows you to log all system calls
made by a process.  It is often called "strace" but I've seen it under
other names too.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 8 Oct 2002 12:59:51 +0000 (UTC)
From: Da Witch <heather710101@yahoo.com>
Subject: Re: Help me understand *foo = \...
Message-Id: <anuks7$g0v$1@reader1.panix.com>


Thanks!  Your post and the ones by Steve and Ilya have gone a long way
in dissipating the fog.  Some of it still lingers, though:

In <ansrag$t602@onews.collins.rockwell.com> Michael Carman <mjcarman@mchsi.com> writes:

>our() can't be used to declare a typeglob. You
>don't declare typeglobs at all (well, sometimes via local(), but that's
>a different creature altogether.)

I'm surprised that local typeglobs are that much different from --um--
non-local typeglobs (???)

What confuses me about typeglobs is that in some contexts they behave
like regular Perl variable-like things: one can assign to them, one
can make references pointing to them, one can declare them local.

But then it turns out that one can't declare them my or our (!?!?!),
which produces in me a mild sense of cognitive/syntatic chaos.

h


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

Date: Tue, 08 Oct 2002 08:43:43 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Help me understand *foo = \...
Message-Id: <anundj$t5i2@onews.collins.rockwell.com>

On 10/8/02 7:59 AM, Da Witch wrote:
>
> Michael Carman <mjcarman@mchsi.com> writes:
> 
>> our() can't be used to declare a typeglob. You don't declare
>> typeglobs at all (well, sometimes via local(), but that's a
>> different creature altogether.)
> 
> I'm surprised that local typeglobs are that much different from --um--
> non-local typeglobs (???)

They're not; the difference is bewtween the behavior of our() and local():

our() is purely a declarative statement -- it says "this is a valid
global for the enclosing scope." Basically, it just makes 'strict vars'
happy.

local() isn't really a declaration (though it has that effect as far as
'strict vars' is concerned). local() creates a localized *value* for a
global variable. You can use it to obscure an entire glob (local *foo)
or just a portion of it (local $foo).

Here's my attempt at rationalization: 'strict vars' forces you do
predeclare your variables. our() is there to make 'strict' happy, but if
you said our(*foo), Perl wouldn't know if you intended to use $foo,
@foo, or %foo. You have to declare those explicitly, and once you've
said our(@foo) there's no need to declare *foo because it already exists.

-mjc



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

Date: Tue, 08 Oct 2002 06:06:08 CDT
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Help ME understand *foo{ARRAY} = [...
Message-Id: <Xns92A1482BD539sdn.comcast@216.166.71.239>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote in
news:antrmj$ndo$1@agate.berkeley.edu: 

> 
> Which did not make the syntax have any sense...  This is extremely
> ugly hack; IIRC, nowadays it should have been written as
> 
>   *xyz{ARRAY} = [1,2,3];

Okay, my turn to be the newbie.  I've been programming in perl for 7 years 
and thought I understood typeglobs -- but I've never seen the above syntax.
I think I can see what it's doing, but I don't really know how to parse it.

Where can I get more information on this use of typeglobs?  Is it in Camel 
3?  What version of perl introduced it?

Thanks in advance.

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPaK77WPeouIeTNHoEQJKFwCfRown9VxocDpCj6WzxEzpiaqXNcgAnRNJ
NgVuzkMpxKbP0qOSXWInwbmP
=qnfw
-----END PGP SIGNATURE-----


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

Date: 8 Oct 2002 11:15:22 GMT
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Help ME understand *foo{ARRAY} = [...
Message-Id: <anueoa$1lf$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Eric J. Roode:

> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote in
> news:antrmj$ndo$1@agate.berkeley.edu: 
> 
>> 
>> Which did not make the syntax have any sense...  This is extremely
>> ugly hack; IIRC, nowadays it should have been written as
>> 
>>   *xyz{ARRAY} = [1,2,3];
> 
> Okay, my turn to be the newbie.  I've been programming in perl for 7 years 
> and thought I understood typeglobs -- but I've never seen the above syntax.
> I think I can see what it's doing, but I don't really know how to parse it.
> 
> Where can I get more information on this use of typeglobs?  Is it in Camel 
> 3?  What version of perl introduced it?

As for Camel 3, this is mentioned on pp 295-296 in the sub-chapter
"Symbol Tables". perlref.pod mentions it under "Making References",
point 7.

Don't know, though, when it was introduced. Damian's "Objected Oriented
Perl" already knows about it so it must have been there in Perl 5.005 at
the very least.

Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: 8 Oct 2002 07:19:33 -0700
From: mdrons@yahoo.com (Mike)
Subject: help with perl map???
Message-Id: <19a14a2c.0210080619.104fd9a2@posting.google.com>

Can someone please tell me what this is doing?

map {$_ = ['re', $_]} @args;

What else is needed?


Thank you.

Mike


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

Date: Tue, 8 Oct 2002 12:28:26 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: net::pop3 problem
Message-Id: <qgfuna.frp.ln@moldev.cmagroup.co.uk>

Jerry Preston <g-preston1@ti.com> wrote:
> OK!

Please don't top-post. Search google to find out why not.

> Here is the complete script that I copied from the web:

It seems to work fine for me. You have configured the servername,
username, and password values correctly, haven't you?

> I get the error:
> "Couldn't log on to server"

I'll bet you don't. You're more likely to have got the error "Couldn't
log on to server at XXX line NN", where XXX is the name of the program
and NN is the relevant line number.

You *must* be specific, correct, and complete when quoting error
messages. Trying to shortcut stuff when you're not sure of the situation
leads to ambiguity (and therefore probably wrong solutions to your
problem).

It looks like you haven't specified the server name correctly.

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: 8 Oct 2002 06:24:26 -0700
From: samara_biz@hotmail.com (Alex)
Subject: Re: newb here learning Perl
Message-Id: <c7d9d63c.0210080524.7c6e8bff@posting.google.com>

> I hope to learn and become proficient at Perl

www.perlmonks.com has a lot of useful info including FAQs as well.


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

Date: Tue, 8 Oct 2002 09:30:01 -0500
From: "Rick Hedin" <rhedin@aquifer.geology.uiuc.edu>
Subject: On Windows:  if ($pid = open(CHILD, "|-")) {
Message-Id: <uWBo9.34419$m7.318594@vixen.cso.uiuc.edu>

Hello all.

The line mentioned in the subject line doesn't work on Windows.  I got it
out of The Perl Cookbook, so it probably works on Unix.

Is there some equivalent expression that works on Windows?  I would like to
do some "create a child process and communicate with it using pipes" stuff
on Windows.  Best of all is if somebody has some code that already does that
on Windows that they're willing to share.


        Regards,

        Newbie




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

Date: Tue, 8 Oct 2002 12:34:17 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: Perl shortcut question
Message-Id: <prfuna.frp.ln@moldev.cmagroup.co.uk>

Bryan <bryan@akanta.com> wrote:
> Just out of curiosity, is there any way in perl [...] so that it does
> something more like this:

> if ( -e "file1.txt" || -e "file1.txt" ) {
> 	# Do something to existing file
> 	# Maybe some perl special var?
> }

	if ( -e ($a = "file1.txt") || -e ($a = "file1.txt") ) {
	    # Do something to existing file
	    print "Using $a\n";
	}

Yet another possibility,
Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Tue, 8 Oct 2002 14:52:58 +0000 (UTC)
From: Nan Wang <nwang@panix.com>
Subject: Re: Problem with SIG handling on WinNT
Message-Id: <anurga$i19$1@reader1.panix.com>

Alan J. Flavell <flavell@mail.cern.ch> wrote:
> On Oct 7, Nan Wang inscribed on the eternal scroll:

>> sub handler {
>>     my $sig=shift;
>>     print "Caught SIG$sig\n";
>>     exit 0;
>> }

> perldoc -q SIG

>> I'm using ActivePerl 5.6.1, build 633, on a Windows NT box.

> I can't speak to that specific configuration, but speaking in general
> terms: you need to find another way.  Hard to say what it is without
> knowing your real-world intentions, but I'd recommend careful study of
> perlipc, and any Windows-specific documentation that comes with your
> package.

Actually, perlipc has an almost identical example in there.  It also fails
if sub handler consists of only exit 0.  I happen to have a PERL 5.001 
installation around, and the code works with that.  So I think it's a bug
with 5.6.1.


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

Date: Tue, 08 Oct 2002 12:58:59 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: sendmail and perl
Message-Id: <20021008.125859.1273911899.1006@richg.richg.zync>

s/Remote/Restricted/


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

Date: Tue, 08 Oct 2002 13:55:49 GMT
From: Garry Williams <garry@ifr.zvolve.net>
Subject: Re: Split a string
Message-Id: <slrnaq5oot.rad.garry@zfw.zvolve.net>

On 7 Oct 2002 23:19:42 -0700, Dmitry <Dmitry_Babich@icomverse.com> wrote:
> Hi all
> 
> I have a string that should be split to array of lines according to the following:
>    (1) newline donates end of the current line
>    (2) each line should be not longer than 5 characters and line can
>        split a word
> 
> E.g. String "abc\n12 45678" (Assume that there is no words longer than 5 characters)
>      Line[0] = "abc"
>      Line[1] = "12 "
>      Line[2] ="45678";
> 
> P.S.
> The question is not just theoretical. 
> Consider utility that receives a string and should display it 
> on the screen with 5 columns. We don't want the utility 
> to split words, hence thus 2 condition. First condition is obvious.

I think this is what you want: 

  my $string = "abc\n12 45678";
  my @words = split /\s+/, $string;

-- 
Garry Williams


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

Date: Tue, 08 Oct 2002 17:01:10 +0200
From: =?UTF-8?B?Sm9oYW5uZXMgRsO8cm5rcmFueg==?= <johannes.fuernkranz@t-online.de>
Subject: synonymous subroutines
Message-Id: <anus34$ijn$07$1@news.t-online.com>

Hi,

I want to have two subroutines in a package that do exactly the same 
thing. It's just that there are two names for the thing.

So, my first thought was to define a and simply set the type glob of b 
to a, like this:

*b = *a;

That works, but it has the effect that it will also treat $b and $a as 
synonymous which makes me feel a bit uncomfortable.

So what I really want is to only set the &-entry in the type glob table. 
So I tried:

&b = &a;

This also works, but gives a warning:

$ perl -e 'sub a { print "a"; }; &b = &a; b();'
Can't modify non-lvalue subroutine call at -e line 1.
a

What would be the correct way of doing that?

thx, Juffi


PS: Did you know that 'lvalue' and 'type' are no keywords in the FAQ, 
and that 'glob' only gives you pointers to the file-glob? :-)



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

Date: 8 Oct 2002 07:09:56 -0700
From: deita@inbox.lv (deita)
Subject: udp
Message-Id: <9899055d.0210080609.64d3f90b@posting.google.com>

Hello,

here is one problem i am trying to solve.
application1 creates udp server and reads messages from it,
also it creates udp client socket and every 5 sec sends message.
application2 is a copy of app1 with only swapped server and client socket ports.

executing theese two apps within interval 5 sec both applications exchanges
messages successfuly. execing them with a little larger timeout, the first one
does not send messages to the second.

so, i need to send messages to server whenever, even the server does not exist.

here is my code:
---------------
#!/usr/bin/perl

use IO::Socket;
use IO::Select;
$recv = 2801;
$send = 2901;

$server = IO::Socket::INET->new(
  LocalPort => $recv,
  Proto     => "udp",
  Reuse     => 1,
) or die("cant create server on $recv");

$client = IO::Socket::INET->new(
  PeerAddr => "127.0.0.1",
  PeerPort => $send,
  Proto    => "udp",
  Reuse     => 1,
) or die("cant create server on $recv");

$SIG{ALRM} = sub {
  print $client "Alarmed\n";
  alarm(5);
};
alarm(5);

$sel = IO::Select->new($server);
while (1) {
  if ($sel->can_read(0)) {
    $server->recv($data, 1024);
    print "received: $data";
  }
}
---------------

Thanx.


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

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


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