[7407] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1032 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 16 13:48:46 1997

Date: Tue, 16 Sep 97 10:00:36 -0700
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, 16 Sep 1997     Volume: 8 Number: 1032

Today's topics:
     Re: &&/|| vs. and/or (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Addition to NO SPACE <jjune@midway.uchicago.edu>
     Animated GIF problem in Perl <vanburen@3dlinks.com>
     apology <jefpin@bergen.org>
     Date & Time handling library wanted <tarnold@access.ch>
     Re: Date & Time handling library wanted (Jeremy D. Zawodny)
     Dereferencing Problem ... <sgermain@nortel.ca>
     Re: does \1 \2 \3 work?  -- found it !? <eike.grote@theo.phy.uni-bayreuth.de>
     Re: does \1 \2 \3 work? (my mistake is..where..?) <merlyn@stonehenge.com>
     Re: does \1 \2 \3 work? (my mistake is..where..?) <rootbeer@teleport.com>
     Re: does \1 \2 \3 work? (my mistake is..where..?) <rootbeer@teleport.com>
     Re: Failing one test <rootbeer@teleport.com>
     Re: How do I check who is connected to my socket? (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: How to include my personal Perl libraries (Marco Goetze)
     How to setup list as class data member <sgermain@nortel.ca>
     Re: is there a better way to do this subroutine? (Andrew M. Langmead)
     multiple interpreter locations? jg@physics.dcu.ie
     Re: multiple interpreter locations? <rootbeer@teleport.com>
     NO SPACE <jjune@midway.uchicago.edu>
     Re: NO SPACE (Jeremy D. Zawodny)
     PERL 5 on NT using condition code <gilbert@dcbc.com>
     Re: Perl Sockets (Greg Bacon)
     Re: Q: locking a dbm-file <rootbeer@teleport.com>
     Re: Q:here document (Marco Goetze)
     Re: Q:here document <flavell@mail.cern.ch>
     Re: Submit Using Image (Chris Russo)
     test <Stoner3@boat.bt.com>
     To delete a file <Stoner3@boat.bt.com>
     Re: To delete a file <rootbeer@teleport.com>
     Re: To delete a file <westxga@ptsc.slg.eds.com>
     Re: why exec finger doesnt work!!!?? <fawcett@SPAMLESS.nynexst.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Sep 97 11:40:30 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: &&/|| vs. and/or
Message-Id: <341ea923$3$ofn$mr2ice@speaker.kf8nh.apk.net>

In <341D4569.9834A315@york.ac.uk>, on 09/15/97 at 03:25 PM,
   Russell Odom <rjo100@york.ac.uk> said:
+-----
| Is there any difference between using the '&&' and '||' operators as opposed
| to 'and' & 'or'?
+--->8

"and" and "or" have lower precedence than && and ||:  if you use &&/|| to the
right of a list operator they operate on the list arguments, not on the result
of the list operator.  "and" and "or" will operate on the result, which is
probably what's intended in that case.

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)           FORZA CREW!
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org



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

Date: Tue, 16 Sep 1997 16:17:34 GMT
From: Joseph June <jjune@midway.uchicago.edu>
Subject: Addition to NO SPACE
Message-Id: <Pine.GSO.3.95.970916111207.23195A-100000@harper.uchicago.edu>

Upon request... here is what i am trying to do.. 

in my format output... i am defining the picture as

format tranx = 

 :install (
                        : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                         $install_code;
                                @<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                $type;
                                @<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                $color;
                                @<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                $name;

)
 .




when i define $install_code = "name"
and $type = ":something";
and $color = "";
and $name = ":anything";

then i need the output to be 

:install (
			name
				:something
				:anything	
)

but I am getting 

:install (
			nam
				:something

				:anything
)

i'm pretty sure i'm doing something terribly stupid here... so if anyone
can point it out... it will be greatly appreciated... 
 
thanks!

Joseph June
The University of Chicago
Anesthesia and Critical Care
Phone: 773-834-1450 or 773-834-0885
Fax: 773-702-1182




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

Date: Sun, 14 Sep 1997 19:18:53 -0400
From: Mark Van Buren <vanburen@3dlinks.com>
Subject: Animated GIF problem in Perl
Message-Id: <341C70DD.1D9C07CE@3dlinks.com>

I've written a really simple script whose only job in life is to pass
back an image from a query_string call.

Example: In the HTML file

<IMG SRC="http://www.myserver.com/cgi-bin/image.pl?image.gif">

image.pl

#! /usr/local/bin/perl
$basedir="http://www.myserver.com/images/";
$file = (ENV{QUERY_STRING});
print "Location: $basedir$file\n\n";

This works and passes the image back, but if it's an animated gif, it
only animates one cycle, then stops (NAV3/4) works fine under MSIE.

Anyone have any idea why NAV3/4 doesn't recognize it as an animated gif,
and let it loop?

Thank-you,

Mark Van Buren
vanburen@3dlinks.com



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

Date: Tue, 16 Sep 1997 11:23:41 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
Subject: apology
Message-Id: <Pine.SGI.3.95.970916112142.9862A-100000@vangogh.bergen.org>


It's Jeff, also known as the problem child.  I am sorry for giving out
more bad advice than good advice on this Perl newsgroup.  I realize that I
may not always be right, and certain in certain instances it may be a
matter of style of coding, and I will try to better my knowledge of Perl
in order to give more accurate responses.

Phoenix - thanks for the first warning...

----------------
| "I am just so full of it!"
| 	- Josh Ludzki
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **

- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y? 



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

Date: Tue, 16 Sep 1997 17:43:26 +0200
From: Thomas Arnold <tarnold@access.ch>
Subject: Date & Time handling library wanted
Message-Id: <341EA916.2EBE7ECC@access.ch>


Hi,

I'm a Perl 5 novice programmer and right now I'm writing a bunch of
CGI scripts for Forms handling. I have trouble finding a good library
or routine for manipulating and checking dates. Simple functions such
as checking whether a user-entered date is valid, add or subtract a
certain number of days/weeks/months/years to or from a date, the
difference between two dates, etc. seem to be missing from the
standard Perl library. The few libraries I found in Perl Archives
(date.pl, time.pl, etc.) don't cover those basic date handling
functions. Does anybody know where to get a Perl library or routine?
Thanks for any help.

Thomas Arnold



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

Date: Tue, 16 Sep 1997 16:14:33 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Date & Time handling library wanted
Message-Id: <3420b02d.10176362@igate.hst.moc.com>

[cc'd automagically to original author]

On Tue, 16 Sep 1997 17:43:26 +0200, Thomas Arnold <tarnold@access.ch>
wrote:

>I'm a Perl 5 novice programmer and right now I'm writing a bunch of
>CGI scripts for Forms handling. I have trouble finding a good library
>or routine for manipulating and checking dates. Simple functions such
>as checking whether a user-entered date is valid, add or subtract a
>certain number of days/weeks/months/years to or from a date, the
>difference between two dates, etc. seem to be missing from the
>standard Perl library. The few libraries I found in Perl Archives
>(date.pl, time.pl, etc.) don't cover those basic date handling
>functions. Does anybody know where to get a Perl library or routine?

This is stretching my brain a bit, but there was one called DateCalc
(or maybe Date::Calc) available on CPAN. It does virtually all of what
you're looking for. :-)

  http://www.perl.com/CPAN

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Tue, 16 Sep 1997 11:57:31 -0400
From: "Sylvain St.Germain" <sgermain@nortel.ca>
Subject: Dereferencing Problem ...
Message-Id: <341EAC6B.41C@nortel.ca>

Hi,

Here it is:

  @ValidValues = (qw/ a b c/);

I do:
  sub new {
   ...
   $self->{Values} = \@ValidValues;
   ...
  } 

The question is:

Why the he*l any of the below code work?

With $toto being an instance of the class

  foreach $item (@($toto->{Values}))  ## BAD
  foreach $item (@{$toto->{Values}})  ## BAD too
  foreach $item (${$toto->{Values}})  ## BAD too
  foreach $item ($($toto->{Values}))  ## ERROR

>From what I read in Ch 4 244-250 in Camel 
blue book guess 1 should work..????

Regards,
Sylvain.


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

Date: Tue, 16 Sep 1997 15:56:12 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: does \1 \2 \3 work?  -- found it !?
Message-Id: <341E8FFC.15FB@theo.phy.uni-bayreuth.de>

Hi,

I just found out that '\1' in a character class means a character
with ASCII code '1' (and not a backreference):

  #!/usr/local/bin/perl -w

  $s = "x\001";
  $s =~ /^([x])([\1])/;

  if($2 eq "\001") { print "\$2 = \\001\n" }


Bye, Eike
-- 
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: 16 Sep 1997 07:24:02 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: freytag@freytag.org (Richard Freytag)
Subject: Re: does \1 \2 \3 work? (my mistake is..where..?)
Message-Id: <8c202pwd4t.fsf@gadget.cscaper.com>

>>>>> "Richard" == Richard Freytag <broken-to-avoid-junkmail-remove-this-freytag@remove.me.too.freytag.org> writes:

Richard> There is an easy way to do match multiple vowels but I decided to use
Richard> the memory capability of the () in a match to be tricky.  Therefor I
Richard> stumbled on the following problem....

Richard> Run the following and you should see that the vowels get pulled out
Richard> of _all_ the example strings and matched.  But in the last 6 cases
Richard> they don't; please why?

[snip]

Richard> m|^(?:[$consonants])*([aeiou])(?:[$consonants\1])*([^consonants\1])(?:[$cons
Richard> onants\1\2])*([^consonants\1\2])(?:[$consonants\1\2\3])*$|i){

Yes.   \1 inside a character class is not a backreference, but merely
the character control-A (\001).  There is no way to get a backreference
into a character class.  (Think of the characters of a class as "compile
time" and a backreference as "run time".)

You *can* do something clever with (?!\1), but it'll probably be slow.
Try something like this:

     ^[$cons]*([aeiou])(?:[$cons]|\1)*((?:[$cons]|\1))(?:[$cons]|\1|\2)*
     (?![$cons]|\1|\2)*

and so on.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 350 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 16 Sep 1997 07:37:13 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: does \1 \2 \3 work? (my mistake is..where..?)
Message-Id: <Pine.GSO.3.96.970916073610.23419E-100000@julie.teleport.com>

On Mon, 15 Sep 1997, Richard Freytag wrote:

> m|^(?:[$consonants])*([aeiou])(?:[$consonants\1])*([^consonants\1])(?:[$cons
> onants\1\2])*([^consonants\1\2])(?:[$consonants\1\2\3])*$|i){

You can't put backreferences into character classes, so you're putting in
control characters (\002 is ctrl-B) instead. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 1997 07:35:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: does \1 \2 \3 work? (my mistake is..where..?)
Message-Id: <Pine.GSO.3.96.970916073423.23419D-100000@julie.teleport.com>

On Tue, 16 Sep 1997, Eike Grote wrote:

>    $s =~ /^([x])([\1])/;          # (like in the original posting)

Can't use backreferences in a character class; that's a control-A (\001) 
in there. Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 1997 07:43:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nagu Sitttampalam <n.sittampalam@southampton.gov.uk>
Subject: Re: Failing one test
Message-Id: <Pine.GSO.3.96.970916074158.23419H-100000@julie.teleport.com>

On 16 Sep 1997, Nagu Sitttampalam wrote:

> I am trying to install perl v5.003 on a SUN Solaris 2.5.1 machine. I am
> getting one test which is failing

> lib/dirhand....FAILED on test 3

> Can anybody give me a clue as to what is missing or what I have not done
> to get this error. 

Try runnig that test individually, perhaps with the harness program, to
see whether it gives any useful diagnostics. If it doesn't, edit it to
make it give some. :-)  Better yet, try installing 5.004 and see whether
things work for you there. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 97 11:45:02 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: How do I check who is connected to my socket?
Message-Id: <341eaa11$4$ofn$mr2ice@speaker.kf8nh.apk.net>

In <341E8A72.8949D73E@mekb2.sps.mot.com>, on 09/16/97 at 02:32 PM,
   Michael Scott <michaels@mekb2.sps.mot.com> said:
+-----
| I am in the process of writing my first client-server programs with sockets,
| but have encountered a problem. I can check what (remote) machine connected
| to the server port, but cannot find a simple way of finding out who owns the
| remote (client) process. Any suggestions?
+--->8

There is no really simple way, because it's not available as such:  you have
to query identd on the remote machine (and be ready to deal with the remote
not running identd, in which case you're SOL).

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)           FORZA CREW!
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org



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

Date: Tue, 16 Sep 1997 13:47:38 GMT
From: <gomar@mindless.com> (Marco Goetze)
Subject: Re: How to include my personal Perl libraries
Message-Id: <341e8d15.702657@news.iks-jena.de>

On Mon, 15 Sep 1997 17:42:35 -0700, Andrew Dear
<dear_andrew@jpmorgan.com> wrote:
>I would like to have my perl libraries in a sub directory sitting under
>the perl script that will be run from the command line.
>eg. 	/something/bin/my_perl_script      which uses the library
>	/something/bin/my_perl_libraries/my_lib_1.pl
>my_perl_script then contains the generic line:
>use lib './my_perl_libraries';
>require 'my_lib_1.pl';
>Any ideas? Any better ways to avoid hard coding a library directory
>path?

In case you wish to avoid hard-coding the path at any rate, you might
extract the script's path from the $0 variable. Unfortunately, this
value doesn't reflect an absolute path, but rather the file's location
with respect to the current working directory.  Anyway, pushing that
directory plus your sub dir onto @INC should work, provided that you
didn't chdir() until then. Hence,

  $0 =~ m#[/\\]?[^/:\\]+$#;  # be M$-friendly
  $_ = $` || '.'; # avoid trouble if called "perl scriptname_w/o_path"
  push @INC, "$_/my_perl_libraries";
  require 'my_lib_1.pl';

Of course hard-coding the directory would be a safer approach.

HTH;

Marco


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

Date: Tue, 16 Sep 1997 11:09:46 -0400
From: "Sylvain St.Germain" <sgermain@nortel.ca>
Subject: How to setup list as class data member
Message-Id: <341EA13A.2FA2@nortel.ca>

Hi,

In my constructor I do:

   my $self = $class->SUPER::new(@args);
    $self->{ValidActions} =  
      ("Print",
      "Add",
      "Remove",
      "Install",
      "Save Information",
      "Delete");

This does not work because of the scalar context of
$self->{ValidActions} (I think)

My question is: How can I have list 
assigned to a datamember in the above context??

I would like to be able to do:

foreach $thing ($myobj->{ValidActions}) {
	...
}

Many Regards,
Sylvain.


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

Date: Tue, 16 Sep 1997 14:44:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: is there a better way to do this subroutine?
Message-Id: <EGLvM0.6Ht@world.std.com>

"Raymond K. Bush" <rbush@up.net> writes:

>How do you mean unreliable (more reliable?) as you imply this. Is my
>type glob going to fail on the 10000th itteration or something? Are you
>talking about the memory leak thing?

The problems that I see are code maintainance issues.

*foo = *bar; 

Not only affects @foo, but also , $foo, %foo, the subroutine foo, and
the filehandle foo.

Typeglobs also imply using dynamically scoped variables, which then
lead to problems like "variable suicide." (Its been a long time since
variable suicide was discussed in this newsgroup. Another reason to be
thankful for perl 5.)

You also have the fact that references keep a reference count, so that
if you have a reference, you can be sure that the variable that it
references hasn't gone out of scope.

I have some old code that still uses typeglobs. It still works, and I
try not to muck with it too much. New stuff I use references instead.

-- 
Andrew Langmead


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

Date: Tue, 16 Sep 1997 10:01:57 -0600
From: jg@physics.dcu.ie
Subject: multiple interpreter locations?
Message-Id: <874421701.22450@dejanews.com>

I have a perl script that is in a shared file system.  The
different machines that have access to this script have
perl in different locations.  Is there a way that I can put
a list of locations to look for the perl interpreter instead
of simply #!/usr/bin/perl etc?

Can you CC a copy of your reply directly to me please?

Thanks,

			Jonathan

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 16 Sep 1997 08:44:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: jg@physics.dcu.ie
Subject: Re: multiple interpreter locations?
Message-Id: <Pine.GSO.3.96.970916083425.23419O-100000@julie.teleport.com>

On Tue, 16 Sep 1997 jg@physics.dcu.ie wrote:

> I have a perl script that is in a shared file system.  The different
> machines that have access to this script have perl in different
> locations.  Is there a way that I can put a list of locations to look
> for the perl interpreter instead of simply #!/usr/bin/perl etc? 

The best thing to do is to make some standard location hold a symlink to
the real Perl binary. I recommend using /usr/bin/perl or
/usr/local/bin/perl for this purpose. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 1997 15:02:47 GMT
From: Joseph June <jjune@midway.uchicago.edu>
Subject: NO SPACE
Message-Id: <Pine.GSO.3.95.970916100011.28817B-100000@harper.uchicago.edu>

Hello... 

how do you specify your variable to return nothing?  for example right
now... when i 

$variable = "test;
$variable1 = "";
$variable2 = "test";

returns

test

test


but want it to return

test
test


it returns a blank line in its formated output.... i don't want to have
that blank line there... but can't figure out what i can put to return
nothing... 

any help you can provide would be most appreciated.

thanks.

Joseph June
The University of Chicago
Anesthesia and Critical Care
Phone: 773-834-1450 or 773-834-0885
Fax: 773-702-1182




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

Date: Tue, 16 Sep 1997 16:07:22 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: NO SPACE
Message-Id: <341eae8c.9759723@igate.hst.moc.com>

[cc'd automagically to original author]

On Tue, 16 Sep 1997 15:02:47 GMT, Joseph June
<jjune@midway.uchicago.edu> wrote:

>Hello... 
>
>how do you specify your variable to return nothing?  for example right
>now... when i 
>
>$variable = "test;
>$variable1 = "";
>$variable2 = "test";
>
>returns
>
>test
>
>test
>
>
>but want it to return
>
>test
>test
>
>
>it returns a blank line in its formated output.... i don't want to have
>that blank line there... but can't figure out what i can put to return
>nothing... 

It sounds like a problem with the way you're formatting the output,
not the way Perl represents "" in a variable.

Post the code, and we might have a better handle on where things have
gone astray.

Jeremy
-- 
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio

http://www.marathon.com/

Unless explicitly stated, these are my opinions only--not those of my employer.


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

Date: Tue, 16 Sep 1997 11:43:23 -0500
From: Gilbert Hu <gilbert@dcbc.com>
Subject: PERL 5 on NT using condition code
Message-Id: <341EB72B.DC32F4A7@dcbc.com>

Anyone has a good way to write PERL code based on success or failure of
an NT script?
For example, if "ping host1" fails then do something...



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

Date: 16 Sep 1997 15:28:16 GMT
From: gbacon@adtran.com (Greg Bacon)
To: Dexter Plameras <dexterp@acay.com.au>
Subject: Re: Perl Sockets
Message-Id: <5vm8ig$fb4$1@info.uah.edu>

[Posted and mailed]

In article <341E6C88.61F7A836@acay.com.au>,
	Dexter Plameras <dexterp@acay.com.au> writes:
: I'm trying to write a network socket that will all for two way
: communication between programs.

Do it the easy way with modules from Graham Barr's IO distribution.
>From the IO::Select(3) manpage:

    use IO::Select;
    use IO::Socket;
    
    $sel = new IO::Select( $lsn );
    $lsn = new IO::Socket::INET(Listen    => 1,
                                Proto     => 'tcp',
                                LocalPort => 8080);
    
    while(@ready = $sel->can_read) {
        foreach $fh (@ready) {
            if($fh == $lsn) {
                # Create a new socket
                $new = $lsn->accept;
                $sel->add($new);
            }
            else {
                # Process socket
    
                # Maybe we have finished with the socket
                $sel->remove($fh);
                $fh->close;
            }
        }
    }

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Tue, 16 Sep 1997 07:40:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Trudno zhit' v derevne bez nagana." <alex@kawo2.rwth-aachen.de>
Subject: Re: Q: locking a dbm-file
Message-Id: <Pine.GSO.3.96.970916073957.23419G-100000@julie.teleport.com>

On 15 Sep 1997, Trudno zhit' v derevne bez nagana. wrote:

> can anyone advise me a nice way to lock a dbm-file.

The docs for your DBM module should explain this. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 1997 13:47:37 GMT
From: <gomar@mindless.com> (Marco Goetze)
Subject: Re: Q:here document
Message-Id: <341e7825.4694219@news.iks-jena.de>

On 16 Sep 1997 04:46:32 GMT, "Jerry Xia" <jxia@worldnet.att.net>
wrote:
>I am trying to run Oracle SQL command in perl script. In shell, I can use
>something like:
>	sqlplus user/passwd <<!
>	select * from my_table;
>	...
>	!

  open FILE, '|sqlplus user/passwd';
  print FILE<<EOT;
  select * from my_table;
  ...
  EOT
  close FILE;

Note the trailing semicolon after the first occurrence of the here-doc
delimiter. Also, an exclamation mark won't work as a delimiter; choose
a sequence of letters instead.

HTH;

Marco


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

Date: Tue, 16 Sep 1997 14:34:20 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Q:here document
Message-Id: <Pine.A41.3.95a.970916162416.30750E-100000@sp052>

On Tue, 16 Sep 1997 gomar@mindless.com wrote:

>   print FILE<<EOT;
>   select * from my_table;
>   ...
>   EOT
  ^^
I can't help feeling that it was inadvisable to exhibit this standard
stuff with an indent.  Either send them to the documentation, or tell
them explicitly yourself that the terminator must be the ONLY thing on
the line, nothing visible _nor_ invisible fore and aft of it, since this
seems to be the commonest error with a here document. 




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

Date: Tue, 16 Sep 1997 08:59:41 -0700
From: news@russo.org (Chris Russo)
Subject: Re: Submit Using Image
Message-Id: <news-1609970859410001@buzz.alink.net>


In article <341E7C59.4DCA@cris.com>, cwyatt@cris.com wrote:

[...]
>Hmmm, I thought most folks understood that Perl is the language of
>choice for form processing?  That's why I'm posting to a perl newsgroup.
>
>If HTML authoring covered the topic, I wouldn't be here.
>
>A bit over-policing, I'm afraid!
>
>Charles

Ya know, you're right!  I've been interested in meeting women lately.  Why
don't I go hang out in the ladies' restroom?  I'll meet tons of babes
then!

Thanks, Chuck!

Let's see if you can spot the oversight that leads to the above reasoning.

(Hint, it has something to do with "appropriateness")

Regards,

Chris Russo

PS  I was actually trying to help you by letting you know where your post
may be more well received.  HTML authoring has everything to do with your
original question... ah well.

----------------------------------------------------------------------
Chris Russo                          A-Link Network Services, Inc.
news@russo.org                       Bolo me
http://www.alink.net/~crusso


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

Date: Tue, 16 Sep 1997 16:20:09 +0100
From: RobStone <Stoner3@boat.bt.com>
Subject: test
Message-Id: <341EA3A9.703A@boat.bt.com>

This is a test message - please ignore


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

Date: Tue, 16 Sep 1997 15:06:14 +0100
From: RobStone <Stoner3@boat.bt.com>
Subject: To delete a file
Message-Id: <341E9256.33C3@boat.bt.com>

How do I delete a file - or in general - how do I perform disk
operations in Perl ?


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

Date: Tue, 16 Sep 1997 08:15:36 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: RobStone <Stoner3@boat.bt.com>
Subject: Re: To delete a file
Message-Id: <Pine.GSO.3.96.970916081511.23419L-100000@julie.teleport.com>

On Tue, 16 Sep 1997, RobStone wrote:

> How do I delete a file - or in general - how do I perform disk
> operations in Perl ?

You can use some of the useful functions documented in the perlfunc(1)
manpage. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 1997 11:29:02 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: To delete a file
Message-Id: <341E6D7E.46CA@ptsc.slg.eds.com>

RobStone wrote:
> 
> How do I delete a file 
unlink(LIST)
>- or in general - how do I perform disk
> operations in Perl ?
RTFM


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

Date: 16 Sep 1997 10:15:30 -0400
From: Tom Fawcett <fawcett@SPAMLESS.nynexst.com>
Subject: Re: why exec finger doesnt work!!!??
Message-Id: <8jpvq9ibul.fsf@SPAMLESS.nynexst.com>

Nadeem Rana <nrana@aludra.usc.edu> writes:
> I have some user Ids in a file temp. I am writing a simple perl script but
> it doesnt work.
> Heres the script
> 
> 	#!/usr/bin/perl
> 	while($_ = <ARGV>){
> 	 chop($_);
> 	 exec 'finger', $_;
> 	}
> but it runs finger ONLY on the first user id in temp. Could you please
> help me why is it doing so?

Look up the exec function in the on-line documentation ("man perlfunc").
Read the first sentence.
Then read the second sentence.

-Tom


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1032
**************************************

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