[16624] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4036 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 16 18:05:40 2000

Date: Wed, 16 Aug 2000 15:05:19 -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: <966463518-v9-i4036@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 16 Aug 2000     Volume: 9 Number: 4036

Today's topics:
        'open' and '$!' on Win32 djberg96@my-deja.com
    Re: 'open' and '$!' on Win32 <russ_jones@rac.ray.com>
    Re: 'open' and '$!' on Win32 (Teodor Zlatanov)
    Re: 'open' and '$!' on Win32 (Malcolm Dew-Jones)
    Re: 'open' and '$!' on Win32 <abe@ztreet.demon.nl>
        About Net::Ping <aahopper@mailbox.ucdavis.edu>
        Can I use perl for automated builds? <cadieuxp@sympatico.ca>
    Re: Certain Items in a string <godzilla@stomp.stomp.tokyo>
    Re: Certain Items in a string <smerr612@mailandnews.com>
    Re: cookie problem (Tony L. Svanstrom)
    Re: GD.pm Test Fails? <katz@underlevel.net>
        Grabbing ALL parameters in a cgi script <lithium@ev1.net>
    Re: Grabbing ALL parameters in a cgi script <newsposter@cthulhu.demon.nl>
    Re: Grabbing ALL parameters in a cgi script <flavell@mail.cern.ch>
    Re: Grabbing ALL parameters in a cgi script <godzilla@stomp.stomp.tokyo>
        Image Manipulation Question <jthomson110@home.com>
    Re: need help with  s/// (Mark-Jason Dominus)
        Object Store <nhindle@coppercom.com>
    Re: ODBC question <hartleh1@westat.com>
    Re: parse HTML to make XML <rmore1@my-deja.com>
    Re: Perl - Blinking Text (BUCK NAKED1)
    Re: Perl code for a newbie!! <hartleh1@westat.com>
    Re: Perl to Lotus Notes mail (Eric Bohlman)
        PERLXS Samples Please <nrigas2@yahoo.ca>
        processing groups of checkboxes <m2graham@acs.ryerson.ca>
    Re: processing groups of checkboxes <newsposter@cthulhu.demon.nl>
        Resetting error for select on named pipe (Alan Barclay)
        sort an array <mlee@cs.ust.hk>
    Re: sort an array <Allan@due.net>
    Re: sort an array <russ_jones@rac.ray.com>
    Re: sort an array <mlee@cs.ust.hk>
        wav or mp3 perl module djberg96@my-deja.com
        windows headache <yhvhboy1@home.com>
    Re: windows headache <lr@hpl.hp.com>
    Re: windows headache <abe@ztreet.demon.nl>
    Re: windows headache <jeff@vpservices.com>
    Re: windows headache <lr@hpl.hp.com>
        windows headache: make <yhvhboy1@home.com>
    Re: windows headache: make <abe@ztreet.demon.nl>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 16 Aug 2000 18:47:22 GMT
From: djberg96@my-deja.com
Subject: 'open' and '$!' on Win32
Message-Id: <8nenjj$e0h$1@nnrp1.deja.com>

Hi,

Running NT 4.0, sp5 and Perl 5.6

I noticed that when I perform an 'open' command, $! appears to be set
to true, even if the open was successful.  I checked some of the FAQ
docs, but didnt' see anything.

e.g.

open(FH, "someFile.txt") or die "\nUnable to open file"; # Works

if($!){                              # $! is set! (?)
   print "\nOops!  OS error.";
}

I don't get this behavior on Unix.  What's going on?  Thanks in
advance for
any help provided.

Regards,
Daniel


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 16 Aug 2000 14:34:59 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: 'open' and '$!' on Win32
Message-Id: <399AECE3.78E7F01B@rac.ray.com>

djberg96@my-deja.com wrote:
> 
> Hi,
> 
> Running NT 4.0, sp5 and Perl 5.6
> 
> I noticed that when I perform an 'open' command, $! appears to be set
> to true, even if the open was successful.  I checked some of the FAQ
> docs, but didnt' see anything.
> 
> e.g.
> 
> open(FH, "someFile.txt") or die "\nUnable to open file"; # Works
> 
> if($!){                              # $! is set! (?)
>    print "\nOops!  OS error.";
> }
> 

I think that what you call "working on unix" is just a coincidence. $!
is the last operating system error, which, if the open worked, you
didn't have. From Programming Perl, you shouldn't depend on the value
of $! to be anything in particular unless you've gotten a specific
error return indicating a system error. So $! would be useful in your
"die" statement, but not in the if statement like you have it.

	... or die "Unable to open file: $!";

would tell you what error had caused you to die.

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: 16 Aug 2000 15:47:56 -0500
From: tzz@iglou.com (Teodor Zlatanov)
Subject: Re: 'open' and '$!' on Win32
Message-Id: <399aefec$1_2@news.iglou.com>

<8nenjj$e0h$1@nnrp1.deja.com>:djberg96@my-deja.com:comp.lang.perl.misc:Wed, 16 Aug 2000 18:47:22 GMT:quote:
: I noticed that when I perform an 'open' command, $! appears to be set
: to true, even if the open was successful.  I checked some of the FAQ
: docs, but didnt' see anything.
: 
: open(FH, "someFile.txt") or die "\nUnable to open file"; # Works
: 
: if($!){                              # $! is set! (?)
:    print "\nOops!  OS error.";
: }
: 
: I don't get this behavior on Unix.  What's going on?  Thanks in
: advance for any help provided.

from perldoc perlvar:

     $!      If used in a numeric context, yields the current
             value of errno, with all the usual caveats.  (This
             means that you shouldn't depend on the value of $!
             to be anything in particular unless you've gotten a
             specific error return indicating a system error.)

Basically, errno is only meaningful if an error has ocurred.  There has been
no error, so it could be set to anything and it's irrelevant.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


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

Date: 16 Aug 2000 12:51:16 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: 'open' and '$!' on Win32
Message-Id: <399af0b4@news.victoria.tc.ca>

djberg96@my-deja.com wrote:
: Hi,

: Running NT 4.0, sp5 and Perl 5.6

: I noticed that when I perform an 'open' command, $! appears to be set
: to true, even if the open was successful.  I checked some of the FAQ
: docs, but didnt' see anything.

from perlvar.pod

=item $!

If used in a numeric context, yields the current value of errno, with
all the usual caveats.  (This means that you shouldn't depend on the
value of C<$!> to be anything in particular unless you've gotten a
specific error return indicating a system error.)  If used in a string



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

Date: Wed, 16 Aug 2000 22:14:04 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: 'open' and '$!' on Win32
Message-Id: <50tlpsg3rfmnqhnejrrl119csqr31qhuqu@4ax.com>

On Wed, 16 Aug 2000 18:47:22 GMT, djberg96@my-deja.com wrote:

> Hi,
> 
> Running NT 4.0, sp5 and Perl 5.6
> 
> I noticed that when I perform an 'open' command, $! appears to be set
> to true, even if the open was successful.  I checked some of the FAQ
> docs, but didnt' see anything.
> 
> e.g.
> 
> open(FH, "someFile.txt") or die "\nUnable to open file"; # Works
> 
> if($!){                              # $! is set! (?)
>    print "\nOops!  OS error.";
> }
> 
> I don't get this behavior on Unix.  What's going on?  Thanks in
> advance for any help provided.

This is from perlvar:

  $!      If used numerically, yields the current value of the C `errno'
          variable, with all the usual caveats. (This means that you
          shouldn't depend on the value of `$!' to be anything in
          particular unless you've gotten a specific error return
          indicating a system error.) 
          
-- 
Good luck,
Abe


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

Date: Wed, 16 Aug 2000 14:40:36 -0700
From: Alan Hopper <aahopper@mailbox.ucdavis.edu>
Subject: About Net::Ping
Message-Id: <Pine.GSO.4.21.0008161434050.7730-100000@sandman.ucdavis.edu>

I am trying a very simple script using the Net::Ping module.
Whenever I use a hostname this command works fine:

$p = Net::Ping->new();
print "Found $host\n" if $p->ping($host);

but if I use an ip address it does not work:

$p = Net::Ping->new();
print "Found $host\n" if $p->ping("xxx.xxx.xxx.xxx");

The documentation for Net::Ping says that both a hostname and an ip
address are valid. Inside the Net::Ping module I found that the function
inet_aton was called to tranlate the ip address into something
useful. According to what I see everything should work. Any suggestions on
what is wrong or where I can look?

Alan



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

Date: Wed, 16 Aug 2000 19:01:39 GMT
From: "Pierre Cadieux" <cadieuxp@sympatico.ca>
Subject: Can I use perl for automated builds?
Message-Id: <nyBm5.159495$Gh.2639480@news20.bellglobal.com>

Hi!

I am a Perl beginner; but I have 20 years of programming and designing in
many languages.

I have to automate the nightly build of a bunch of C++ and Java software
that builds Web components. This means:

a) getting from source control (and controlling version labels and build
numbers)
b) invoking compilers/linkers/IDEs/makes
c) managing logfiles, error detection and reporting
d) possibly burning a CD
e) possibly installing the software on another machine
f) possibly running some automated tests
etc.

1. Is Perl a good choice?

2. I have to build on Windows NT 4.0 and on Solaris. What version(s) of Perl
should I use if I want to have maximum portability of my Perl code between
these two platforms?

3. is there any existing Perl software (free or not, CPAN or otherwise) that
can help with aumated builds?

4. I bought two books:
    - Learning Perl on Win32 systems
    - PERL in a nutshell

Is the nutshell book a good way to learn PERL real quick and start coding my
automated build?
Or do you have anything better to recommend?

Thanks

Pierre







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

Date: Wed, 16 Aug 2000 11:08:03 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Certain Items in a string
Message-Id: <399AD883.1E56C21F@stomp.stomp.tokyo>

Larry Rosler attempts to cover for his hatred:

> Godzilla! wrote:

(snippage with Socratic Scissors)

> This is clearly erroneous, and further discussion of it 
> is fruitless.


Otherwords, "Please don't say anymore about this."



Would you rather discuss your persistent insistence
of introducing hatred into this newsgroup, in keeping
with customary habit so commonplace here? My presumption
is you would rather not considering this poorly concealed
attempt at drawing this stage spotlight off your malice
intent and hatred.

Might be more metaphysical fun to discuss this originating
article for the fake it is, posted by this man/woman of
myriad fake faces and myriad fake names, making fools of
you foolish people, time and time again.

As for you Frank, setting aside this fool Rosler,
after all these years, if you had just a small lick
of sense, you would realize your impotent transparent
mind games are just child's play for me, your clear
intellectual superior, as always and always be.


"Socratic Irony makes a great spice for Socratic Tea."

  - Kira


Godzilla!


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

Date: Wed, 16 Aug 2000 19:06:10 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: Certain Items in a string
Message-Id: <8neomi$f7o$1@nnrp1.deja.com>

In article <399A485A.56B476A7@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:

<Gojira style snippage>

> He
> will never wise up, nor will you, the reader.
>
> Godzilla!

How very true, you will certainly never get wiser reading Gojira's
posts.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 16 Aug 2000 23:01:24 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: cookie problem
Message-Id: <1efhbtl.jy3pr21r21thkN%tony@svanstrom.com>

MartinQz <martinqz@taiwan.com> wrote:

> sub setCookies{
>    local($name, $value, $path, $domain, $secure) = @_;
>    print "Set-Cookie: ";
>    print ($name, "=", $value, "; path=", $path, "; domain=", $domain, ";
> ", $secure, "\n");
> }

One thing, do you really mean to set the cookie without an exires-date/time?

If you want to set a date/time then make sure you do it by the standard, because
Mozilla and IE are too forgiving when it comes to that... meaning that you think
"hey, it works" while it doesn't work in other webbrowsers.

use strict;

sub the_swedish_cookiemaker() {

   # (c)2000 svanstrom.com - vers: 2000y-06m-07d 01:10t CET

   my($name,$value,$stay,$path,$domain,$sec) = @_;
   if (($domain =~ tr/\.//) < 2) {$domain = ".$domain";}
   my @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday',
        'Saturday');
   my @months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct',
        'Nov','Dec');
   (my @temptime) = gmtime(time+$stay);
   my $cookietime = "@days[$temptime[6]], $temptime[3]-@months[$temptime[4]]-".
        ($temptime[5]+1900) . " "; my @ends = (':',':',' GMT',);
   my $i; foreach ($temptime[2],$temptime[1],$temptime[0]) {
      $i++;
      if ($_ < 10) {$cookietime .= "0$_$ends[$i-1]"
      } else {$cookietime .= "$_$ends[$i-1]"
      }
   }
   return("Set-Cookie: $name=$value; expires=$cookietime; path=$path;".
   " domain=$domain; $sec\n");
}

print
&the_swedish_cookiemaker('namn','value',60*60*24*365,'/','svanstrom.com',0);


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
 DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82  78A6 647F F247 9363 F1DB
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©1999  <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: 16 Aug 2000 15:17:29 -0400
From: Jordan Katz <katz@underlevel.net>
Subject: Re: GD.pm Test Fails?
Message-Id: <m366p1hv7a.fsf@underlevel.underlevel.net>

brudden@goebusiness.com writes:

> I'm having problems with the GD.pm module on sun sparc solaris 2.6 
> system.
> No errors durring make, only in the test:
[snip]
> I have the libs installed :libpng, libz.  Everything built with the same 

I assume you have libgd installed..

> compiler (gcc).  Looking at the README.unix, they mention a similar issue 
> on Linux related to dynamicaly loading modules but no mention of how to 
> fix it on solaris(if that issue is even related).  Any ideas? 

I've had the exact same problem on Solaris 2.6 (`make` and `make install`
running correctly, but `make install` failing), and I too was wondering
if it had to do with the RPM problem mentioned in the docs.

At the time I used GD::Graph, which requires GD.pm, and all of the
Perl scripts which used GD::Graph worked perfectly despite the `make
test` errors GD.pm generated.  As long as zlib, libpng, and libgd are
correctly installed it should work. Try running the sample scripts
that comes with GD.pm manually and see what happens.  
-- 
Jordan Katz <katz@underlevel.net>


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

Date: Wed, 16 Aug 2000 16:05:38 -0500
From: "Lithium" <lithium@ev1.net>
Subject: Grabbing ALL parameters in a cgi script
Message-Id: <spm0cqngr5j92@corp.supernews.com>

I've found references to being able to get a list of ALL the parameters
passed to a cgi script, rather than pull up the parameters specifically, but
no information on how.  I've tried @_, param(1), etc... no joy.  I believe
perl 4 even used to force you to do that before perl 5 came along... but so
far I haven't found a way to get a list of all parameters, instead having to
require them under set names.

Anyone know how to get around this, maybe bring up a hash table of parameter
names and values, etc?  I need this for a formmail script I'm working on,
and all the ones I've looked at use the same method the one I already made
uses - requiring specific parameters.






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

Date: 16 Aug 2000 21:14:36 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Grabbing ALL parameters in a cgi script
Message-Id: <8nf07s$hn8$1@internal-news.uu.net>

Lithium <lithium@ev1.net> wrote:
> I've found references to being able to get a list of ALL the parameters
> passed to a cgi script, rather than pull up the parameters specifically, but
> no information on how.

Check out the CGIU.pm documentation:
   FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR SCRIPT:

Erik



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

Date: Wed, 16 Aug 2000 23:34:32 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Grabbing ALL parameters in a cgi script
Message-Id: <Pine.GHP.4.21.0008162327420.22432-100000@hpplus03.cern.ch>

On Wed, 16 Aug 2000, Lithium wrote:

> I've found references to being able to get a list of ALL the parameters
> passed to a cgi script, rather than pull up the parameters specifically, but
> no information on how.  

This means you either haven't found the documentation for CGI.pm (you
_are_ using CGI.pm, yes?) or that you haven't bothered to consult it.

The latter possibility needs no discussion here.

As I've noted before (and no-one seems to have proved me wrong yet,
but I'm open to that), the standard Perl installation seems to include
a version of CGI.pm and POD documentation for it; but there's better
documentation maintained and distributed in HTML format by the author,
not to be confused with the POD-to-HTML-generated version based on the
distributed POD.

If you could review your own situation and report why you couldn't
find the doc, and make a proposal for remedying that situation, then
I'd say the whole community would stand to benefit.  Often, the
regulars already know where to look, and they forget how daunting this
all can be to a newcomer.

good luck



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

Date: Wed, 16 Aug 2000 14:38:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Grabbing ALL parameters in a cgi script
Message-Id: <399B09EC.8FCEB30@stomp.stomp.tokyo>

Lithium wrote:

Is this Lithium grease or Lithium as 
in thermonuclear device?
 
> I've found references to being able to get a list of 
> ALL the parameters passed to a cgi script, rather than 
> pull up the parameters specifically, but no information
> on how.  I've tried @_, param(1), etc... no joy.  
> I believe perl 4 even used to force you to do that 
> before perl 5 came along... 

(snippage)

I don't use cgi.pm and never will, even for testing.
So, some untested code which I believe will work fine.
You can work on setting this up to run. Basic logic
is displayed for you. Details are your task.

use CGI;
my ($query) = new CGI;
my ($key, $value);
foreach $key ($query -> param)
 {
  print "KEY: $key\n";
  foreach $value ($query -> param ($key))
   { print "VALUE: $value\n"; }
 }


How this is done in Perl 4 is a secret, seasoned
experienced programmers guard well.

Godzilla!


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

Date: Wed, 16 Aug 2000 21:32:10 GMT
From: "James" <jthomson110@home.com>
Subject: Image Manipulation Question
Message-Id: <uLDm5.3732$ZI2.91482@news1.rdc1.il.home.com>

Does anyone know of any routines, scripts or recommendations on creating a
script that would take
a directory of images and create a new directory of those
same images - only shrunken in size?

Basically a script that would make REAL thumbnails
from images in a certain directory.

I'm guessing the GD module might need to be used, but don't know...

Any help would be appreciated!

P.S.  If you want a good laugh, check out:

http://www.nutsackdance.com




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

Date: Wed, 16 Aug 2000 19:31:34 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: need help with  s///
Message-Id: <399aec16.4ef1$230@news.op.net>

In article <oVwm5.16109$671.1916916@nnrp4.clara.net>,
Eric Surin <esurin@mail.com> wrote:
>I want to replace all (\%0D\%0A)  with +++ or 3 spaces.
>but the following lines don't work :
>
>$value =~ s/(\%0D\%0A)/+++/eg;
>$value =~ s/(\%0D\%0A)/\+\+\+/eg;
>$value =~ s/(\%0D\%0A)/   /eg;

Get rid of the 'e'.  'e' means to interpret the second part of the
s/// command as a perl program to be executed.  Executing '+++' results
in a syntax error because '+++' is not legal in a perl program.
Executing '   ' does nothing.

Try

        $value =~ s/(\%0D\%0A)/+++/g;


This will do the same thing:

        $value =~ s/%0D%0A/+++/g;

You might want to allow lowercase 'a' and 'd' also:

        $value =~ s/%0D%0A/+++/gi;






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

Date: Wed, 16 Aug 2000 16:17:09 -0400
From: "Nick Hindle" <nhindle@coppercom.com>
Subject: Object Store
Message-Id: <fJCm5.1$0z3.101@wdc-read-01.qwest.net>

Has anyone used the ObjStore module for accessing the objectstore OODBMS,
and do they have any sample code or help they could give me?

Any help on writing code to access the Objectstore OODBMS would be helpful.

Thanks.

Nick.




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

Date: Wed, 16 Aug 2000 16:02:52 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: ODBC question
Message-Id: <399AF36C.74822CF3@westat.com>

DM wrote:
> 
> Thanks, but I have been there already.  I even have the book "Win32 on
> NT".  The site is good if things are working correctly but not if
> something is amiss.  I was hoping to get some help on this problem
> because I have nowhere else to go for an answer.
> 
> After following all steps in the ODBC install the ODBC.pm works fine
> from the prompt, but seesm to be missing something through a web server.
> 

You've been there but did you read the FAQ
<http://www.roth.net/perl/odbc/faq/>?  See:

"I can access my DSN from a command line but not from my Web Server."

> Error:
> Missing $ on loop variable at C:\perl\lib/Exporter.pm line 40. BEGIN
> failed--compilation aborted at C:\Inetpub\wwwroot\cgi-bin\engine6.pl
> 
> I am having trouble figuring out exactly what the error is because
> Exporter.pm is not commented.  I am assuming certian variables needed
> are not being passed to the module.  Hopefully soeone can provide some
> helpful advise.

Well, you didn't mention Exporter.pm in your original post.  You just
asked how to install ODBC.pm so it's not too surprising you just got
pointed to the ODBC.pm documentation which has all the installation
instructions I ever needed.  At least read that FAQ mentioned above and
ensure that's not your problem.  Then, come back with more info and I'll
see what I can do.  

Henry Hartley


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

Date: Wed, 16 Aug 2000 19:17:55 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: parse HTML to make XML
Message-Id: <8nepce$g77$1@nnrp1.deja.com>

In article <6qjm5.5303$Cc2.207931@newsread1.prod.itd.earthlink.net>,
  "Arvind Kuk" <arvind_kuk@hotmail.com> wrote:
> Anyone ever have to parse HTML to turn it into XML for storage?
> Wondering what the best approach to do this would be, if anyone's got
any
> experience doing so.
>
> Many thanks...

Turn your HTML into XHTML
see: http://www.w3.org/TR/xhtml1/
--
=============================
Richard More
http://www.richmore.com/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 16 Aug 2000 14:06:54 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl - Blinking Text
Message-Id: <1415-399AE64E-5@storefull-242.iap.bryant.webtv.net>

Thanks anyway, but it appears that those /240 errors weren't the only
thing causing Greg's blink script not to work. Now it says that I cannot
use "use" in the line "use POSIX..." Maybe the syntax in that line is
incorrect?   --Dennis



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

Date: Wed, 16 Aug 2000 16:34:12 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: Perl code for a newbie!!
Message-Id: <399AFAC4.D4C706AA@westat.com>



Bart Lateur wrote:
> 
> Look at what software he used to post. MS Outlook does this kind of
> quoting by default and *without you even noticing*. All you see in your
> message window is what you type yourself.

Well, I don't use it as a mail reader so perhaps there it works that
way.  As a mail reader it at least shows you the quoted material.  But
not only does it default to jeopardy style posting, as far as I can
tell, there is no way to change that setting.  Each message responded to
must have a manual jeopardectomy performed.  Arrgh!  I've started adding
"another Jeopardectomy performed by" above my name in the signature and
once in a great while someone notices.

-- 
Henry Hartley


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

Date: 16 Aug 2000 20:55:56 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl to Lotus Notes mail
Message-Id: <8nev4s$8kf$1@slb3.atl.mindspring.net>

sankarmukh@my-deja.com wrote:
: I am trying to send a test message from unix box acct (ctssmuk) to
: Loyus notes acct using the following script. The script doesn't generate
: any output nor any error.
: ******************************************************************
: #!/usr/local/bin/perl -w
: 
: use Net::SMTP;
: 
: $smtp = Net::SMTP->new('pcfpdn02');

No check to see whether this succeeded.

: $smtp->mail('ctssmuk');
: $smtp->to('sankarmukhopadhyay\@inautix.com');

Do you have a literal backslash in your address?


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

Date: Wed, 16 Aug 2000 16:49:48 -0500
From: Nektarios Rigas <nrigas2@yahoo.ca>
Subject: PERLXS Samples Please
Message-Id: <399B0C7C.DB11E30@yahoo.ca>

Hello,

I am a newbie to Perl, plus I got a project here at work requiring me to learn
perlXS.
I am searching for sample code that works, and all I get when I search the net
is the perlxstut and that is just not enough for me.

Does anyone have any decent  XS code that is willing to forward to me , or know
where I can find some to download and look at.
If you do send me anything, Please attach any other files that may be needed to
understand the file (E.g.. Typemaps, C code used).

Thank You
Nektarios Rigas.



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

Date: Wed, 16 Aug 2000 16:03:25 -0400
From: Michael Graham <m2graham@acs.ryerson.ca>
Subject: processing groups of checkboxes
Message-Id: <399AF38C.2A3519BF@acs.ryerson.ca>

greetings - i have been using the param() method of CGI.pm as follows to
build a hash of the name/value pairs.

   my @names = param();
   foreach $name ( @names ) {
      my $value = param( $name );
      $cgivars{$name} = $value;
   }

i now have a form where four checkboxes have the name ['day'] and
different values.  if more than one checkbox is checked the code above
only 'sees' only the first 'day'/value pair.

in looking for a solution the only one i've found is to 'manually' parse
the query string. while i have code that does this i'm wondering if
there is another solution - is there a method in cgi.pm that i could be
using or another module that will process groups of checkboxes?

thanks



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

Date: 16 Aug 2000 20:28:55 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: processing groups of checkboxes
Message-Id: <8neti7$g34$1@internal-news.uu.net>

Michael Graham <m2graham@acs.ryerson.ca> wrote:

> greetings - i have been using the param() method of CGI.pm as follows to
> build a hash of the name/value pairs.

>    my @names = param();
>    foreach $name ( @names ) {
>       my $value = param( $name );
>       $cgivars{$name} = $value;
>    }

> i now have a form where four checkboxes have the name ['day'] and
> different values.  if more than one checkbox is checked the code above
> only 'sees' only the first 'day'/value pair.

> in looking for a solution the only one i've found is to 'manually' parse
> the query string. while i have code that does this i'm wondering if
> there is another solution - is there a method in cgi.pm that i could be
> using or another module that will process groups of checkboxes?

Check CGI.pm's documentation. Especially the 'FETCHING THE VALUE OR
VALUES OF A SINGLE NAMED PARAMETER:' section.

Erik



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

Date: 16 Aug 2000 21:49:32 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Resetting error for select on named pipe
Message-Id: <966462568.102324@elaine.furryape.com>

I have a requirement to select() on several named pipes, reading the
data from the pipe as it becomes available.

However, I have found that while the select() behaves properly initially,
if a writer closes it's connection to the pipe, then from then on I get
an error condition, presumably eof(). This means that the select nolonger
blocks, and the program spins CPU busy.

The only way I have found to reset the error condition is to close &
reopen the pipe. This is not an ideal solution, as it causes new writers
to block until the pipe is reopened, and existing writers may get a
SIGPIPE.

I have tried a seek(), which the documentation suggests may clear an EOF
condition, but apparently in my case it does not. 

Have I found the only solution, or are there any alternatives?

I'm running 5.005_03 under Linux kernel 2.2.12/Red Hat 6.1, and
I compiled the perl myself, so it's not RedHat's broken
installation.

Here is my test program. Use 'cat data > inpipe' to simulate a writer
sending some data.


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

use strict;

if(!-e"inpipe"){ system("mknod inpipe p"); } #Create pipe if it doesn't exist
if(!-p "inpipe"){ die "Cannot find pipe\n"; }

sysopen(INPIPE,"inpipe",0,0666) or die;
my ($rin,$rout,$ein,$eout)="";
vec($rin,fileno(INPIPE),1) = 1;
$ein=$rin;
my $loop=0;
while($loop<10){ # Limited # of loops, to avoid filling the screen
        my $timeout=10;

        my $nfound = select($rout=$rin, undef, $eout=$ein, undef);
	print "$nfound = $nfound\n";
        if(vec($rout,fileno(INPIPE),1)){
        my $stuff;
        my $res=sysread INPIPE,$stuff,4096;
                print "\nGot $stuff,$res,$!\n";
        }
        if(vec($eout,fileno(INPIPE),1)){
                print "Got error on pipe\n";
#               seek(INPIPE,0,1);
# Also tried    my $curpos=tell(INPIPE);seek(INPIPE,$curpos,0);
                close(INPIPE);
                sysopen(INPIPE,"inpipe",0,0666)  or die;
        }
        print "Loop $loop\n";
        $loop++;
}
print "\n";



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

Date: Thu, 17 Aug 2000 02:40:04 +0800
From: Michael Lee <mlee@cs.ust.hk>
Subject: sort an array
Message-Id: <399AE004.5BA588C0@cs.ust.hk>

Michael wrote,

Hi,

I have a question. I need to sort an array, and the array is like this:
@x = ("Peter C,1,1,1","Alan W,2,2,2","Alan A,3,3,3")

And I expect the result should be like:
@x2 = ("Alan A,3,3,3","Alan W,2,2,2","Peter C,1,1,1")

Can you give me any suggestion?

Thanks for your kindly help.


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

Date: Wed, 16 Aug 2000 15:22:47 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: sort an array
Message-Id: <8nepnp$4gc$1@slb2.atl.mindspring.net>

"Michael Lee" <mlee@cs.ust.hk> wrote in message
news:399AE004.5BA588C0@cs.ust.hk...
: I have a question. I need to sort an array, and the array is like this:
: @x = ("Peter C,1,1,1","Alan W,2,2,2","Alan A,3,3,3")
: And I expect the result should be like:
: @x2 = ("Alan A,3,3,3","Alan W,2,2,2","Peter C,1,1,1")
: Can you give me any suggestion?

Oddly,
@x2 = sort @x;
gives the specifed result.  What did you try?

HTH

AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
echo $package has manual pages available in source form.
echo "However, you don't have nroff, so they're probably useless to you."
 - Larry Wall in Configure from the perl distribution




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

Date: Wed, 16 Aug 2000 14:36:28 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: sort an array
Message-Id: <399AED3C.94948790@rac.ray.com>

Michael Lee wrote:
> 
> Michael wrote,
> 
> Hi,
> 
> I have a question. I need to sort an array, and the array is like this:
> @x = ("Peter C,1,1,1","Alan W,2,2,2","Alan A,3,3,3")
> 
> And I expect the result should be like:
> @x2 = ("Alan A,3,3,3","Alan W,2,2,2","Peter C,1,1,1")
> 
> Can you give me any suggestion?
> 
> Thanks for your kindly help.



perldoc -q sort

You're welcome.



-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Thu, 17 Aug 2000 04:25:22 +0800
From: Michael Lee <mlee@cs.ust.hk>
Subject: Re: sort an array
Message-Id: <399AF8B2.D3CB4272@cs.ust.hk>

The book just show me sort $a <=> $b @x ....
Now I konw sort can sorting a LIST with no other parameters.
Thanks!

"Allan M. Due" wrote:
> 
> "Michael Lee" <mlee@cs.ust.hk> wrote in message
> news:399AE004.5BA588C0@cs.ust.hk...
> : I have a question. I need to sort an array, and the array is like this:
> : @x = ("Peter C,1,1,1","Alan W,2,2,2","Alan A,3,3,3")
> : And I expect the result should be like:
> : @x2 = ("Alan A,3,3,3","Alan W,2,2,2","Peter C,1,1,1")
> : Can you give me any suggestion?
> 
> Oddly,
> @x2 = sort @x;
> gives the specifed result.  What did you try?
> 
> HTH
> 
> AmD
> --
> $email{'Allan M. Due'} = ' All@n.Due.net ';
> --random quote --
> echo $package has manual pages available in source form.
> echo "However, you don't have nroff, so they're probably useless to you."
>  - Larry Wall in Configure from the perl distribution


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

Date: Wed, 16 Aug 2000 19:13:55 GMT
From: djberg96@my-deja.com
Subject: wav or mp3 perl module
Message-Id: <8nep4v$fl4$1@nnrp1.deja.com>

Hi all,

Can anyone out there direct me to a module that plays .mp3 or .wav
files for both Win32 and Unix? I'm not looking for anything complex.
Just play the stinkin' file.

I have used Win32::Sound, but it's a bit quirky (volume varies, won't
play asynchronously) and platform specific.

I've already tried MPEG-MPlay-0.09 from CPAN and I couldn't get that
to 'make', despite downloading xasdk 3.07.

Please help!

Regards,

Daniel Berger


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 16 Aug 2000 20:16:02 GMT
From: yhvhboy1 <yhvhboy1@home.com>
Subject: windows headache
Message-Id: <399AF796.AB9BD691@home.com>

i hit my head on a window.

a copy schript (to test my problem with files getting mangled)
infile is 93,080  mangles outfile to 85 bytes.
here's my code:
#!c:/perl/bin/perl
use strict;

open(IN, 'c:\\command.com');
open(OUT, '>command.com');
print OUT (<IN>);

# no i don't use windows often.



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

Date: Wed, 16 Aug 2000 13:49:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: windows headache
Message-Id: <MPG.14049e419183b82098ac85@nntp.hpl.hp.com>

In article <399AF796.AB9BD691@home.com> on Wed, 16 Aug 2000 20:16:02 
GMT, yhvhboy1 <yhvhboy1@home.com> says...
> i hit my head on a window.

Ouch!

> a copy schript (to test my problem with files getting mangled)
> infile is 93,080  mangles outfile to 85 bytes.
> here's my code:
> #!c:/perl/bin/perl

Use '-w' by habit, even on tiny programs.

> use strict;

Cheers for that!

> open(IN, 'c:\\command.com');

  open(IN, 'c:/command.com') or
     die "Couldn't open c:/command.com. $!\n";

> open(OUT, '>command.com');

I hope that's in a different directory.  See above for diagnostics.

> print OUT (<IN>);

Very likely you have a binary file which has a "\cZ" byte in it early 
on.  The text-handling I/O routines are interpreting that as an end-of-
file indicator.

The solution is to use binmode(), both on the input file and the output 
file.  Then instead of reading a line at a time (when there really are 
no lines in the file), use the following loop, or something like it:

  print OUT $_ while read IN, $_, 8192;

> # no i don't use windows often.

perldoc -f binmode

That will tell you that there is no harm in using binmode() for Unix 
systems also, so you won't have a portability problem -- software or 
wetware.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 16 Aug 2000 23:06:33 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: windows headache
Message-Id: <bovlpso0abbf53b8gvqvt91g35canknpgn@4ax.com>

On Wed, 16 Aug 2000 20:16:02 GMT, yhvhboy1 <yhvhboy1@home.com> wrote:

> i hit my head on a window.
> 
> a copy schript (to test my problem with files getting mangled)
> infile is 93,080  mangles outfile to 85 bytes.
> here's my code:
> #!c:/perl/bin/perl
-w is missing from the shebang line

> use strict;
good

> 
> open(IN, 'c:\\command.com');
Check the result of that open, if it fails, there's no need to continue:

	open IN, 'c:/command.com' or die "Can't open[r] file: $!";

> open(OUT, '>command.com');

ditto (and better make sure you copy it to an other location).

Now comes the important part, binmode() the filehandles:

	binmode IN;
	binmode OUT;

> print OUT (<IN>);

This is sort of strange as binary files don't have 'lines'.

You might want to look into the File::Copy module

	perldoc File::Copy

> 
> # no i don't use windows often.

Which is no excuse for not reading the documentation that is already on
your hard drive:

	perldoc perlopentut

See the section: "Binary Files" for more information.

-- 
Good luck,
Abe


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

Date: Wed, 16 Aug 2000 14:04:38 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: windows headache
Message-Id: <399B01E6.B8D8D754@vpservices.com>

yhvhboy1 wrote:

> print OUT (<IN>);

If you should happen to get the message I just canceled, please ignore
my idiocy about context.  Putting the parens around <IN>, of course puts
it in a list context. So that part of your script is fine.

-- 
Jeff


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

Date: Wed, 16 Aug 2000 14:21:20 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: windows headache
Message-Id: <MPG.1404a5acdaa6f83f98ac86@nntp.hpl.hp.com>

In article <399B01E6.B8D8D754@vpservices.com> on Wed, 16 Aug 2000 
14:04:38 -0700, Jeff Zucker <jeff@vpservices.com> says...
> yhvhboy1 wrote:
> 
> > print OUT (<IN>);
> 
> If you should happen to get the message I just canceled, please ignore
> my idiocy about context.  Putting the parens around <IN>, of course puts
> it in a list context. So that part of your script is fine.

Huh?  It is list context with or without the parentheses.

But that part of the program isn't fine, because it unnecessarily reads 
the entire file into memory before printing it, a 'line at a time' yet 
(whatever that means for a binary file).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 16 Aug 2000 21:04:22 GMT
From: yhvhboy1 <yhvhboy1@home.com>
Subject: windows headache: make
Message-Id: <399B02EB.3109E9BA@home.com>

## at least i didn't break the windows.
## there doesn't appear to be any blood.

# i tried using cygwin make (and tar and unzip, etc)
# in order to make the modules from cpan
# also i have tried nmake.exe .
# i can't get either to work- but i don't know
# for sure if it is the make program
# or else perhaps some other program
# i download the build files fine, unzip them fine
# (and untar them fine)
# the problems begin when i make them.
# does anyone have a list of free programs which should work for this?
# (i'm not going to go out and buy microsoft visual dev just to make
perl modules!)

__END__



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

Date: Wed, 16 Aug 2000 23:34:32 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: windows headache: make
Message-Id: <051mps4g38889euoa2h62ho7ke2ve4ibbr@4ax.com>

On Wed, 16 Aug 2000 21:04:22 GMT, yhvhboy1 <yhvhboy1@home.com> wrote:

> # i tried using cygwin make (and tar and unzip, etc)
> # in order to make the modules from cpan
> # also i have tried nmake.exe .

If you want to know what make to use, type
	perl -V:make

I guess you're using ActivePerl, so it should say "make='nmake';"
(This value is used by ExtUtils::MakeMaker to generate specific make
files when you do 'perl Makefile.PL')

> # i can't get either to work- but i don't know
> # for sure if it is the make program
> # or else perhaps some other program
> # i download the build files fine, unzip them fine
> # (and untar them fine)
> # the problems begin when i make them.

It would be nice if you told us what went wrong and wich modules you are
trying to install.

Did you have a look at PPM (the Perl Package Manager)? And check at the
ActiveState site which (binary) modules they have available?

Pure Perl modules from CPAN should install with nmake.

-- 
Good luck,
Abe


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4036
**************************************


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