[11602] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5202 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 22 20:07:31 1999

Date: Mon, 22 Mar 99 17:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 22 Mar 1999     Volume: 8 Number: 5202

Today's topics:
    Re: & (Laurence Leider)
    Re: 07111 -> 7111? (Tad McClellan)
    Re: Can an unchecked checkbox input pass a different va (Kjetil Asbj|rn Skotheim)
    Re: Crypt problems jfreger@my-dejanews.com
    Re: Database suggestion <jglascoe@giss.nasa.gov>
    Re: Direct memory access via Perl? <george.kuetemeyer@mail.tju.edu>
    Re: Direct memory access via Perl? (Sam Holden)
    Re: Executing another SCRIPT on a different SERVER <dales@enhanced-performance.com>
        Extreme Newbie here needs help <mgb23@vci.net>
    Re: Extreme Newbie here needs help <jeromeo@atrieva.com>
    Re: Forwarding to home directory using Net::FTP (xS)
    Re: Forwarding to home directory using Net::FTP (xS)
    Re: Hash Out Of Memory <jglascoe@giss.nasa.gov>
    Re: Hash Out Of Memory (Kjetil Asbj|rn Skotheim)
        integer size limit for modulus <dwatanab@uci.edu>
    Re: integer size limit for modulus <jglascoe@giss.nasa.gov>
    Re: PERL TCP issue (Kjetil Asbj|rn Skotheim)
    Re: RAD or WYSIWIG for Perl ??? <ty@cnr.colostate.edu>
    Re: read binary data (Kjetil Asbj|rn Skotheim)
    Re: Serial Communications using Perl <tripix@tdi-net.freeserve.co.uk>
    Re: String chopping (Tad McClellan)
    Re: Text Wrapping without Text::Wrap <jbc@shell2.la.best.com>
        while (<@array>) ... fails when @array has 1000+ elemen jmack@phl.lrpub.com
        Why don't wildcards expand on cmd line- win32 v5.005_02 <mpmcgill@bellatlantic.net>
        Win32::API EnumPrinters Examples? <ts40182@hpnfssvr.msc.az.boeing.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 23 Mar 1999 00:38:35 GMT
From: lleider@tiny.net (Laurence Leider)
Subject: Re: &
Message-Id: <36f7e11d.40697429@news.visi.com>

Prototypes are also useful for catching coding errors.  If you use
prototypes, you can catch some errors caused by mistakes with
functions calls.

You may have simply forgotten how many and what kind of parameters you
were supposed to use and with a prototype you usually get error
messages if there is mismatch between the call and the prototype.



On Tue, 8 Dec 1998 19:40:18 GMT, aml@world.std.com (Andrew M.
Langmead) wrote:

>om7@cyberdude.com writes:
>
>>I have the following code...
>
>>sub qwerty(&)
>
>the "(&)" is a function prototype. It tells perl that a certain number
>and type of arguments are needed (even if the numbers is "zero or
>more") In certain cases it allows perl to make an implict reference on
>the arguments. In this case, it forces the functino to take only one
>argument, which is a reference to a subroutine.
>
>>{
>>     my $var_name = shift;
>[stuff deleted]
>
>>     &$var_name($f1, $f2);
>
>This calls the subroutine referred to by the scalar $var_name. So what
>it actually does depends on the what gets passed to qwerty().
>
>for example, if qwerty() opens $f1 for reading and $f2 for writing, and
>it gets called this way:
>
>qwerty(sub {my($in,$out) = @_; print $out <$in>});
>
>The contents of $f1 would get copied into $f2.
>
>If it got called this way:
>
>qwerty(sub {my($in,$out) = @_; print $out reverse <$in>});
>
>Then $f2 would get a copy of $f1 but with the lines reversed (last
>line first).
>
>
>I think that the perlsub man page has the stuff about prototypes, but
>it might be some heavy reading. Prototypes aren't designed for
>beginners, they are designed for module writers so that they can
>create code that mimics some ofthe behaviors of perl's built in
>operators.



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

Date: Mon, 22 Mar 1999 13:14:19 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: 07111 -> 7111?
Message-Id: <r916d7.5q.ln@magna.metronet.com>

Dale Henderson (dhenders@cpsgroup.com) wrote:

:      I've written a script that reads in data some of it is zipcodes,
:      and some of those have leading zeros (i.e. 07111) perl converts
:      these to numeric values 


   perl doesn't convert it unless you _cause_ it to be converted,
   by, for instance, using it as a number.

   If you only use it as a string, then perl will leave it alone.

   We can't see where you are using it as a number, because we
   can't see any of your code, because you didn't give us any
   code to look at...


: and when they are printed I get the
:      value without leading zeros. How do I keep perl from doing this?


   By treating it as a string.


:      How can I print in string context? (I've tried printf "%s").


   Show us some code and we can probably help you fix it...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 22 Mar 1999 23:02:08 GMT
From: k.a.skotheim@usit.uio.no (Kjetil Asbj|rn Skotheim)
Subject: Re: Can an unchecked checkbox input pass a different value?
Message-Id: <7d6i5g$52v$1@readme.uio.no>

In article <Y7BI2.1687$256.15597@news20.ispnews.com>, greg@nospam.com says...
>
>Hello,
>
>Can un unchecked checkbox input still pass a value (i.e. it passes a value
>if checked, but can it pass a different value if unchecked)?

No, I do not think that is possible. If I remember correctly,
unchecked checkbox'es will not send/POST any "url-parameter"
at all. (Check for uncheckedness by checking if checkbox-parameter
exists.)

>Perhaps I need
>to be looking to javascript to do this?

Yes, maybe you can set a value in the parameter itself
or a <input type=hidden> in an onSubmit-event or something...

>
>Any help is greatly appreciated! :^)
>
>Greg
>
>



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

Date: Mon, 22 Mar 1999 23:38:04 GMT
From: jfreger@my-dejanews.com
Subject: Re: Crypt problems
Message-Id: <7d6k8r$hmn$1@nnrp1.dejanews.com>

When I try to use this method on a linux box, and then try to login to the
htaccess protected directory (via a web browser) I get "access denied"
because the passwords don't match. I've tried this using the salt provided
below. Could that be the problem?


In article <36f27c9a@news3.enter.net>,
  "Gavin" <gaving@enter.net> wrote:
> Dave,
>
>     Apache uses a random string, however it does not need to.  Below is a
> sample progam that will make passwords for apache
>
> $cpass is the encpted password, and $rpass is the input password
>
> $salt = "KE";
> $rpass = "Password";
> $cpass = crypt($rpass, $salt);
>
> <dccobb@yahoo.com> wrote in message news:7ct6ba$ge6$1@nnrp1.dejanews.com...
> > Problem: I have installed an apache server on top of an existing apache
> > server, however as I am not root user I cannot use the htpasswd program to
> > create passwords for users.
> >
> > Am I right in saying that Apache uses "Cd" as its encrytion key (salt) or
> does
> > it use a random key?
> >
> > As I cannot use htpasswd I have created a Perl program which uses crypt()
> > will this do the same job as htpasswd?
> >
> > Any help is much appreciated, Dave
> >
> > "Everything should be as simple as possible, but no simpler",
> > Albert Einstein.
> >
> > -----------== Posted via Deja News, The Discussion Network ==----------
> > http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>
>


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 22 Mar 1999 18:42:06 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Neil Prater <neil.prater@ype.gmpt.gmeds.com>
Subject: Re: Database suggestion
Message-Id: <36F6D54E.D906E8C3@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Neil Prater wrote:
> 
> [...] I currently dump my output to a text file and just go from there,
> but  I want to be more efficient. [...]

Using dbm files together with the Data::Dumper module
provides a powerful means of saving your data to disk.

$ cat sdbm_write.pl
use Fcntl;
use SDBM_File;
use Data::Dumper;

my %dbm = ();
tie %dbm, "SDBM_File", "output.sdbm", O_TRUNC|O_CREAT|O_WRONLY, 0666
    or die "can't open SDBM file: $!";

my %hash = ("foo" => ["one", "two"],
            "bar" => { seven => 7, six => 6 },
           );
my @array = ({ "uno" => 1, "dos" => 2 },
             [ "foo", ["biz", "baz"] ],
            );

$Data::Dumper::Terse = 1;
$dbm{"hash"} = Data::Dumper->new([\%hash])->Dumpxs();
$dbm{"array"} = Data::Dumper->new([\@array])->Dumpxs();

__END__

$ cat sdbm_read.pl
use Fcntl;
use SDBM_File;
use Data::Dumper;

my %dbm = ();
tie %dbm, "SDBM_File", "output.sdbm", O_RDONLY, 0666
    or die "can't open SDBM file: $!";

my $hash_ref = eval $dbm{"hash"};
my %hash = %$hash_ref;

my $array_ref = eval $dbm{"array"};
my @array = @$array_ref;

print qq{
    \$hash{"foo"}[0] = $hash{'foo'}[0]
    \$array[1][1][1] = $array[1][1][1]
};
__END__

	Jay Glascoe
-- 
Poit!


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

Date: Mon, 22 Mar 1999 19:11:06 -0500
From: George Kuetemeyer <george.kuetemeyer@mail.tju.edu>
Subject: Re: Direct memory access via Perl?
Message-Id: <36F6DC1A.C7C4223E@mail.tju.edu>



Jeff J wrote:

> The serial number of each PC is stored in a specific memory address. I would
> like to get that info with one of my scripts. I haven't been able to find
> out if Perl can do this. I am currently using:
>
> $runthis="echo d F000:FFB6 \n q \n | debug.exe";

> $temp=qx/$runthis/;
>
> then I parse $temp to get the info returned by the system call to debug.
>
> This works, but for some reason, my logon script won't finish. It appears to
> run the very last line of code, and everything is successful, but the script
> window does not close, as if the Perl program is still running.

Try using backticks instead of double quotes:

          $runthis = `echo d F000:FFB6 \n q \n | debug.exe`;




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

Date: 23 Mar 1999 00:55:59 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Direct memory access via Perl?
Message-Id: <slrn7fdpkv.g1.sholden@pgrad.cs.usyd.edu.au>

George Kuetemeyer <george.kuetemeyer@mail.tju.edu> wrote:
>
>
>Jeff J wrote:
>
>> The serial number of each PC is stored in a specific memory address. I would
>> like to get that info with one of my scripts. I haven't been able to find
>> out if Perl can do this. I am currently using:
>>
>> $runthis="echo d F000:FFB6 \n q \n | debug.exe";
>
>> $temp=qx/$runthis/;
>>
>> then I parse $temp to get the info returned by the system call to debug.
>>
>> This works, but for some reason, my logon script won't finish. It appears to
>> run the very last line of code, and everything is successful, but the script
>> window does not close, as if the Perl program is still running.
>
>Try using backticks instead of double quotes:
>
>          $runthis = `echo d F000:FFB6 \n q \n | debug.exe`;

If you bothered reading the question, and looking at the procided code, and
knowing the quoting syntax of perl, then you would realise that your code
is equivalent to the provided code (except it doesn't use an extra 
variable).

As for the original post, on every sh like shell I have tried (ksh,sh,csh,tcsh,
bash,jsh) echo \n will output an n and not a newline. So the debig.exe
won't see the q on a line of it's own and quit (I'm assuming that is what is
meant to happen).

You could try something like :

$runthis="(echo d F000:FFB6;echo q)|debug.exe";   

Although if the string is fixed (and not constructed by the program you can do
it like this (which you probably already know...)) :

$temp=qx/(echo d F000:FFB6;echo q)|debug.exe/;   

-- 
Sam

Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work."  --Larry Wall


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

Date: Mon, 22 Mar 1999 15:32:29 -0800
From: Dale Sutcliffe <dales@enhanced-performance.com>
Subject: Re: Executing another SCRIPT on a different SERVER
Message-Id: <36F6D30D.97CD929C@enhanced-performance.com>

What if my ISP won't allow me to install perl modules onto the server, only simple
perl/cgi scripts.  Is there some method to still use LWP or some other socket type
script?

Thanks.


Jerome O'Neil wrote:

> > >    Why must it not use that protocol?
> >
> > To enhance security a bit, I don't want the user to see that a script is
> > being called on another server.
> > If a post or get can be done without the user's knowledge, great.  But, how?
>
> With LWP.  Have your script create user agents as needed.
>
> Good Luck!
>
> --
> Jerome O'Neil, Operations and Information Services
> Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
> jeromeo@atrieva.com - Voice:206/749-2947
> The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com





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

Date: Mon, 22 Mar 1999 17:19:54 -0800
From: Spencer <mgb23@vci.net>
Subject: Extreme Newbie here needs help
Message-Id: <36F6EC3A.218C@vci.net>

Hello,

This may seem like a very stupid question but here goes.  I am a college
student and like to develop basic static web pages and have developed
one for my fathers company but i would like to add more to it with CGI
scripting.  I was told that I could do this with the perl programming
language ao I went out and bought the book Learning Perl by O`Reily
publishing compnay.  Igot the book and started to read it but I am kinda
lost.  

First question, do I have to have a program or something to write with
the perl language.

If so what program is it that I need.

Second question is, I am using windows 95, is perl only for unix and
servers and stuff.

Any help would be greatly appreciated.

Thanks 
Aaron Spencer


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

Date: Mon, 22 Mar 1999 16:21:08 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Spencer <mgb23@vci.net>
Subject: Re: Extreme Newbie here needs help
Message-Id: <36F6DE74.8F5113EE@atrieva.com>

Spencer wrote:
> I was told that I could do this with the perl programming
> language ao I went out and bought the book Learning Perl by O`Reily
> publishing compnay.  Igot the book and started to read it but I am kinda
> lost.

You have made an excellent choice to start your library.  Hang on to
that book.

> First question, do I have to have a program or something to write with
> the perl language.

Sorta.  You will need a text editor, such as WordPad or NotePad. 
However, you will find that these editors are a bit clunky, and you will
probably want to find a better alternative.  Look at Yahoo for links to
many free, cheap and fancy text editors.

> Second question is, I am using windows 95, is perl only for unix and
> servers and stuff.

Perl will run on just about any platform you can come up with.  There
are builds for WinTel platforms available from ActiveState, I think.  I
don't know the pro's and con's of the Windows versions, though.

After that, point your browser to http://www.perl.com and read it, learn
it, live it.

Good Luck!

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Mon, 22 Mar 1999 23:29:36 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: Re: Forwarding to home directory using Net::FTP
Message-Id: <AnAJ2.642$P7.10460@typhoon.mbnet.mb.ca>

Well I feel like an idiot. My code was screwy and was always logging as
anonymous. I had an if tag which was never called that logged in with an
actual login. Thats why it went to root dir. You were 100% correct.

Thanks

'xS
xs AT dmusic DOT com
Ray McVay <rmcvay@acm.org> wrote in message
news:36F599B4.F6D09164@acm.org...
>"Kevin S (xS)" wrote:
>>
>> It does on most ftp clients because they have code built in to send you
to
>> the specifiied home directory. Unfortunately I couldn't find that code in
>> any of the ftp rfc's.
>
>Well I've damned sure been wrong before but I sure don't think so this
>time.  My experience with NET::FTP is that it works just the same as all
>the FTP clients I've used in this regard.  It looks like what I see
>happen with WSFTP for example is that it does a PWD as soon as it's
>logged on.  Also the site I just tested on has the ftpd set up to make
>my user's home look like '/'; is that what you're refering to?
>
>--
>
>Ray
>+--------------------------------------------------+
>+ I've gone to look for myself. If I should return +
>+ before I get back, keep me here!! - Bill the Cat +
>+--------------------------------------------------+
>




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

Date: Mon, 22 Mar 1999 23:41:08 GMT
From: "Kevin S (xS)" <xs@dmusic.com>
Subject: Re: Forwarding to home directory using Net::FTP
Message-Id: <oyAJ2.645$P7.11598@typhoon.mbnet.mb.ca>

Actually it was my code :)

Thanks though. I had an if statement that was never called making it always
log in as anon in the root dir.

'xS
xs AT dmusic DOT com

Jonathan Stowe <gellyfish@btinternet.com> wrote in message
news:7d3adq$6p4$1@gellyfish.btinternet.com...
>On Sun, 21 Mar 1999 16:43:27 GMT "Kevin S (xS)" wrote:
>> I honestly think its a problem w/ Net::FTP, because when I got w/ ftp
from
>> DOS or from Linux it works fine. I think that Net::FTP auto-cwds into the
>> root dir regardless of who your logged in as. I'll probably look at the
>> perldoc to see if theres a way to stop this.
>>
>
>Not my experience - given :
>
>
>#!/usr/bin/perl -w
>
>use Net::FTP;
>
>$ftp = Net::FTP->new("localhost");
>$ftp->login("gellyfish","********"); # real password commented out
>print $ftp->pwd,"\n";
>$ftp->quit;
>
>
>I get :
>
>gellyfish@gellyfish:/home/gellyfish/clpmtest > ftptest.pl
>/home/gellyfish
>gellyfish@gellyfish:/home/gellyfish/clpmtest >
>
>So that works.  I will reiterate that it is the server that is doing what
>you observe.
>
>/J\
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>




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

Date: Mon, 22 Mar 1999 17:48:23 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Skip Hollowell <thollowe@opentext.com>
Subject: Re: Hash Out Of Memory
Message-Id: <36F6C8B7.E480E52C@giss.nasa.gov>

[courtesy copy of post sent to cited author]

Skip Hollowell wrote:
> 
> So how do you play with large sets of data that need to be manipulated. 

use disk space instead of in-memory space.

<snip>

> Any ways I can approach this that you can think of off hand in Perl?

try using a data base like "Berkeley DB":

use DB_File;
tie %first, "DB_File", "first.db";
tie %second, "DB_File", "second.db";
# populate hashes "%first", "%second"

Or, if you don't have "DB_File", try using "SDBM_File",
or use "AnyDBM_File".

perldoc DB_File
perldoc SDBM_File
perldoc AnyDBM_File

	Jay Glascoe
-- 
Poit!


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

Date: 22 Mar 1999 23:15:28 GMT
From: k.a.skotheim@usit.uio.no (Kjetil Asbj|rn Skotheim)
Subject: Re: Hash Out Of Memory
Message-Id: <7d6iug$52v$2@readme.uio.no>

In article <7d6c6o$d86@enews4.newsguy.com>, thollowe@opentext.com says...
>
 .
 .
 .
>
>Any ways I can approach this that you can think of off hand in Perl?
>
>
>      while ( ($key1, $value1) = each %first) {
>        while ( ($key2, $value2) = each %tmp) {
>          $key = $key1 . ' --- ' . $key2;
>          $words{$key} = $words{$key} + 1;

(You prob got a reason for not just doing $words{$key1,$key2}++; )

>          }
>      }
>
>Skip Hollowell

Maybe SubstrHash.pm could be useful here.


perldoc SubstrHash
 .
 .
 .
require Tie::SubstrHash;
tie %words, 'Tie::SubstrHash', $key_len, $value_len, $table_size;




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

Date: Mon, 22 Mar 1999 15:26:02 -0800
From: =?iso-8859-1?Q?d=E1na?= watanabe <dwatanab@uci.edu>
Subject: integer size limit for modulus
Message-Id: <36F6D184.615EF0E1@uci.edu>

Whenever i am using % with numbers above 2**32 i seem to be getting
wrong information. 

I've tried this on a small handful of Un*x variants (solaris, freeBSD, linux)
and had the same result on them all.

To test the modulus i used:

sub print_modulus {
	my $i=shift; $j=shift;
	printf "%.0f %% %.0f = %.0f\n",2**$i,2**$j+1,(2**$i)%(1+(2**$j));
}

$i=32; for (0..3) {print_modulus($i,$_)}

and i got: 

4294967296 % 1 = 0
4294967296 % 2 = 1
4294967296 % 4 = 3
4294967296 % 8 = 7

Am i doing something wrong?  
Thanks


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

Date: Mon, 22 Mar 1999 19:14:35 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: dwatanab@uci.edu
Subject: Re: integer size limit for modulus
Message-Id: <36F6DCEB.DFE20A7E@giss.nasa.gov>

dana watanabe wrote:
> 
> Whenever i am using % with numbers above 2**32 i seem to be getting
> wrong information.
> 
> I've tried this on a small handful of Un*x variants (solaris, freeBSD, linux)
> and had the same result on them all.

take a look at the "Math::BigInt" module, available
in the standard Perl distribution.

use Math::BigInt;

sub print_modulus {
    my $a = Math::BigInt->new(2) ** shift();
    my $b = Math::BigInt->new(2) ** shift() + 1;
    printf "%s %% %s = %s\n", $a, $b, ($a % $b);
}

	Jay Glascoe


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

Date: 23 Mar 1999 00:00:14 GMT
From: k.a.skotheim@usit.uio.no (Kjetil Asbj|rn Skotheim)
Subject: Re: PERL TCP issue
Message-Id: <7d6lie$63e$1@readme.uio.no>

In article <dev-2203990352450001@a48-07-09.pdx.du.teleport.com>, dev@null.org 
says...
 ...
>use Socket;
>
>$PORT = getservbyname("119",'tcp');
                        ^^^
by name? replace "119" with "nntp" ? (but if it works...)

>$IPPACK = inet_aton("news.teleport.com");
>$SOCKADDR = sockaddr_in("119", $IPPACK);
>$PROTO = getprotobyname('tcp');
>socket(NNTP, PF_INET, SOCK_STREAM, $PROTO) || die "socket: $!";
>connect(NNTP, $SOCKADDR) || die "connect: $!";
>
>while (defined($line = <NNTP>)) {
>  print $line;
>}
>send(NNTP, "DATE\r\n", undef);
>send(NNTP, "QUIT\r\n", undef);
>close (NNTP) || die "close: $!";

Send() are for UDP messages. SOCK_STREAM says that this is
a STREAM-type, not a UDP-type socket.

my $cfh=select NNTP;$|=1;select $cfh;
print NNTP "DATE\r\n";
$response=<NNTP>;
print NNTP "QUIT\r\n";
$response=<NNTP>;

(Not tested)


>
>--Anonymous (spammers beware.)



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

Date: Mon, 22 Mar 1999 17:26:36 -0700
From: "Ty! Boyack" <ty@cnr.colostate.edu>
Subject: Re: RAD or WYSIWIG for Perl ???
Message-Id: <36F6DFBC.CAA2DF37@cnr.colostate.edu>

Jonathan Stowe wrote:
> 
> On Wed, 17 Mar 1999 01:29:57 -0500 Steve Davis wrote:
> >
> > I want a GUI that will help me assemble the code.. there are dozens of apps
> > out there to help me produce java apps but nothing for Perl which surprises
> > me.
> >

I've only tinkered with these (I personally prefer a text editor
myself), but you might search for SpecTCL/SpecPerl for building
GUI's.  It's probably not as seemless as a full IDE you might
go out and buy, but it fits right in everyone's price range :-)

What I've seen of it, I liked.  Although like any programming
aid, you will usually get better code if you sit down and 
do it yourself.  Let's hear it for job security.

I also liked the look of scriptum for an editor - it has several
build-in language-definitions and will do syntax highliting, 
procedural wrap-up, and internal hooks to RCS.  Free from
Inter-soft.  Sorry I don't have the addresses, but a couple
of quick searches should turn these tools up.  If they don't,
drop me a line and I'll dig up older notes.

-Ty!

-- 
|==========================||======================================|
| Ty! Boyack               || Colorado State University            |
| Unix Services Manager    || College of Natural Resources         |
| ty@cnr.colostate.edu     || A105B, Advanced Technology Lab, NESB |
| (970) 491-4966           ||                                      |
|==========================||======================================|


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

Date: 22 Mar 1999 23:30:40 GMT
From: k.a.skotheim@usit.uio.no (Kjetil Asbj|rn Skotheim)
Subject: Re: read binary data
Message-Id: <7d6jr0$52v$3@readme.uio.no>

In article <7d5t42$s1u$1@nnrp1.dejanews.com>, p3qa3@yahoo.com says...
 .
 .
 .
>All is arranged like:
>---------------- Header start --------------------
>user char[20]
>date char[9]
>time char[9]
>substance char[25]
>array_size_x short
>array_size_y short
>....
>--------------- Header stop ----------------------
>--------------- Data start -----------------------
>array[array_size_x,array_size_y] of floating point values
>--------------- Data stop ------------------------

>So I started to read the file with
>...
>while(<INFILE>){($a,$b,$c ...)=unpack('a25a9a9a25s2...',$_}
>
>Now I have the header information stored in $a, $b, $c ...
>
>Next is to read the data. The size of the array is different from file
>to file, but it is stored in the header at least. So how to read the data ?
>
>I tried:
>$read=sysread(<INFILE>,$data,$length);

Try sysread(INFILE,$data,$length);  #not <INFILE>, which returns next line




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

Date: Mon, 22 Mar 1999 23:23:52 -0000
From: "john wayne" <tripix@tdi-net.freeserve.co.uk>
Subject: Re: Serial Communications using Perl
Message-Id: <7d6jpi$ccj$1@news8.svr.pol.co.uk>


wrnelson@my-dejanews.com wrote in message
<7bu7ib$319$1@nnrp1.dejanews.com>...
>I am just starting on a project that will use a computer to control
>electrical devices.  I am most familiar with Perl, so I'd like to use it if
>possible. Also, I'd like to use an I80X86 running Linux if possible.  Is
>there a way to handle serial communication under perl? Where could I find
>more information on this?  Thanks!
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own


>I am just starting on a project that will use a computer to control
>electrical devices.  I am most familiar with Perl, so I'd like to use it if
>possible. Also, I'd like to use an I80X86 running Linux if possible.  Is
>there a way to handle serial communication under perl? Where could I find
>more information on this?  Thanks!


You will definately want to use the Expect module. so here goes:


use Expect;       #imports IO:Pty, & IO:Stty;

#init
$device="/dev/cua0";    #linux only (win32 needs the Win32::Comm module,)

open(DEVICE,"+>$device") || die "error(Couldn't open $device, $!)\n";
$oldStty=IO::Stty::stty(*DEVICE,"-g");                                #save
the settings to be restored later
$port=Expect->exp_init(\*DEVICE);                                  #does
some 'sensible' stty settings, you can turn this off if need be,
IO::Stty::stty(\DEVICE, 'cs8', '-ixon','-icanon', '-cstopb');  #check the
docs of Stty for your desired Terminal settings


#do
port->send_slow(1,"text to the device");      #1 second delay between char
sends, check Expect docs
                                                                           #
linux can take fractional amounts, 0.01 works for me.
port->expect($timeout,"pattern to check for") || die "Did not get expected
response";  #check Expect Docs
print port->exp_before();        #prints text before match
print port->exp_after();            #prints text after match


#fini
IO::Stty::stty(\DEVICE,$oldStty);  #and cleanup
close(DEVICE);
exit;
>

Regards

Wayne




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

Date: Mon, 22 Mar 1999 13:17:30 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: String chopping
Message-Id: <qf16d7.5q.ln@magna.metronet.com>

Greg Griffiths (greg2@surfaid.org) wrote:

: 	I have what is probably a trivial one for you all. I have an ID number
: followed by a delimeter and then a string, for example :

: 123. Joe Bloggs
: 5} Hello World12

: To abstract, they are all in the format :

: <numeric ID> <delimeter> <alphanumeric string>

: What I need to do is to get at the numeric part only as it is my
: identifier. I've played about with this for a while nad not really got
: anywhere, so any help or code snippets would be appreciated.


   $identifier = $1 if /^(\d+)/;


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 22 Mar 1999 23:58:15 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Text Wrapping without Text::Wrap
Message-Id: <36f6d917$0$215@nntp1.ba.best.com>

Armstrong Boca <revjack@radix.net> wrote:
> Allan M. Due explains it all:

> :Nordstrom Walt <revjack@radix.net> wrote in message
> :news:7d07c3$fjs$1@news1.Radix.Net...

> :The great thing is
> :that it is really easy to find in dejanews.  Just search for cat walked
> :across my keyboard.  It is a very nice little bit of code that lets you wrap
> :where you like while not splitting words, and it allows you to specify the
> :size of tabs.

> It's rare that I actually smile while employing Dejanews, thanks.

I had to smile, too, though in my case it was in response to the number
of matches to the "cat walked across my keyboard" query at DejaNews
*not* related to the original question. Obviously, this cat walking
across the keyboard thing is a major, and hitherto unpublicized, source
of data loss.

There must be some sort of business opportunity there...

-- 
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Mon, 22 Mar 1999 23:13:29 GMT
From: jmack@phl.lrpub.com
Subject: while (<@array>) ... fails when @array has 1000+ elements
Message-Id: <7d6iqg$g9u$1@nnrp1.dejanews.com>

I have noticed the following odd behavior for perl 5.004_1 on a Sun
Ultra2/Solris 2.6 (plenty of memory too).  When I cycle through an array that
has more than a 1000  elements, the while loop fails; if there are less than
1000 elements,  it works fine.

@array = ("foo","foo",... has 1000 or more elements); $mynum=0; while
(<@array>) {  # this loop just won't happen with 1000+ elements in @array 
print "$mynum\n";  # if @array had 999 or fewer elements, it works and 
$mynum++;  # prints 0 - 999 or whatever the array length is }


What is happening here? What's the problem with cycling through an array in
this manner with 1000 elements or more?  I know there's many ways to do what
I'm doing here, but why is this way bad or why in particular is it failing?

Thanks,
John Mack
jmack@p3.net

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 22 Mar 1999 18:42:33 -0500
From: Michael P McGill <mpmcgill@bellatlantic.net>
Subject: Why don't wildcards expand on cmd line- win32 v5.005_02
Message-Id: <36F6D569.AABBBB24@bellatlantic.net>


Why do I get the message:
"Can't open *.log: No such file or directory"

from the following command line:
"C:\Data>perl chk_log.pl *.log"

When I do the same thing with 5.003_07 on another Windows98 machine with
an identical configuration
(as far as the environment goes anyway), it works fine and processes all
the files with and extension of ".log"

I have 5.005_02 ActiveState port on a system running Windows98. If I
specify all the files I want to process on the command line, my program
works great, but I don't think this is how it is supposed to be.

Your help is appreciated,
Michael


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

Date: Mon, 22 Mar 1999 23:27:37 GMT
From: "Bruce D. Inglish" <ts40182@hpnfssvr.msc.az.boeing.com>
Subject: Win32::API EnumPrinters Examples?
Message-Id: <36F6D1E9.69EF1D12@hpnfssvr.msc.az.boeing.com>

Anyone have an example of using the PERL Win32::API module to manipulate
the EnumPrinters API call?

I am trying to get a list of my local domain's printers.  I am able to
use EnumPrinters via a simple C program but would like to keep the
project pure PERL if possible.

Thanks in advance,

Bruce D. Inglish
Mesa, AZ
Bruce.Inglish@boeing.com


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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