[9788] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3380 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 6 17:06:48 1998

Date: Thu, 6 Aug 98 14:00:26 -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           Thu, 6 Aug 1998     Volume: 8 Number: 3380

Today's topics:
    Re: 'use' and import issue <jdporter@min.net>
    Re: [Q] copy Hash to temp Hash, change temp & not the o (Greg Bacon)
    Re: [Q] copy Hash to temp Hash, change temp & not the o (Craig Berry)
        [Q] Problems building perl 5.004_4 on SGI <kj0@mailcity.com>
    Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (I R A Aggie)
    Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (brian d foy)
    Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in <jnoble@mediaone.com>
    Re: Anybody know what the valid parameters to Ev() are? <rootbeer@teleport.com>
    Re: c.l.p.moderated: not much traffic? <jdporter@min.net>
    Re: c.l.p.moderated: not much traffic? (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: c.l.p.moderated: not much traffic? (brian d foy)
    Re: c.l.p.moderated: not much traffic? (Matt Knecht)
        code problem <jtoye@vt.edu>
    Re: code problem (Mark-Jason Dominus)
    Re: code problem (brian d foy)
    Re: Directory size (including all clilt files / dirs) - (Martin Vorlaender)
    Re: Extracting data from Lotus Notes with Perl? <rootbeer@teleport.com>
    Re: help a newbie, please! <jdporter@min.net>
    Re: help a newbie, please! <jdporter@min.net>
    Re: HELP: programming with Comm.pl & program structure (Ken Irving)
        help? writing a SMTP mail program using telnet... <look@this.hak>
    Re: How to Overcome Module Name Changes chuckk@monmouth.com
    Re: How to Overcome Module Name Changes (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: I want to separate my Perl from my HTML <orangutan@grungyape.com>
    Re: Installing Additional Packages in ActivePerl chuckk@monmouth.com
    Re: MAJOR PROBLEMS (Andy Lester)
    Re: modules and mounted disks (Greg Bacon)
    Re: perl 5.005: Binary Distribution for Win32? chuckk@monmouth.com
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 06 Aug 1998 15:50:31 -0400
From: John Porter <jdporter@min.net>
Subject: Re: 'use' and import issue
Message-Id: <35CA0907.7F81@min.net>

Niklas Matthies wrote:
> 
> In comp.lang.perl.misc, John Porter <jdporter@min.net> writes:
> > Niklas Matthies wrote:
> >>
> >> Often it is the case that I use a couple of functions from some module Foo
> >> within a few functions/methods (say, fun1 to fun3) of module Bar (Foo may
> >> be a collection of some utility functions, for example).
> >> For notational convenience, I'd like too 'use' Foo in those places, rather
> >> than only 'require' it, to have some functions of Foo imported into the
> >> namespace within fun[1-3].

I guess my point is, it sounds to me like importing is the problem;
so probably the best way to go is to not import at all, and use full 
name qualification.

-- 
John Porter


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

Date: 6 Aug 1998 20:17:06 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: [Q] copy Hash to temp Hash, change temp & not the orig?
Message-Id: <6qd302$15f$16@info.uah.edu>

In article <6qcsim$8iq@bobo.shirenet.com>,
	crusader@bobo.shirenet.com (Scott Cherkofsky) writes:
: I want to keep a copy of the Hash variable in its original state before
: being changed by the rest of the code in my script.
: 
: I did this (see below) and for some reason both Hash variables got changed
: as if they were the same variable (or the execution of this code somehow
: happened after the original Hash was changed):
: 
:         %hOriginalFile = %hFile;

You didn't show us your code, but do you have references as values in
your hashes?  If you, you need to make a deep copy.

Greg
-- 
A Freudian slip is when you say one thing when you're thinking about a mother. 
    -- Cliff Clavin


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

Date: 6 Aug 1998 20:33:44 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: [Q] copy Hash to temp Hash, change temp & not the orig?
Message-Id: <6qd3v8$r2d$1@marina.cinenet.net>

Scott Cherkofsky (crusader@bobo.shirenet.com) wrote:
: I'm reading a file into a Hash variable and then doing some work on
: the Hash which changes its values.

And let me guess...the hash values are references, right?

: I want to keep a copy of the Hash variable in its original state before
: being changed by the rest of the code in my script.
: 
: I did this (see below) and for some reason both Hash variables got changed
: as if they were the same variable (or the execution of this code somehow
: happened after the original Hash was changed):
: 
:         %hOriginalFile = %hFile;
: 
: After that line in the file is where I do all my changes to %hFile but when
: I print out both of them, they both show the changes.
: 
: What's happening here?

If you build %hFile so that its values are references, then those same
references get copied over to the %hOriginalFile values -- that is, the
keys in each hash are 'pointing to' the *same* underlying values.  This is
often refered to as a 'shallow copy'.  What you want is a 'deep copy', in
which the two hashes don't share any storage.

There are two ways to go about doing this.  The first is to just build
%hFile and %hOriginalFile in parallel -- each time you set a key and build
a by-reference value for it in one hash, do the same operation (taking
care to create a separate by-reference value!) in the other.  This is
probably the easier approach.

The other way is to replace you simple hash assignment with an iterative
deep copy.  For each key in %hFile, create a copy of its value into a
new by-reference object and add that key and new value to %hOriginalFile.
Note that doing a general deep copy is hard, since it requires recursing
into arbitrary depths of contained objects, but if you have a fixed,
simple data structure it can be quite easy.

HTH...

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 6 Aug 1998 19:41:14 GMT
From: k y n n <kj0@mailcity.com>
Subject: [Q] Problems building perl 5.004_4 on SGI
Message-Id: <6qd0sq$so6@news1.panix.com>


Help!  Has anyone managed to build perl 5.004_4 on IRIX 6.3/mips 7.00?
I'm *almost* there, but the resulting executable bombs one test, bop.t
(bitwise operators).  In fact, it fails only 6 evaluations out of 18
in that test.  For example, it thinks (~0 > 0) is false.

The two top possibile explanations I can imagine are 1) I gave some
wrong answer during the configuration stage; or 2) there is some bug
in the mips 7.00 compiler.

FWIW, I've successfully built this version of perl on IRIX 6.2/mips
7.10, as well as on a couple version of Linux.

Does anybody know of an incompatiblity between perl 5.004_4 and the
above setup?  Is there a known, working config.sh for IRIX 6.3/mips
7.00 that I could use?

Thanks!

K.


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

Date: Thu, 06 Aug 1998 15:02:47 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <fl_aggie-0608981502470001@aggie.coaps.fsu.edu>

In article <comdog-ya02408000R0608981439380001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:

+ In article <35cae7ff.3770119@news.nask.org.pl>, cicho@polbox.com (Marek
Jedlinski) posted:

+ >I tried downloading the text/gzipped version from
+ >        http://language.perl.com/info/PerlDoc-5.005_02.txt.gz

+ yep:

Ummm...nope. I used lwp-rget and got a gzip compressed file. Its' large,
unwieldy, and in need of getting chopped up into more suitable chunks, but
entirely legible. As of 02:59:41 PM on 06 Aug 1998, GMT-0400.

If you click on the link, right button I think, and hold, you'll get a
menu. One of the options is "Save link to disk"...

James


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

Date: Thu, 06 Aug 1998 16:10:17 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <comdog-ya02408000R0608981610170001@news.panix.com>
Keywords: from just another new york perl hacker

In article <fl_aggie-0608981502470001@aggie.coaps.fsu.edu>, fl_aggie@thepentagon.com (I R A Aggie) posted:

>In article <comdog-ya02408000R0608981439380001@news.panix.com>,
>comdog@computerdog.com (brian d foy) wrote:
>
>+ In article <35cae7ff.3770119@news.nask.org.pl>, cicho@polbox.com (Marek
>Jedlinski) posted:
>
>+ >I tried downloading the text/gzipped version from
>+ >        http://language.perl.com/info/PerlDoc-5.005_02.txt.gz
>
>+ yep:
>
>Ummm...nope. 

i'm not sure why you are denying that it's sent as text/plain.
whatever your browser does won't change that.  

for some reason it breaks for some people.  we can try to figure
out why that is, or we can ignore the problem.  i prefer fixing
things...

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Thu, 6 Aug 1998 14:50:32 -0600
From: "Joel Noble" <jnoble@mediaone.com>
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qd4uq$2f9$1@kane.uswmedia.com>


brian d foy wrote in message ...
>yep:
>
>       HTTP/1.1 200 OK
>       Date: Thu, 06 Aug 1998 18:32:59 GMT
>       Server: Apache/1.2.6 mod_perl/1.11
>       Last-Modified: Mon, 03 Aug 1998 12:33:59 GMT
>       ETag: "feae-eb49f-35c5ae37"
>       Content-Length: 963743
>       Accept-Ranges: bytes
>       Content-Type: text/plain
>       Content-Encoding: x-gzip


Brian,

My first impression agrees with you.

However, on reading the HTTP 1.1 draft release 3
(http://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-rev-03.txt),
I have to say that the Content-Type is not the issue.  Apparently, the
content-type of text-plain, being what you get after you undo the
Content-Encoding, is reasonable and correct.

Not that I don't doubt that some browsers may look at the Content-Type and
ignore the Content-Encoding.  :(
That certainly wouldn't be the right HTTP 1.1 thing to do.

Also, however, and possibly at the heart of the issue, the draft-spec
identifies gzip as a known content-encoding, but not "x-gzip".  In section
3.5, it has a backwards-compatibility note, saying that "x-gzip" should be
assumed to the be same as "gzip".  Could this be the real issue?  Might the
browser support content-encoding of "gzip" but not "x-gzip"?  Anyone want to
make a test?

In any case, I have red-facedly come around to agreeing with Tom that the
configuration and headers ARE correct in a formal sense.  Certainly the
formal correctness of things in the HTTP/HTML world has been less a guide
than experience and testing, when working for the maximum number of people
on the wide ranging software out there.  Yet, we have to have a notion of
what "truly correct" is, and the draft seems to indicate that this is it.

Myself, I have been looking at content-type first and only, but I'll pay
more attention to Content-Encoding now and in the future.

I haven't re-directed followups, but I suggest that we do so if someone
wants to teach me MORE about this than I know so far. :)

Joel Noble
MediaOne Group




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

Date: Thu, 06 Aug 1998 20:53:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Anybody know what the valid parameters to Ev() are?
Message-Id: <Pine.GSO.4.02.9808061351090.6559-100000@user2.teleport.com>

On Thu, 6 Aug 1998, Mark J. Seger wrote:

> Subject: Anybody know what the valid parameters to Ev() are?

> The "Advanced Perl Programming" book tells me on pages 249-250 that
> there are over 30 to choose from but them only teases me with a couple.
> I've looked in a number of places and couldn't find any lists,
> anywhere.  

Since it's in a chapter about Tk, maybe the docs for Tk will help you out.
Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 06 Aug 1998 15:35:41 -0400
From: John Porter <jdporter@min.net>
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <35CA058D.657C@min.net>

John Klassa wrote:
> 
> Is it me, or is the traffic on c.l.p.moderated pretty much a
> trickle?

Maybe your sense of normal has been twisted by the daily
deluge on clp.misc. :-)

-- 
John Porter


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

Date: Thu, 06 Aug 1998 21:56:08 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <lassehp-0608982156090001@skuld.imv.aau.dk>

In article <6qco42$kga$1@supernews.com>, petdance@maxx.mc.net (Andy
Lester) wrote:

>: Pehaps clp.mod wasn't such a good idea after all, if noone wants to use it.
>
>Only in the Internet 90s can you find people deciding that because a
>worldwide anarchic gathering of people and resources hasn't gelled to hit
>an arbitrary standard that said gathering is a failure.

When the moderated group was discussed, I got the impression that many
people could hardly wait to switch to the new group, abandoning clp.misc.
This has not happened. I never said it was a failure, only time can tell
us that.

In any case there may be other reasons for the slow flow of clp.mod. We
just have to wait and see. (I think I've done my part, posting a question
about a script using pipes, which no longer works with threaded perl, for
which I can't seem to find an explanation.)

-Lasse


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

Date: Thu, 06 Aug 1998 16:28:16 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <comdog-ya02408000R0608981628160001@news.panix.com>
Keywords: from just another new york perl hacker

In article <lassehp-0608982156090001@skuld.imv.aau.dk>, lassehp@imv.aau.dk (Lasse Hillerxe Petersen) posted:

>In any case there may be other reasons for the slow flow of clp.mod. We
>just have to wait and see. (I think I've done my part, posting a question
>about a script using pipes, which no longer works with threaded perl, for
>which I can't seem to find an explanation.)

IMO, the people most in favor of clp.moderated are the ones that
don't ask questions very frequently, if at all.  furthermore, meta
discussion is absent.

it's also been my experience with mailing lists and such that most
of the people (the "Silent Majority" in Nixon-speak) lurk, so that
the number of messages isn't a reliable measure of worth.

it certainly doesn't hurt to have it. :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Thu, 06 Aug 1998 20:35:18 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <asoy1.2122$NJ5.6764673@news2.voicenet.com>

brian d foy <comdog@computerdog.com> wrote:
>it's also been my experience with mailing lists and such that most
>of the people (the "Silent Majority" in Nixon-speak) lurk, so that
>the number of messages isn't a reliable measure of worth.

I'm enjoying clpm just for the lurk value.  Not many threads, but most
of them have been interesting, and content rich.  Definitly a great
group.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Thu, 06 Aug 1998 15:41:28 -0400
From: Jessica Toye <jtoye@vt.edu>
Subject: code problem
Message-Id: <35CA06E7.47DFA817@vt.edu>

I am trying to implement some code that will count certain pattern's
occurances in a file using another file to tell what pattern to look
for.  Here's a snippet:

while ($pattern = <PATTERNS>) {
     chop ($pattern);
     $total = 0;
     while ($line = <FILETOSEARCH>) {
          $_ = $line;
          $total += tr/$pattern/$1/;
     }
     print ("Number of times $pattern shows up: $total \n");
}

It outputs all zeros when I know the patterns I am trying to match are
in there.  Any ideas?

abeuhrin@vt.edu



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

Date: 6 Aug 1998 15:47:31 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: code problem
Message-Id: <6qd18j$57d$1@monet.op.net>

In article <35CA06E7.47DFA817@vt.edu>, Jessica Toye  <jtoye@vt.edu> wrote:
>          $total += tr/$pattern/$1/;
>
>It outputs all zeros when I know the patterns I am trying to match are
>in there.  Any ideas?

Unlike the parameters in s/// and m//, the parameters in tr/// are not
interpolated; they are taken literally.


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

Date: Thu, 06 Aug 1998 16:19:54 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: code problem
Message-Id: <comdog-ya02408000R0608981619540001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35CA06E7.47DFA817@vt.edu>, jtoye@vt.edu posted:

>I am trying to implement some code that will count certain pattern's
>occurances in a file using another file to tell what pattern to look
>for.  Here's a snippet:


>while ($pattern = <PATTERNS>) {

i'm not sure what you're input data are like, but you might
want to check to make sure that $pattern is defined().  if
$pattern eq '0' you'll end your while() loop.  (but maybe you
want that?)

>     chop ($pattern);
>     $total = 0;
>     while ($line = <FILETOSEARCH>) {
>          $_ = $line;

what's the use of $line if you just want it in $_ ?

   while( <FILETOSEARCH> ) {

>          $total += tr/$pattern/$1/;

why tr/// instead of m//g?  i don't think tr/// does what you
think it does...

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Thu, 06 Aug 1998 21:29:45 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Directory size (including all clilt files / dirs) - help
Message-Id: <35ca0429.524144494f47414741@radiogaga.harz.de>

Jason Morehouse (jm@interlog.net) wrote:
: Anyone know the quickest way using non system calls to get the size of a
: directory and all of its contents (including all child directories / files)?

: I am using perl32 on NT server -- any functions, modules or otherwise
: possibilities are appreciated!

	sub dirsize {
	   my $dir = shift || '.';
	   opendir DIR, $dir or die "opendir: $!";
	   my @files = readdir DIR;
	   closedir DIR;
	   my $size = 0;
	   for my $filename (@files) {
	      next if $filename =~ /^\.\.?$/;
	      my $file = "$dir/$filename";
	      if (-f $file) {
	         $size += -s _;
	      }
	      elsif (-d _) {
	         $size += dirsize( $file );
	      }
	   }
	   return $size;
	}

	print dirsize('c:/temp');


Hope it helps,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 OpenVMS: Where do you    | work: mv@pdv-systeme.de
 want to BE today?        |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Thu, 06 Aug 1998 20:56:56 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Extracting data from Lotus Notes with Perl?
Message-Id: <Pine.GSO.4.02.9808061355430.6559-100000@user2.teleport.com>

On Thu, 6 Aug 1998 jfritsche@my-dejanews.com wrote:

> We have dumped Lotus Notes as a corporate app, but have quite a bit of
> data that we need to port to MS Access/MS SQL tables.  Most of it we
> are able to export.  The problem appears to be Rich Text fields.  
> Apparently, these cannot be added to views and thus cannot be
> exported.  Is there a way to connect to the Notes database so that a
> perl program could read these fields and dump them to a text file?

Perl can work with any data. Of course, you may need to find or make a
module which can work with that particular file format. If there's a
module which does what you want, it should be listed in the module list on
CPAN. If you don't find one to your liking, you're welcome and encouraged
to submit one! :-)  Hope this helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 06 Aug 1998 15:23:14 -0400
From: John Porter <jdporter@min.net>
Subject: Re: help a newbie, please!
Message-Id: <35CA02A2.110A@min.net>

mchunziker@us.fortis.com wrote:
> 
> Win95 doesn't use the #!/usr/bin/perl line.  It's a unix thing.

No, but perl.exe *does* look at that line, for command line options.


> I have heard that defining .pl extensions does not work in win95. 

You heard wrong.  I've done it, and it works.

-- 
John Porter


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

Date: Thu, 06 Aug 1998 15:28:06 -0400
From: John Porter <jdporter@min.net>
Subject: Re: help a newbie, please!
Message-Id: <35CA03C6.76DE@min.net>

Ha wrote:
> 
> Jianjun Feng wrote in message <35C96C4F.717A4F0D@hotmail.com>...
> >The first line in the script is written for unix system: something like
> >" #!/usr/bin/perl".  How can i do the same thing for win95, or can i do
> >it in win95 at all?

> create a folder called 'usr' directly under your c:\ directory or wherever
> your primary disk stuff is. reinstall Perl for Windows under c:/usr. When
> you're done, check that your directory tree resembles the shell path perl
> needs to automagically execute cgi scripts, ie. c:\usr\bin\perl.

This is totally wrong.  It won't work (unless you've intalled
CygWin, and are running the bash shell... and maybe not even then?)
Neither Win95, WinNT, nor any standard command processor on those
systems recognize the #! line.

-- 
John Porter


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

Date: Thu, 06 Aug 1998 21:22:52 GMT
From: jkirving@mosquitonet.com (Ken Irving)
Subject: Re: HELP: programming with Comm.pl & program structure
Message-Id: <35ca031c.12629109@news.mosquitonet.com>

On 6 Aug 1998 16:47:40 GMT, tigger@io.nospaam.com wrote:

>
>Well, I posted this on Monday, and I haven't gotten any responses, so
>I thought I'd go over it again, and see if I could break it down a
>bit. Maybe someone will be more willing to answer.  

 ... I'd offer some suggestions, but via email, not to the list.
Somehow I don't think tigger@io.nospaam.com is a valid 
address. I'm working on a similar application, and have learned a few
things from the docs that might help.

-- Ken
(donning anti-spam flame jacket...)
jkirving@mosquitonet.com

>   I think the basic thing I need to know is that if I have more than
>one interface to check (a program with input/output and a serial
>port), is there a good mechanism to put them in one loop, or should I
>put them somehow in separate loops?  Since I suspect that running
>separate loops is the best answer, is this something better
>accomplished with an object for each loop, or with child/parent
>processes?  Again, I'm not looking for a programming HOWTO. I simply
>would like an idea as to where to concentrating my learning efforts to
>be able to accomplish my tasks as quickly as possible.
>
>Thank you,
>
>Paul Archer
>
>
>
>
>tigger@io.nospaam.com spewed forth with:
>> Disclaimer: I am a Perl newbie, and something of a programming newbie. I
>> do shell scripts, I'm comfortable with loop/control concepts, and I'm
>> reading "Learning Perl", but that's all (so far). 
>
>> I am trying to build an mp3 (http://www.mp3.com) audio player in perl. It
>> is going to use a program called rxaudio for the actual decoding. It
>> passes text messages to and from STDOUT and STDIN. The user will interact
>> with the player through a controller connected to a serial port.  It has a
>> display with an lcd, and sends back user commands as characters (A-F).
>> FWIW, this is a project I'm doing in my spare time to go in my car.  It
>> isn't/won't be a commercial product. 
>
>> My problem is figuring out how to monitor rxaudio messages (using
>> Comm.pl's &expect function right now) and the controller at the same time.
>> If I put everything in one loop, then the loop has timing problems (timing
>> out with &expect after one-second intervals), so user input would only be
>> checked once a second in some cases.  It seems like I need two different
>> loops running at the same time, one for the player, and one for the
>> controller. I just have no idea what is the best way to do this. I'm not
>> looking for actual code, but if anyone could give me suggestions on what
>> might work best on a conceptual level, I would greatly appreciate it.
>> Right now things that I've
>> seen that look like possibilities are fork/exec, OO programming (creating
>> two separate looping objects), and threads (which I understand 5.005 is
>> supporting at the OS level). 
>
>> Thanks a lot,
>
>> Paul Archer
>
>> PS. Here is a bit of sample code I've been playing with to get a feel for
>> using Comm.pl's &expect. It opens and plays a file while displaying the
>> time code that comes preformatted out of rxaudio, skips ahead when it gets
>> to a certain time in the file, and then exits when the file finishes
>> playing.
>
>> #!/usr/bin/perl
>
>> require 'Comm.pl';
>> &Comm'init();
>> $|=1;
>> ( $Proc_pty_handle, $Proc_tty_handle, $pid ) = &open_proc( "rxaudio" );
>> die "open_proc failed" unless $Proc_pty_handle;
>
>> $ready='MSG notify ready';        # These are possible messages that
>> $ack='XA_MSG_COMMAND_INPUT_OPEN'; # rxaudio can spit out. They really
>> $eof='EOF';                       # should be in an array.
>> $time='\[00.*\]';
>
>> print   "Here we go.\n";
>> LOOP: {
>>   print "X\n";#Just lets me know each time the loop starts...
>>   ( $match, $err ) = &expect($Proc_pty_handle,2 , $ready, $ack, $eof, $time );
>>   if ($match eq $ready) { print "Opening file.\n";
>>                         print $Proc_pty_handle "open neuro.mp3\n";}
>>   if ($match eq $ack) {print "Playing file.\n";
>>                         print $Proc_pty_handle "play\n";}
>>   if ($match eq '[00:00:05:00]') {print "Skipping\n";
>>                         print $Proc_pty_handle "seek 35 40\n";}
>>   if ($match eq $eof) {print "Exiting\n";
>>                         print $Proc_pty_handle "exit\n";
>>                         last LOOP;}
>>   if ( $err ) { print "Aborting, err($err)\n"; last; }
>>   if ( $match eq "\003" ) { print "Got control-C\n"; last; }
>>   print "               ".$match."\n";
>>   redo LOOP;
>> }
>> print "Finished\n";
>
>
>
>> -- 
>>      _________________________________________________________________
>
>>      * Tech Support: "I need you to boot the computer."
>>      * Customer: (THUMP! Pause.) "No, that didn't help."
>>      _________________________________________________________________
>
>-- 
>     _________________________________________________________________
>
>     * Tech Support: "I need you to boot the computer."
>     * Customer: (THUMP! Pause.) "No, that didn't help."
>     _________________________________________________________________



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

Date: Thu, 06 Aug 1998 14:34:00 -0600
From: Stephen D Gagliardi <look@this.hak>
Subject: help? writing a SMTP mail program using telnet...
Message-Id: <35CA1338.50B9136F@this.hak>

i am in the process of writing a perl script that opens telnet opens the
SMTP mail server at its aloted port...
and sending mail that way.. since i can use it any where and only have
to have acces to telnet..

i am having trouble using bidirectionl file controll for this used the
input pipe.. open(tel,"|telnet");
but the server always closes the connection.. i also tried the open2()
didnt work same problem

didnt try the open3() because since open 2 didnt work what is the
point..

if any one can help i would be greatly appreciated... and if you would
like to trade some script or collaborate
on some code i would be more than happy to.. just trying to learn as
much as i can..

thanks!



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

Date: Thu, 06 Aug 1998 19:46:47 GMT
From: chuckk@monmouth.com
Subject: Re: How to Overcome Module Name Changes
Message-Id: <6qd177$fvr$1@nnrp1.dejanews.com>

<SNIP>
> So our module Gendate.pm needs a different 'use' line depending on which
> version of perl is in  use by the calling script.
>
>  use Date::DateCalc      if $PERL_VERSION < 5.004;
>  use Date::Calc          if $PERL_VERSION >= 5.004;
>
>  doesn't work because the 'use' declarations are processed before any if
>  statements.
<SNIP>

Tony,
I wrote a simple program which also depends on Date::Calc, and it
needs to run on 2 different systems, which have the different versions.
I simply used a Begin block - page 283 in the Camel book.

Below is a chunk of code that kinda does what you need.
You also need to include in your code some smarts to check which
routines to call based on which package you used.

P.S. Since your problem is in a Module, I'm not sure this will work.
I've never tried a BEGIN within a module. Anyway, at the worst you can
make two versions of your module and use the correct version based on
whatever.

#!/blah/blah/perl
if($main::m_env =~ /^windows|^mswin/)
      {$main::m_env = "WIN";
      require Date::DateCalc;
      Date::DateCalc->import('check_date','calc_new_date_time');
      require Date::DateCalcLib;
      Date::DateCalcLib->import('year_month_day_offset');
      #CALL YOUR MODULE VERSION 1 HERE
      }
  elsif ($main::m_env =~ /ux$|ix$/)
    {$main::m_env = "UNIX";
    require Date::Calc;
    Date::Calc->import('check_date','Add_Delta_DHMS','Add_Delta_YMD');
    #CALL YOUR MODULE VERSION 2 HERE
    }
  else
    {$main::m_env = "UNKOWN"};
# Add stuff to handle unkown ?
};





-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 06 Aug 1998 22:31:31 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: How to Overcome Module Name Changes
Message-Id: <lassehp-0608982231320001@skuld.imv.aau.dk>

In article <6q9oo7$1v9$1@news.ml.com>, edwarton@ml.com (Tony Edwardson 
X7587) wrote:

>Anyone know a good way to cater for module name changes across releases?
>
>Specifically Date::DateCalc has been renamed Date::Calc in 5.004 and 
Not quite. Date::DateCalc was changed to Date::Calc with version 4.0 of
Date::Calc. This has nothing to do with the Perl version. Date::DateCalc
works fine with 5.004 and 5.005, as far as I can tell.

>we have a module (Gendate.pm) which 'use's it and loads of scripts which 
>use Gendate.pm but use different versions of perl.

I have no problems continuing to use Date::DateCalc alongside with
Date::Calc (actually none of my scripts have been changed to use the
latter yet), both installed with perl5.005_01 right now.

So just install Date::DateCalc where you need it.

Actually it is not the module name that is the worst, but when functions
change names, well... (Not that the new names aren't nice...)

-Lasse


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

Date: Thu, 6 Aug 1998 14:52:37 -0400
From: "Franklin L.Petersen" <orangutan@grungyape.com>
Subject: Re: I want to separate my Perl from my HTML
Message-Id: <6qcu1m$547$1@cletus.bright.net>

The way I have done this is make the html file a required .pl file in the
actual main script.

For example, my html file looks like this:

title - final.pl

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

print <<FINAL_PAGE;

<html>
stuff
</html>

FINAL_PAGE
----

in my script at the top I call that final.pl file as a required library for
the main script then I can call it up to the browser with ease.

   require 'final.pl';
   if (!&parse_final(*STDOUT)) {
   print "Unable to locate needed file (Final)!\n";
   }


But if I want to edit the html only, I just open this file.

Franklin


Kirk D. Haines <khaines@oshconsulting.com> wrote in message
6ppuec$q3k$1@news-1.news.gte.net...
>[reply via both email and clpm]
>pjgeer@my-dejanews.com wrote:
>>
>> I write CGIs that output HTML.  I want to separate the HTML from the Perl
so I
>> can edit (or have someone else edit) just the HTML by itself, without
worrying
>> about busting the script




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

Date: Thu, 06 Aug 1998 20:28:40 GMT
From: chuckk@monmouth.com
Subject: Re: Installing Additional Packages in ActivePerl
Message-Id: <6qd3lo$jn2$1@nnrp1.dejanews.com>

<SNIP>
In article <35C9548E.D29D32B2@hp.com>,
  Pep Mico <pep_mico@hp.com> wrote:
> Hello everybody
>
> I'm suffering problems with a module named ppm.pl that installs
> additional packages in the latest distribution of Perl provided by
> ActiveState.
<SNIP>

I find ppm.pl a little tempermental myself.
Try the following:
1) go to www.activestate.com/packages
2) Look at the Module names listed and see if they have the one you want
3) example Tk
   type www.activesate.com/packages/Tk.ppd
   Hit save when prompted. Save it in a dir called packages.
4) type www.activestate.com/packages/x86/Tk.tar.gz
   (I think x in x86 is lowercase, or try uppercase also)
5) save the file to a directory x86 under packages.
6) rename the file incase windows turns the filename to Tk_tar.gz to Tk.tar.gz
7) start ppm and type: set repository local c:\packages
8) install Tk

Thats it.
chuck


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 6 Aug 1998 20:25:27 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: MAJOR PROBLEMS
Message-Id: <6qd3fn$6vk$1@supernews.com>

: I'm working on a simple email form script the entir script looks correct
: but when i submit the form on the webpage netscape come back and displays
: an error message that says "Out of Memory!"   does anyone know what this
: problem could be

It would seem that you're out of memory.

HTH,
xoox,
Andy

--
-- 
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: 6 Aug 1998 19:04:43 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: modules and mounted disks
Message-Id: <6qcuob$15f$15@info.uah.edu>

In article <35C9ECCA.F34B7FBD@genome.wi.mit.edu>,
	Aravind Subramanian <aravind@genome.wi.mit.edu> writes:
: Can perl scripts on a Solaris machine "use" modules from a mounted disk
: where the mounted disk is on a Digital UNIX machine (and has its own
: installation of perl)

Yes, and the design of the /usr/local/lib/perl5 hierarchy allows for
a painless implementation of such a scheme.

Each machine (well, architecture) will need its own /usr/local/bin
(but I assume this is already the case).  You can share
/usr/local/lib/perl5 among machines because the perl built on each
architecture has a special little place to put its architecture-specific
files (e.g. extensions that make use of XS).  The trick is just to make
sure to build XS extensions on both the Solaris and DGUX sides.  This
should work out of the box if you accept Configure's defaults.

Greg
-- 
Bigamy is having one wife too many. Monogamy is the same.
    -- Oscar Wilde


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

Date: Thu, 06 Aug 1998 19:56:56 GMT
From: chuckk@monmouth.com
Subject: Re: perl 5.005: Binary Distribution for Win32?
Message-Id: <6qd1q8$gvu$1@nnrp1.dejanews.com>

<SNIP>
> Hi 5.005 gurus,
>
> I understand 5.005 compiles well on Win32 - but since I don't have a C
> Compiler on my Windows box: is there a binary distribution for Win32?
<SNIP>

Sure, ActiveState at wwww.ActiveState.com
has it (aka ActivePerl).

It is VERY new, and going through some growing pains/problems.
I think Activestate is a little early in releasing it, but hey
I can understand I'm gung-ho on it also.

If you can't wait the GSAR port from CPAN is pretty stable. I have both, so
try both and play around.

Chuck

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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