[19007] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1202 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 27 06:05:39 2001

Date: Wed, 27 Jun 2001 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <993636308-v10-i1202@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 27 Jun 2001     Volume: 10 Number: 1202

Today's topics:
    Re: Browser interface to Perl program? <newspost@coppit.org>
    Re: cgi posting to another cgi (Eric Bohlman)
    Re: CGI string parameter passing <glodalec@yahoo.com>
    Re: command line news posting tools <pne-news-20010627@newton.digitalspace.net>
    Re: how to sort array of similar hashes by one of the h <bart.lateur@skynet.be>
    Re: how to sort array of similar hashes by one of the h <thoren@southern-division.com>
    Re: image resampling <addi@umich.edu>
    Re: ISA versioning (Anno Siegel)
        Localtime Error ?! <patrick.steiner@alcatel.ch>
    Re: Localtime Error ?! <mk@ticklets.com>
        newbie directory question <"goodrow"@opencity. com>
        newbie regex <"goodrow"@opencity. com>
    Re: newbie regex <wyzelli@yahoo.com>
    Re: newbie regex <Per-fredrik.Pollnow@epk.ericsson.se>
    Re: Perl *is* strongly typed (was Re: Perl description) <newspost@coppit.org>
    Re: Perl to Convert Code <pne-news-20010627@newton.digitalspace.net>
    Re: Perl variable <bart.lateur@skynet.be>
    Re: Problem with Archive::Tar <bart.lateur@skynet.be>
    Re: regular expression problem <bart.lateur@skynet.be>
        Scanning a file in CGI <daniel.hendrickx@alcatel.be>
    Re: Scanning a file in CGI (Brian Pontz)
        Serial ports, ActiveState Perl and win98SE <mr.gadget2@home.com>
    Re: sorting a hash <jonni@ifm.liu.se>
    Re: Where I can find BINMODE, any examples ??? (Eric Bohlman)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 27 Jun 2001 01:00:18 -0400
From: David Coppit <newspost@coppit.org>
To: Oleg Bakiev <boa@aaanet.ru>
Subject: Re: Browser interface to Perl program?
Message-Id: <Pine.SUN.4.33.0106270051320.13257-100000@mamba.cs.Virginia.EDU>

[posted & mailed]

On Tue, 26 Jun 2001, Oleg Bakiev wrote:

> "David Coppit" <newspost@coppit.org>
> news:Pine.SUN.4.33.0106261530310.6718-100000@mamba.cs.Virginia.EDU...
> >
> > Basically it's a series of dialogs in a "wizard" like structure. This
> > could be implemented with a CGI back-end. Because I don't want to be
> > responsible for the user's data, I'd rather things be done on the
> > user's side.
>
> You could look at the Nusphere (www.nusphere.com) mysql installer. It's
> written on perl, it has html-interface and it uses a tiny program instead of
> web server

Thanks for the pointer. Apparently the tiny program *is* a web
server... "MicroWeb" running on Port 4001. The Perl installation is
handled by CGI scripts. Unfortunately, I don't see any way to see the
details of the server, as it's a binary. (The Linux version calls a
similar binary "setup" program which may be a micro-web server--I
didn't try it out.)

I guess I *could* let the web server be platform dependent, as long as
a had a mini web server for all the platforms I cared about. In that
case the interface HTML and CGI code would be platform independent...

Which brings up an interesting question -- has anyone implemented a
CGI-capable web server in Perl? ;)

David



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

Date: 27 Jun 2001 05:23:09 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: cgi posting to another cgi
Message-Id: <9hbqjt$h9d$2@bob.news.rcn.net>

rmhta <rmhta@hotmail.com> wrote:
> I need a cgi to post to another cgi on a different server. What I'm
> trying to accomplish is this:

> A cgi is posted to from a html form;
> This cgi sends an email;
> This cgi "passes" whatever data was posted to it, to another cgi on a
> different server.

> Is there a straight-forward way of accomplishing this?

Yep, use LWP.



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

Date: Wed, 27 Jun 2001 08:07:27 +0200
From: Marvin <glodalec@yahoo.com>
Subject: Re: CGI string parameter passing
Message-Id: <MPG.15a2a69ec66894749896d6@news.siol.net>

In article <993550196.126898195128888.gnarinn@hotmail.com>, 
gnarinn@hotmail.com says...
> In article <65ngjt83o89p2es8tsjf14l4jijfs9nq1t@4ax.com>,
> Philip Newton  <nospam.newton@gmx.li> wrote:
> >On Tue, 26 Jun 2001 10:58:06 +0200, Marvin <glodalec@yahoo.com> wrote:
> >
> >> Is there any CGI function which translate regular string "bla bla bla" 
> >> into "bla+bla+bla". There is a lot of conversion needed (some characters 
> >> need to be translated into %<code> etc..), so I would use regular exp. 
> >> substitute as a final solution.
> >
> >I had a quick look through CGI.pm documentation generated from the POD,
> >but didn't find anything likely. http://stein.cshl.org/WWW/software/CGI/
> >showed the existence of the 'escape' function (which must, however, be
> >imported explicitly if desired)
> 
> Or just called as CGI::escape($string);
> 
> Import can be nice, but why clutter your namespace when 5 extra chars
> will do?
> 
> gnari
> 
> 
Thats what I wanted. Thanks


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

Date: Wed, 27 Jun 2001 10:36:13 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: command line news posting tools
Message-Id: <ak6jjto39unb7f7glja9s0gkmqil6qh26d@4ax.com>

On 27 Jun 2001 00:55:14 -0300, * Tong * <sun_tong@users.sourceforge.net>
wrote:

> > First off, -Mmodule might be prefered to "use" if your doing shell stuff
> > like this, second, most shells support a here-document syntax...
> > perl -Mstrict -MNet::NNTP <<__END__ ${1+"$@"}
> >     my $n = Net::NNTP->new("news");
> >     my @article = <>;
> >     $n->post(\@article) or die "Post error: $!";
> >     $n->quit;
> > __END__
> > 
> > Note, this is untested.
> 
> Good points! I tested it right away and found some problem:
> 
> - It will cause Perl compile error unless the __END__ is quoted like
>   this: '__END__'

Perl should not see the __END__ as it should be eaten by the shell.

> - I test with a pipe command but it didn't work
> 
>  cat file | nntppost 
> 
> and neither is:
> 
>  cat file | nntppost -

a) "didn't work" is too vague. Did it cause your printer to shoot out
empty pages? Did it return an error message?

b) My PSI::ESP module is not working. Showing us the code of the
'nntppost' that you are using would help.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 27 Jun 2001 08:13:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to sort array of similar hashes by one of the hash keys?
Message-Id: <i95jjtsgcr910trunre0ogbs1u6hbge8nh@4ax.com>

Irfan Baig wrote:

>@sorted_game = sort{ $game[$a]{'score'} <=> $game[$b]{'score'} } @game;

You're mixing two concepts. Or, you select an item by index, but then
you need to feed the indexes to the sort function (and getting a list of
indexes out), or you must assume that $a and $b are the $game[$i] items,
thus, hash references. So:

	@sorted_index = sort{ $game[$a]{'score'} <=> $game[$b]{'score'}}
		0 .. $#game;
	@sorted_game = @game[@sorted_index];

or

	@sorted_game = sort{ $a->{'score'} <=> $b{'score'} } @game;

-- 
	Bart.


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

Date: 27 Jun 2001 11:17:27 +0200
From: Thoren Johne <thoren@southern-division.com>
Subject: Re: how to sort array of similar hashes by one of the hash keys?
Message-Id: <m33d8m7048.fsf@thoren.southern-division.com>

merlyn@stonehenge.com (Randal L. Schwartz) writes:

> >>>>> "Thoren" == Thoren Johne <thoren@southern-division.com> writes:
> 
> Thoren> i think it's not necessary ;)
> 
> Thoren> i've never seen an example where it is necessary to force an anonhash
> Thoren> that way, perhaps that why i asked.
> 
> Thoren> can you fill in such an example?
> 
> Have you not read perlref?

obviously not for a while ;)

-- 
# Thoren Johne - 8#X - thoren@southern-division.com
# Southern Division Classic Bikes - www.southern-division.com
END{print@=and&X&&print'','8#X'}sub X{eval(reverse'######" Hackern\     "
esrever=,$')}BEGIN{$,=32.65.110.111.116.104.101.114.32=>@==qw/Just Perl/}


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

Date: Wed, 27 Jun 2001 04:40:07 GMT
From: Arnar M Hrafnkelsson <addi@umich.edu>
Subject: Re: image resampling
Message-Id: <m3vglio7w6.fsf@steypa.ast.is>

"S. Frank Miller" <sfm15@columbia.edu> writes:

> Hi,
> 
> I'm trying to make a cgi thumbnail script and I'm having problems getting
> my thumbnails to look good. My problem is that my site is remotely hosted
> and the host doesn't have a module like PerlMagick installed on the
> server and GD only has has image resizing without resampling. Does anyone
> out there know of a way (preferrably an easy way) to resize and resample
> an image into a thumbnail without it looking like crap?
> 
> Thanks for any help,
> Steve

The Imager module can resample images but I _seriously_ doubt it is installed
on the host.  Installing it shouldn't be too hard.  In any case you can almost
get the same effect as resampling by applying a gaussian blur to the image
before you decimate the image.  You can alternatively try to interface with
things like pnmscale (or what they are called) or Imagemagick's convert
program if that is installed.

-- Arnar.


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

Date: 27 Jun 2001 08:38:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ISA versioning
Message-Id: <9hc619$8nf$1@mamenchi.zrz.TU-Berlin.DE>

According to Robert McArthur  <mcarthur@dstc.edu.au>:
> When use'ing a package you can tell the system what version you'd like
> as a minimum.  What about when inheriting via ISA?  It'd like to tell
> it to inherit from version 2 rather than version 1 (both are in the
> path).

@ISA has nothing to do with loading modules, it is simply a list of
package names.  The content of the packages is determined elsewhere,
often (but not necessarily) in corresponding "use" statements.

Anno


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

Date: Wed, 27 Jun 2001 11:39:15 +0200
From: Patrick Steiner <patrick.steiner@alcatel.ch>
Subject: Localtime Error ?!
Message-Id: <3B39A9C3.539981B5@alcatel.ch>

Hi
I have a problem with localtime.

My Script:

#####################
#!/usr/bin/perl

@jetzt = localtime(time);
     foreach $wert (@jetzt) {
                 print "Wert ist $wert\n";
     }
########################

This produce the following output:

Wert ist 36
Wert ist 32
Wert ist 11
Wert ist 27
Wert ist 5     <--
Wert ist 101
Wert ist 3
Wert ist 177
Wert ist 1


But when i run the command "date", the output is:

Wed Jun 27 11:32:36 CEST 2001
          ^
why does i have e different between the month (Jun is the 6. not the 5.)



Sorry for my bad english

Päde



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

Date: Wed, 27 Jun 2001 11:45:14 +0200
From: "Paul Kersey" <mk@ticklets.com>
Subject: Re: Localtime Error ?!
Message-Id: <9hca44$7qe$1@news1.xs4all.nl>

> why does i have e different between the month (Jun is the 6. not the 5.)

perldoc -f localtime




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

Date: Wed, 27 Jun 2001 05:02:47 -0400
From: Jason Goodrow <"goodrow"@opencity. com>
Subject: newbie directory question
Message-Id: <9hc78r$fm1$2@news.panix.com>

Can perl tell the difference between files read from a directory?
say opendir - readdir - do something if file is a hash
?
thanks in advance

goodrow@panix.com



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

Date: Wed, 27 Jun 2001 05:00:47 -0400
From: Jason Goodrow <"goodrow"@opencity. com>
Subject: newbie regex
Message-Id: <9hc753$fm1$1@news.panix.com>

sorry I know I should hunt longer but my brain gave up -

I want to match files with two digits at the begining

if ($file =~ /\d\d.+/)

I know this is all wrong.

Thanks for any info
goodrow@panix.com



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

Date: Wed, 27 Jun 2001 18:47:21 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: newbie regex
Message-Id: <Ijh_6.1$PG1.390@vic.nntp.telstra.net>

"Jason Goodrow" <"goodrow"@opencity. com> wrote in message
news:9hc753$fm1$1@news.panix.com...
> sorry I know I should hunt longer but my brain gave up -
>
> I want to match files with two digits at the begining
>
> if ($file =~ /\d\d.+/)
>

Just make the match at the beginning.

if ($file =~ /^\d\d/)

The .+ is not really necessary unless you want to be sure there is at least
one 'something' after the two numbers.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Wed, 27 Jun 2001 11:06:21 +0200
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: Re: newbie regex
Message-Id: <9hc6p5$a4a$1@newstoo.ericsson.se>

if (file =~ /^(\d\d)/) {
        print $1;
}


"Jason Goodrow" <"goodrow"@opencity. com> skrev i meddelandet
news:9hc753$fm1$1@news.panix.com...
> sorry I know I should hunt longer but my brain gave up -
>
> I want to match files with two digits at the begining
>
> if ($file =~ /\d\d.+/)
>
> I know this is all wrong.
>
> Thanks for any info
> goodrow@panix.com
>




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

Date: Wed, 27 Jun 2001 00:46:38 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Perl *is* strongly typed (was Re: Perl description)
Message-Id: <Pine.SUN.4.33.0106270041400.13257-100000@mamba.cs.Virginia.EDU>

On 26 Jun 2001, Joe Schaefer wrote:

> David Coppit <newspost@coppit.org> writes:
>
> > How many decimal places before a difference becomes "meaningful"? Perl
> > thinks my original example is "meaningful", and that's good enough for
> > me:
>
> No. Perl "stringifies" doubles according to your platform's precision,
> which is usually around 15 decimal places on a 32 bit OS. Discrepancies
> between numbers like 1 and .999999999999999 is simply due to round-off
> error.  It it the *programmer's* responsibility to determine a
> reasonable level of precision when working with doubles.  Like C, Perl
> cannot, and will not, do this for you.

What's a double? Is this some type in Perl?

> >   $a = 1/3;
> >   $b = 1/3 . '';
> >
> >   print "different\n" if $a * 3 != $b * 3;
>                            ^^^^^^^^^^^^^^^^
>
> No: "==" is only meaningful if $a and $b are int's , or at least nearly
> so (i.e. becomes an integer when multiplied by 10**$n, for some
> $n < machine's precision (15 on a 32 bit OS) ).

What's an int? Some other type? Of course I'm being facetious here --
my point is that you really do have to know about the underlying
numeric and string types. And as long as that is true, we're only
fooling ourselves by saying that a "scalar" is a fundamental type in
Perl.

> That should not be too surprising, since freeze() serializes perl's
> internal representation of the scalar.  If you want to compare them
> as Perl scalars, you should be comparing their thaw()ed representations
> instead.

Hey, thanks! Didn't know that. :)

David



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

Date: Wed, 27 Jun 2001 10:40:04 +0200
From: Philip Newton <pne-news-20010627@newton.digitalspace.net>
Subject: Re: Perl to Convert Code
Message-Id: <jt6jjtsjgl800luq6vt0boo2d464b4krsp@4ax.com>

On 26 Jun 2001 09:53:39 -0500, Ren Maddox <ren@tivoli.com> wrote:

>     for my $string (@strings) {
>       s/(?<=\b$string)#//g;
>     }

I'd suggest throwing \Q...\E in there, in case the OP wants to match
'FOO.BAR' but not 'FOOLBAR', or 'etre???'.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 27 Jun 2001 10:02:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl variable
Message-Id: <gqbjjt0b3nlv63m9g76o104nf6839q5co2@4ax.com>

Thierry wrote:

>with shell:
>$ nb=`ps -ef|grep toto| wc -l`
>$ echo $nb
>3
>
>with perl ???
>something like nb=system(ps -ef|grep toto|wc -l)
That would be 

	$nb=system("ps -ef|grep toto|wc -l");

but you loose all info sent to STDOUT from the program, as system()
doesn't catch it. Instead, use

	$nb=`ps -ef|grep toto| wc -l`;
	print $nb;		# for example

-- 
	Bart.


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

Date: Wed, 27 Jun 2001 08:06:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Problem with Archive::Tar
Message-Id: <sl4jjtsovgohq63jamsuil5aa16rd0vh9m@4ax.com>

Mr. Sunray wrote:

>>    if($file =~ /^.*?\.zip$/i){
>>       system("mv","$file","Archive"); # Move .zip files
>>    }

>Near as I could tell, this 'system' call above was the culprit, though
>I'm not sure why.

I think I get it. I think mv returns control to perl, before having
finished moving the file. So you end up archiving a file that's being
modified while creating the archive. That way, you get a corrupt
archive.

Why are you using an external command for that? If your Archive is on
the same file system as the original file, perl's "rename" will do just
fine. Try something like

	rename $file, "Archive/$file";

if $file is a just a filename.

If the file needsbeing moved to another file system, look into the
Fill::Copy module. That contains a mv function, which falls back to
rename() if it turns out that the destination is on the same disk as the
source. You may even stay very close to your original syntax, and just
do

	mv $file,"Archive";

-- 
	Bart.


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

Date: Wed, 27 Jun 2001 07:23:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: regular expression problem
Message-Id: <bu1jjt0oljb3ouf6bcm5f5ialt1n1m4f7k@4ax.com>

Steve Allan wrote:

>#!/usr/bin/perl -w
>use strict;
>$_ = 'abc';
>/b/g and s/\G/!/;
>print;
>
>% perl foo.pl
>!abc
>
>Did I type something incorrectly?

No... it still prints "ab!c" on my system. I think it's the perl
version, mine is a 5.6.0 (on Windows).

I have a 5.005_03 here on a FreeBSD box, and that, to, prints "!abc". On
MacPerl (the latest release is a 5.004), I get this, too.

Well, it *looks* to me as if the s/\G// is using a wrong pos(), or
simply ignores it. But it *does*¨work, cross my heart etc, on 5.6.0.

-- 
	Bart.


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

Date: Wed, 27 Jun 2001 11:01:21 +0200
From: Danny Hendrickx <daniel.hendrickx@alcatel.be>
Subject: Scanning a file in CGI
Message-Id: <3B39A0E1.5837118E@alcatel.be>

Hello,

I try to write a CGI program that scans a file line by line and prints
out the parts of the line in different variables in a table (parts are
separated by '|' in the file to be scanned).

I used the normal perl way of scanning through the file, but apparantly
this doesn't work. All I get to see is the top row of my table, and no
entries in the table.

Can anyone tell me what I'm doing wrong. The program is below, and below
it is the file I use for scanning.
 
TIA

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

use strict;

use CGI qw(:standard);

my (
    $TITLE,
    $HEADER,
    $ref,$area,$doctitle,$docnr,$doclink,$catalog,$keyw,
    $entry,@entries
   );

$TITLE = "SS31 Document Overview";
$HEADER = "Parm documents";

print header(),start_html($TITLE),h1($HEADER);

print p("<center>h1($HEADER)</center>");
if (param())
  {
  }
else
  {
    print hr();
    open (I,"<s1docs.txt")||die "Cannot open s1docs.txt:$!";
    print p("<table BORDER>
             <tr>
             <td VALIGN=CENTER><b><font size+1>Title</font></b></td>
             <td VALIGN=CENTER><b><font size+1>Number</font></b></td>
             <td VALIGN=CENTER><b><font size+1>Internal
Ref</font></b></td>
             <td VALIGN=CENTER><b><font size+1>Cataloged</font></b></td>
             </tr>");

    while(<I>)           #<== this part does not work
     {
      ($ref,$area,$doctitle,$docnr,$doclink,$catalog,$keyw)= split(/|/);
       
      if ($area eq "PARM")
        {
         print p("<tr>
                <td VALIGN=CENTER><a
href=\"$doclink\">$doctitle</a></td>
                <td VALIGN=CENTER><a href=\"$doclink\">$docnr</a></td>
                <td VALIGN=CENTER>$ref></td>
                <td VALIGN=CENTER>$catalog></td>
                </tr>");
         }

      }  
    close I;
    print p("<tr>
             <td></td>
             <td></td>
             <td></td>
             </tr>
             </table>");

    print end_form(),hr();
  }
print end_html;

and the s1docs.txt file:

1|PARM|document 1|number 1|link 1|yes|key 1
2|MISC|doc 2|nr 2|lnk 2|no|key 2
3|PARM|doc 3|nr 6|lnk 3|no|key 3

-- 
Regards,
                                                ________________
________________________________________________\              /_____
 Feature Development Team Leader WR2A team 7 Services and SAD /
 SW-Engineering - Routing - VJ33                Hendrickx Danny
 phone : +32-3-240 3916                         ALCATEL  TELECOM
 fax   : +32-3-240 9899                         Fr.Wellesplein 1
 mailto:daniel.hendrickx@alcatel.be           2018 Antwerp Belgium
______________________________________________________\  /___________
URL: http://www.se.bel.alcatel.be/CH_sector1/SS31/     \/
*********************************************************************
The early bird gets the worm, but the second mouse gets the cheese.
*********************************************************************


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

Date: Wed, 27 Jun 2001 09:57:45 GMT
From: pontz@NO_SPAMchannel1.com (Brian Pontz)
Subject: Re: Scanning a file in CGI
Message-Id: <3b39a94d.392854789@news.ne.mediaone.net>

>    while(<I>)           #<== this part does not work
>     {
>      ($ref,$area,$doctitle,$docnr,$doclink,$catalog,$keyw)= split(/|/);

Why split every line? You should only split the ones you want

while(<I>) {
	chomp;
	if(/^\d+|PARM|/) {
		($ref,$area,$doctitle,$docnr,$doclink,$catalog,$keyw)=
split(/|/);

>       
>      if ($area eq "PARM")
>        {
>         print p("<tr>
>                <td VALIGN=CENTER><a
>href=\"$doclink\">$doctitle</a></td>
>                <td VALIGN=CENTER><a href=\"$doclink\">$docnr</a></td>
>                <td VALIGN=CENTER>$ref></td>
>                <td VALIGN=CENTER>$catalog></td>
>                </tr>");
>         }
>
>      }  
>    close I;
>    print p("<tr>
>             <td></td>
>             <td></td>
>             <td></td>
>             </tr>
>             </table>");
>
>    print end_form(),hr();
>  }
>print end_html;
>
>and the s1docs.txt file:
>
>1|PARM|document 1|number 1|link 1|yes|key 1
>2|MISC|doc 2|nr 2|lnk 2|no|key 2
>3|PARM|doc 3|nr 6|lnk 3|no|key

Other than that I dont see anything else wrong. Did you view the
source to make sure that it's not printing the data but you browser
isnt displaying it?

Brian


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

Date: Wed, 27 Jun 2001 05:50:09 GMT
From: "Michael Fields" <mr.gadget2@home.com>
Subject: Serial ports, ActiveState Perl and win98SE
Message-Id: <lue_6.255177$p33.5140077@news1.sttls1.wa.home.com>

Greetings all -- I have Active State Perl 5.6.1 running under win98SE
with a Ximati web server running.  All seems to work fine EXCEPT,
I can't for the life of me get the silly perl script to read from the COM
port.  The example in the FAQ for ActiveState says you do an
open ( PORT, "+>COM1" ) or die ... and that you should be able to
read from and write to the file handle using the standard I/O
functions read() and print().  I have the port set in windows to the
correct baud rate (9600), I can talk to the port with Hyperterminal
without any problem (and if I leave Hyperterm running, I get an
open error so I know it is actually referencing COM1).  I have tried
read(PORT,$buff,1) to get  a char, readline etc. and they hang.  If
I substitute a real file name, it can read from it ( the device connected
to the other end of the COM port (my hot tub controller !!) sends
updated status lines every minute, so I know I have data coming
in.  If it makes a difference, I am trying to debug this by running the
script in a DOS window (still in windows, not booted to DOS).  This
will eventually be part of a CGI script but I was trying to work one
fire at a time !!

Anyone else used the COM ports from ActiveState Perl ???
Suggestions ??  ( I have done a search, but seem to keep getting
either very little information, or the one answer in the FAQ
"How do I read from and write to serial ports?" which I
referenced above.

HEP !!

mikey







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

Date: Wed, 27 Jun 2001 08:01:20 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: sorting a hash
Message-Id: <9hbsna$t25$1@newsy.ifm.liu.se>

Its not clear what you want, but here are some examples for you to look at.

You should also consider using an array of hashrefs instead of an hash of
hashrefs, since you only use numerical indexing anyway.

> I'm trying to sort by either 'name' or 'hits'

my %test;
$test{1}{name}="a group";
$test{2}{name}="b group";
$test{3}{name}="d group";
$test{4}{name}="c group";

$test{1}{hits}=20;
$test{2}{hits}=4;
$test{3}{hits}=140;
$test{4}{hits}=14;

my @keys_order_for_sort_by_name=sort {$test{$a}->{name} cmp
$test{$b}->{name}} keys %test;
#Text sort (cmp)

my @keys_order_for_sort_by_hits=sort {$test{$a}->{hits} <=>
$test{$b}->{hits}} keys %test;
#Numerical sort (<=>)

my @list_of_sorted_name=map {$_->{name}} @test{sort {$test{$a}->{name} cmp
$test{$b}->{name}} keys %test};
my @list_of_sorted_hits=map {$_->{hits}} @test{sort {$test{$a}->{hits} <=>
$test{$b}->{hits}} keys %test};

> ie...so would the index #'s 1,2,3 be rearranged or the values within those
> indexes be rearranged

my %newhash;
@newhash{1..keys %test}=@test{sort {$test{$a}->{name} cmp $test{$b}->{name}}
keys %test};
#Create a new renumbered hash sorted by name (%newhash)

/jN
--
_______________________________
Jonas Nilsson
"tez" <troyr@vicnet.net.au> wrote in message
news:sbc_6.12345$qJ4.503668@ozemail.com.au...




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

Date: 27 Jun 2001 05:24:11 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Where I can find BINMODE, any examples ???
Message-Id: <9hbqlr$h9d$3@bob.news.rcn.net>

Peter <rig01@yahoo.com> wrote:
> Where I can find BINMODE, any examples ???

Look up binmode (note the lower case) in the perlfunc document (perldoc -f 
binmode will do that for you).



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1202
***************************************


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