[16032] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3444 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 21 14:15:44 2000

Date: Wed, 21 Jun 2000 11:15:32 -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: <961611331-v9-i3444@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 21 Jun 2000     Volume: 9 Number: 3444

Today's topics:
    Re: Setting locale failed. <rootbeer@redcat.com>
    Re: Simple brain picker (Bart Lateur)
    Re: Simple Question <mxusstmm@xoommail.com>
        Simple Reg Expression Question <kennylim@techie.com>
    Re: Simple Reg Expression Question <care227@attglobal.net>
    Re: Simple Reg Expression Question (Greg Bacon)
    Re: Simple Reg Expression Question <abe@ztreet.demon.nl>
    Re: Simple Reg Expression Question (Greg Bacon)
    Re: Simple Reg Expression Question robb4444@my-deja.com
    Re: Simple Reg Expression Question robb4444@my-deja.com
    Re: SMS help <dfleet@avaterra.com>
    Re: SMS help <flavell@mail.cern.ch>
    Re: sourcing bash script w/ Perl? <rootbeer@redcat.com>
    Re: Static Vars and ordering of subroutines <W.Hielscher@mssys.com>
    Re: Switch, Case in Perl <red_orc@my-deja.com>
    Re: Switch, Case in Perl <gellyfish@gellyfish.com>
        Sys::Syslog & _PATH_LOG <d-weber@itg.uiuc.edu>
    Re: system and exec 'holds' perl output <hakon.alstadheim@oslo.mail.telia.com>
    Re: Testing whether filehandle is open <rootbeer@redcat.com>
    Re: Unix database for Perl (Nobody)
        Win32::Internet and flags <pndswimming@hotmail.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 21 Jun 2000 09:03:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Setting locale failed.
Message-Id: <Pine.GSO.4.10.10006210901350.4312-100000@user2.teleport.com>

On Wed, 21 Jun 2000 des3das@my-deja.com wrote:

>  I got this message when I tried to use perl.
> 
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
<snip>

> Can someone tell me how I can correct it. I've tried FAQ's but I can't
> find any reference to it.

It's in perldiag, which says the following.

    =item perl: warning: Setting locale failed.

    (S) The whole warning message will look something like:

	    perl: warning: Setting locale failed.
	    perl: warning: Please check that your locale settings:
		    LC_ALL = "En_US",
		    LANG = (unset)
		are supported and installed on your system.
	    perl: warning: Falling back to the standard locale ("C").

    Exactly what were the failed locale settings varies.  In the above the
    settings were that the LC_ALL was "En_US" and the LANG had no value.
    This error means that Perl detected that you and/or your system
    administrator have set up the so-called variable system but Perl could
    not use those settings.  This was not dead serious, fortunately: there
    is a "default locale" called "C" that Perl can and will use, the
    script will be run.  Before you really fix the problem, however, you
    will get the same error message each time you run Perl.  How to really
    fix the problem can be found in L<perllocale> section B<LOCALE
    PROBLEMS>.

Cheers!

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



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

Date: Wed, 21 Jun 2000 17:10:20 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Simple brain picker
Message-Id: <3953f5e4.2324371@news.skynet.be>

Bart Lateur wrote:

>	$first_three = substr($serialno, 3, 3);
>	substr($first_three, 1, 0) = "."; 

Oh, and there is sprintf("%4.2f", $version/100) and s/(.)/$1./ as well.

-- 
	Bart.


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

Date: Wed, 21 Jun 2000 12:37:43 -0700
From: "mxusstmm" <mxusstmm@xoommail.com>
Subject: Re: Simple Question
Message-Id: <bf645.1158$u3.9080@news2.tor.primus.ca>

Changing to the .cgi extension did the trick.
Thank you.

P.S. I just love this language.


<fperkins@my-deja.com> wrote in message news:8iqeht$3em$1@nnrp1.deja.com...
> It sounds like your webserver doesn't know that .pl should be executed
> using Perl.  Make sure you configured your NT box so that .pl are
> registered to run Perl.  I remember there being info with ActiveState's
> win32 flavor or Perl which showed you how to do this.
>
> What if you tried changing your script to a .cgi extension?  I wonder
> if that would work...
>
> Frank
>
> In article <re%35.996$73.7240@news1.tor.primus.ca>,
>   "mxusstmm" <mxusstmm@xoommail.com> wrote:
> > Just picked up PERL so help would be appriciated with this question.
> > I just finished PC magazine's PERL 5.0 CGI Web Pages book.
> >
> > Here's my problem:
> >
> > I uploaded my PERL scripts to my ISP.
> > I followed all of thier directions regaring cgi file location and the
> > #!usr/bin/perl line, but...
> >
> > When I use the GET method to call the pl file, I just see the whole
> script
> > in the browser like unformatted text.When I use POST from a form, my
> browser
> > wants to download.
> >
> > I've tried to duplicate the error on my server, by turing off access
> to
> > PERL, but I just get 404 errors.
> > Can't seem to duplicate whats going on online.
> >
> > I'm running O'Reily's WebSite server on an NT box to test the stuff,
> but my
> > ISP uses ZEUS on Sun boxes.
> >
> > Has anyone had this set of problems happen to them?
> > Is this my problem or my ISP?
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Wed, 21 Jun 2000 15:31:36 GMT
From: "Kenny Lim" <kennylim@techie.com>
Subject: Simple Reg Expression Question
Message-Id: <sd545.23413$FC6.535682@newsread1.prod.itd.earthlink.net>

Hi All,

I am trying to convert a given ID to hexa-decimal format
and would like to know  if there is a simpler method opposed to
what I currently have.

also..

(Q) How do we store the hex id generated into an array instead of
a filehandle. When I attempt to print the new hexadecimal id
into an array, I get the following result - ARRAY(0x8b92214)
instead of the converted hexadecimal value when printing it out.


Id : DA86E130-470E-11D4-9F14-0080ADC93510

Hexadecimal : 0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80, 0xAD,
0xC9, 0x35, 0x10

#===============
#snippets of my code.
#===============

my $ID;
$ID = `ETGuidGen`; <--This will generate a new unique id each them is
executed.
print   "$ID\n";

open (LOAD2, "> hexid2.txt") or die "Could not open hexid.txt: $!";
<---how to store the converted format into an array

and be printed out. I tried (open LOAD2, "> \@hexid")

but it did not work. (See below for the result)

print LOAD2 "0x" . substr($ID, 1, 8) . ", ";
print LOAD2 "0x" . substr($ID, 10, 4). ", ";
print LOAD2 "0x" . substr($ID, 15, 4). ", ";
print LOAD2 "0x" . substr($ID, 20, 2). ", ";
print LOAD2 "0x" . substr($ID, 22, 2). ", ";
print LOAD2 "0x" . substr($ID, 25, 2). ", ";
print LOAD2 "0x" . substr($ID, 27, 2). ", ";
print LOAD2 "0x" . substr($ID, 29, 2). ", ";
print LOAD2 "0x" . substr($ID, 31, 2). ", ";
print LOAD2 "0x" . substr($ID, 33, 2). ", ";
print LOAD2 "0x" . substr($ID, 35, 2);

Result from the hexid2.txt file.

0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80, 0xAD, 0xC9, 0x35, 0x10

Result from the \@hexid array.

ARRAY(0x8b92214)

Any advise would be appreaciated. Thanks.

Kenny-














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

Date: Wed, 21 Jun 2000 11:49:49 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Simple Reg Expression Question
Message-Id: <3950E41D.FA7F603A@attglobal.net>

Kenny Lim wrote:
> 
> 
> (Q) How do we store the hex id generated into an array instead of
> a filehandle. When I attempt to print the new hexadecimal id
> into an array, I get the following result - ARRAY(0x8b92214)
> instead of the converted hexadecimal value when printing it out.

> open (LOAD2, "> hexid2.txt") or die "Could not open hexid.txt: $!";
> <---how to store the converted format into an array

If you don't want to write to a file, you shouldn't use open().
open() creates a filehandle based on a file or a FIFO.  

If you want to add these elements to an array, check out the push()
function.  

$ perldoc -f push

You may also want to read perlfaq4 at:

http://www.perl.com/pub/doc/manual/html/pod/perlfaq4.html

Lots of good data manipulation stuff in there.


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

Date: Wed, 21 Jun 2000 16:50:05 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Simple Reg Expression Question
Message-Id: <sl1sht86e7f63@corp.supernews.com>

In article <sd545.23413$FC6.535682@newsread1.prod.itd.earthlink.net>,
    Kenny Lim <kennylim@techie.com> wrote:

: I am trying to convert a given ID to hexa-decimal format
: and would like to know  if there is a simpler method opposed to
: what I currently have.
:
: [...]
:
: Id : DA86E130-470E-11D4-9F14-0080ADC93510
: 
: Hexadecimal : 0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80, 0xAD,
: 0xC9, 0x35, 0x10

    #! /usr/bin/perl -w

    use strict;

    my $str = "DA86E130-470E-11D4-9F14-0080ADC93510";
    $str =~ tr/-//d;

    my @hex = map +(sprintf "%02X", ord($_)), split //, pack "H*", $str;

    my @a;
    push @a, "0x" . join '', splice @hex, 0, 4;
    push @a, "0x" . join '', splice @hex, 0, 2 for 1 .. 2;
    push @a, "0x" . shift @hex while @hex;

    print "$_\n" for @a;

Greg
-- 
Beware of the above code; I have only proved it correct, not tried it.
    -- Knuth


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

Date: Wed, 21 Jun 2000 18:59:57 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Simple Reg Expression Question
Message-Id: <91t1ls8nn662qm8qtf70dg1sm3n8agim0m@4ax.com>

On Wed, 21 Jun 2000 15:31:36 GMT, "Kenny Lim" <kennylim@techie.com>
wrote:

> Hi All,
> 
> I am trying to convert a given ID to hexa-decimal format
> and would like to know  if there is a simpler method opposed to
> what I currently have.
> 
> also..
> 
> (Q) How do we store the hex id generated into an array instead of
> a filehandle. When I attempt to print the new hexadecimal id
> into an array, I get the following result - ARRAY(0x8b92214)
> instead of the converted hexadecimal value when printing it out.

#!/usr/bin/perl -w
use strict;

my $ID = ' DA86E130-470E-11D4-9F14-0080ADC93510';

my @hexid = map "0x$_" =>
	(unpack 'aa8aa4aa4aa2a2aa2a2a2a2a2a2', $ID)[1,3,5,7,8,10..15];
	
my $hex = join ', ', @hexid;

print "ID: $ID\n";	
print "Hexadecimal: $hex\n";

__END__

-- 
Good luck,
Abe


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

Date: Wed, 21 Jun 2000 17:07:20 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Simple Reg Expression Question
Message-Id: <sl1ti891e7f29@corp.supernews.com>

In article <sl1sht86e7f63@corp.supernews.com>,
    Greg Bacon <gbacon@hiwaay.net> wrote:

:     #! /usr/bin/perl -w
: 
:     use strict;
: 
:     my $str = "DA86E130-470E-11D4-9F14-0080ADC93510";
:     $str =~ tr/-//d;
: 
:     my @hex = map +(sprintf "%02X", ord($_)), split //, pack "H*", $str;
: 
:     my @a;
:     push @a, "0x" . join '', splice @hex, 0, 4;
:     push @a, "0x" . join '', splice @hex, 0, 2 for 1 .. 2;
:     push @a, "0x" . shift @hex while @hex;
: 
:     print "$_\n" for @a;

Even easier (duh)

    #! /usr/bin/perl -w

    use strict;

    my $str = "DA86E130-470E-11D4-9F14-0080ADC93510";
    $str =~ tr/-//d;

    my @a = map "0x$_",
            $str =~ /^(........)(....)(....)(..)(..)(..)(..)(..)(..)(..)(..)$/;

    print "$_\n" for @a;

Can the tail be arbitrarily long?

    #! /usr/bin/perl -w

    use strict;

    my $str = "DA86E130-470E-11D4-9F14-0080ADC93510";
    $str =~ tr/-//d;

    my @a;
    if ($str =~ /^(........)(....)(....)/gc) {
        push @a, map "0x$_", $1, $2, $3;

        push @a, "0x$1" while $str =~ /(..)/g;
    }

    print "$_\n" for @a;

Greg
-- 
Bluto: My advice to you is to start drinking heavily.
Otter: Better listen to him, Flounder. He's pre-med.


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

Date: Wed, 21 Jun 2000 17:25:15 GMT
From: robb4444@my-deja.com
Subject: Re: Simple Reg Expression Question
Message-Id: <8iqtp5$fu1$1@nnrp1.deja.com>

This is what you want:

   print @hexid;

You were printing an array reference. '\@' signifies to an array
reference when used in a function parameter.

You might want to get some Perl books at the bookstore to get past the
basics. People at the newsgroup resist volunteering help.

Robb

In article <sd545.23413$FC6.535682@newsread1.prod.itd.earthlink.net>,
  "Kenny Lim" <kennylim@techie.com> wrote:
> Hi All,
>
> I am trying to convert a given ID to hexa-decimal format
> and would like to know  if there is a simpler method opposed to
> what I currently have.
>
> also..
>
> (Q) How do we store the hex id generated into an array instead of
> a filehandle. When I attempt to print the new hexadecimal id
> into an array, I get the following result - ARRAY(0x8b92214)
> instead of the converted hexadecimal value when printing it out.
>
> Id : DA86E130-470E-11D4-9F14-0080ADC93510
>
> Hexadecimal : 0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80,
0xAD,
> 0xC9, 0x35, 0x10
>
> #===============
> #snippets of my code.
> #===============
>
> my $ID;
> $ID = `ETGuidGen`; <--This will generate a new unique id each them is
> executed.
> print   "$ID\n";
>
> open (LOAD2, "> hexid2.txt") or die "Could not open hexid.txt: $!";
> <---how to store the converted format into an array
>
> and be printed out. I tried (open LOAD2, "> \@hexid")
>
> but it did not work. (See below for the result)
>
> print LOAD2 "0x" . substr($ID, 1, 8) . ", ";
> print LOAD2 "0x" . substr($ID, 10, 4). ", ";
> print LOAD2 "0x" . substr($ID, 15, 4). ", ";
> print LOAD2 "0x" . substr($ID, 20, 2). ", ";
> print LOAD2 "0x" . substr($ID, 22, 2). ", ";
> print LOAD2 "0x" . substr($ID, 25, 2). ", ";
> print LOAD2 "0x" . substr($ID, 27, 2). ", ";
> print LOAD2 "0x" . substr($ID, 29, 2). ", ";
> print LOAD2 "0x" . substr($ID, 31, 2). ", ";
> print LOAD2 "0x" . substr($ID, 33, 2). ", ";
> print LOAD2 "0x" . substr($ID, 35, 2);
>
> Result from the hexid2.txt file.
>
> 0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80, 0xAD, 0xC9, 0x35,
0x10
>
> Result from the \@hexid array.
>
> ARRAY(0x8b92214)
>
> Any advise would be appreaciated. Thanks.
>
> Kenny-
>
>


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


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

Date: Wed, 21 Jun 2000 17:25:14 GMT
From: robb4444@my-deja.com
Subject: Re: Simple Reg Expression Question
Message-Id: <8iqtp4$ftv$1@nnrp1.deja.com>

This is what you want:

   print @hexid;

You were printing an array reference. '\@' signifies to an array
reference when used in a function parameter.

You might want to get some Perl books at the bookstore to get past the
basics. People at the newsgroup resist volunteering help.

Robb

In article <sd545.23413$FC6.535682@newsread1.prod.itd.earthlink.net>,
  "Kenny Lim" <kennylim@techie.com> wrote:
> Hi All,
>
> I am trying to convert a given ID to hexa-decimal format
> and would like to know  if there is a simpler method opposed to
> what I currently have.
>
> also..
>
> (Q) How do we store the hex id generated into an array instead of
> a filehandle. When I attempt to print the new hexadecimal id
> into an array, I get the following result - ARRAY(0x8b92214)
> instead of the converted hexadecimal value when printing it out.
>
> Id : DA86E130-470E-11D4-9F14-0080ADC93510
>
> Hexadecimal : 0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80,
0xAD,
> 0xC9, 0x35, 0x10
>
> #===============
> #snippets of my code.
> #===============
>
> my $ID;
> $ID = `ETGuidGen`; <--This will generate a new unique id each them is
> executed.
> print   "$ID\n";
>
> open (LOAD2, "> hexid2.txt") or die "Could not open hexid.txt: $!";
> <---how to store the converted format into an array
>
> and be printed out. I tried (open LOAD2, "> \@hexid")
>
> but it did not work. (See below for the result)
>
> print LOAD2 "0x" . substr($ID, 1, 8) . ", ";
> print LOAD2 "0x" . substr($ID, 10, 4). ", ";
> print LOAD2 "0x" . substr($ID, 15, 4). ", ";
> print LOAD2 "0x" . substr($ID, 20, 2). ", ";
> print LOAD2 "0x" . substr($ID, 22, 2). ", ";
> print LOAD2 "0x" . substr($ID, 25, 2). ", ";
> print LOAD2 "0x" . substr($ID, 27, 2). ", ";
> print LOAD2 "0x" . substr($ID, 29, 2). ", ";
> print LOAD2 "0x" . substr($ID, 31, 2). ", ";
> print LOAD2 "0x" . substr($ID, 33, 2). ", ";
> print LOAD2 "0x" . substr($ID, 35, 2);
>
> Result from the hexid2.txt file.
>
> 0xDA86E130, 0x470E, 0x11D4, 0x9F, 0x14, 0x00, 0x80, 0xAD, 0xC9, 0x35,
0x10
>
> Result from the \@hexid array.
>
> ARRAY(0x8b92214)
>
> Any advise would be appreaciated. Thanks.
>
> Kenny-
>
>


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


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

Date: Wed, 21 Jun 2000 16:36:02 +0100
From: "David Fleet" <dfleet@avaterra.com>
Subject: Re: SMS help
Message-Id: <3950df54_2@nnrp1.news.uk.psi.net>

Thankyou for your quick reply.

Do I need any specific hardware apart from a server, or is it just port and
socket programming?


"Jim" <j@iforgot.net> wrote in message
news:3950d20a$0$17334@news.denver1.Level3.net...
> Yes, it is possible to send SMS jobs through Perl.  Learn more about SMS
and
> the solution will present itself.  I can't send you the source I developed
> as it belongs to my employer.
>
> "David Fleet" <dfleet@avaterra.com> wrote in message
> news:3950ce63_1@nnrp1.news.uk.psi.net...
> > Anyone know if it's possible to send SMS by Perl?
>
>
>




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

Date: Wed, 21 Jun 2000 17:30:55 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: SMS help
Message-Id: <Pine.GHP.4.21.0006211726350.6396-100000@hpplus03.cern.ch>

On Wed, 21 Jun 2000, David Fleet wrote:

> Anyone know if it's possible to send SMS by Perl?

Perl is a complete programming language.  It can program anything
that's feasible.

SMS's don't get into the GSM network by telepathy or osmosis, they
need some kind of gateway.  Are you trying to implement a gateway, or
find one? If you're only looking to find one, then you've not come to
the best place.

(I send mine by modem dial-up, but there are also email gateways 
etc.).



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

Date: Wed, 21 Jun 2000 08:21:44 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: sourcing bash script w/ Perl?
Message-Id: <Pine.GSO.4.10.10006210820580.4312-100000@user2.teleport.com>

On 21 Jun 2000, Brandon Metcalf wrote:

>  > Yes; that does the work in a subprocess; it doesn't change the values in
>  > your Perl process.
> 
> No, that doesn't work in the subprocess.  There is no such command as
> source.  It's a csh builtin and perl doesn't use csh when system() is
> called.

You're right, of course. I should have said, "that sort of thing does the
work in a subprocess". Cheers!

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



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

Date: Wed, 21 Jun 2000 17:49:43 +0200
From: Wolfgang Hielscher <W.Hielscher@mssys.com>
Subject: Re: Static Vars and ordering of subroutines
Message-Id: <3950E417.72FB75D9@mssys.com>

Hi!

By replacing 
   my $static_x = 3;
with
   my $static_x = (print( "init\n" ),3);
in both your examples, you should see what goes "wrong".

Obviously, defining and initializing variables are two different steps
in Perl. In your example, you could have written:
   my $static_x;
   $static_x = 3;
So the initialization is done, when the block itself is executed.

Done some C-programming lately?! ;-)


HTH

Cheers
	Wolfgang


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

Date: Wed, 21 Jun 2000 14:59:00 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Switch, Case in Perl
Message-Id: <8iql77$8m7$1@nnrp1.deja.com>

In article <8iqj9g$74m$1@nnrp1.deja.com>,
  phil_alex@my-deja.com wrote:

> I'm a newbie in perl, and in looking for a control structure like
> switch case in C.
>

you can find the answer to your question in perlfaq7.  if you don't have
the faq readily available, you can find them on:

http://www.cpan.org


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


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

Date: Wed, 21 Jun 2000 15:13:06 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Switch, Case in Perl
Message-Id: <6Y445.516$My4.49613@news.dircon.co.uk>

On Wed, 21 Jun 2000 14:26:14 GMT, phil_alex@my-deja.com Wrote:
> Hi,
> 
> First, I'm sorry for my poor English.
> 
> I'm a newbie in perl, and in looking for a control structure like
> switch case in C.
> 

Its described in perlfaq7 :

       How do I create a switch or case statement?


/J\


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

Date: Wed, 21 Jun 2000 10:52:48 -0500
From: Daniel Weber <d-weber@itg.uiuc.edu>
Subject: Sys::Syslog & _PATH_LOG
Message-Id: <3950E4D0.A731EF7@itg.uiuc.edu>

I posted this originally in c.l.p.modules, but it hasn't turned up any
responses. Probably should have cross-posted to begin with.

Anyway, has anyone else noted this behavior on AIX or IRIX? Anyone have a
solution?

-------- Original Message --------
Subject: Sys::Syslog & _PATH_LOG
Date: Mon, 19 Jun 2000 17:06:40 -0500
From: Daniel Weber <d-weber@itg.uiuc.edu>
Reply-To: d-weber@uiuc.edu
Organization: University of Illinois at Urbana-Champaign
Newsgroups: comp.lang.perl.modules

I'm running perl-5.6.0 on both AIX 4.3.3 and IRIX 6.5.7 and attempting to test
the Net::Daemon module which requires the Sys::Syslog module. On both operating
systems, I get the error:

> t/config............Your vendor has not defined the Sys::Syslog macro _PATH_LOG
> at /usr/local/encap/perl-5.6.0/lib/perl-5.6.0/IP22-irix-thread-multi/Sys/Syslog.
> pm line 277.

(adjusting the path for AIX obviously).

277 is the line:
>         my $syslog = &_PATH_LOG  || croak "_PATH_LOG not found in syslog.ph";

As far as I can tell, syslog.ph isn't included with a require by this version of
Syslog.pm as in earlier versions of perl, so that croak message probably isn't
correct.

Though to be sure I ran h2ph on the entire /usr/include hierarchy but still got
the same error. On IRIX, _PATH_LOG is defined in paths.ph, but under AIX, it
doesn't appear in *any* .ph file. A grep of all .h files on AIX confirmed this.

I tried modifying line 277 of Syslog.pm to read "my $syslog = _PATH_LOG()" as
suggested in previous posts as archived on deja.com, but I still get the same
error.

Changing line 277 to be hardcoded "$syslog = '/dev/log'" seems to work on AIX,
but not on IRIX, even though in paths.ph on IRIX _PATH_LOG is simply /dev/log.
That is to say it passes the tests under AIX but generates more errors on IRIX.

Does anyone have a solution or a patch to apply to Syslog.pm to fix the problem?

Thank you, and if more information is required, I will post.
-daniel


-- 

]:o_ | Daniel E. Weber (d-weber@uiuc.edu) - ITG Information Technologies | _o:{
 |O =| 4311 Beckman Institute, 405 N Mathews, Urbana, IL, 61801 MC-251   |= O|
 |_o=| 217-244-3191 (off) * 217-244-6219 (fax) * 217-244-3074 (lab)      |=o_|
  \  |                              *moo*                                |  /


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

Date: 21 Jun 2000 13:15:59 -0300
From: Hakon Alstadheim <hakon.alstadheim@oslo.mail.telia.com>
Subject: Re: system and exec 'holds' perl output
Message-Id: <m07lbjdn7k.fsf@alstadhome.cyberglobe.net>

I wrote:
> Ok, here is how you might reaon about this problem:
[lots of ho-hum]
> close(STDIN);close(STDERR);close(STDOUT);
[more ho-hum]
> b) If it does not, look up the functions 'fork' and exec. If you need
> this, you most certainly will have to use it in conjunction with a).
This was written too early in the morning. I should have known
better. I've been dreading Tom Phoenix' wrath all day. (By the way,
when I'm awake I'm totally behind most of what Tom Poenix says).

My (previously posted) solutions will most certainly get the output
through the web-server, but I 'forgot' the reason _why_ you don't see
any output until your app finishes:

When -t STDOUT returns false (see perldoc -f -X) STDOUT will be
buffered. A more elegant way would be to flush STDOUT (see perldoc
IO::Handle), or make STDOUT unbuffered (same doc). That way you could
send what you have in the output-buffer before running the lengthy
command, but still get output from that command directed to the same
stream (``i.e. sent to the browser'').





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

Date: Wed, 21 Jun 2000 09:27:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Testing whether filehandle is open
Message-Id: <Pine.GSO.4.10.10006210917540.4312-100000@user2.teleport.com>

On 21 Jun 2000, Andre Majorel wrote:

> Is there a way to determine whether a given filehandle is open
> before trying to print into it ?

I'd think you'd want to know whether it's open for output; it could be
open, but only for reading, and that would cause a warning.

>   sub message
>   {
>     print "@_" if ($verbose);
>     print LOG @_;
>   }
> 
>   message "blah blah\n";  # 1
>   open LOG, ">>/var/log/myprog";

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file. If
you do so, your problem may be solved.

>   message "more blah\n";
>   close LOG, ">>/var/log

Okay...

>   message "even more blah\n";  # 2
> 
> without getting "print on closed filehandle main::LOG" at lines
> #1 and #2.

So, when the handle isn't open, you're willing to throw away your
output? 

You could use the fcntl() function with F_GETFD to look for O_WRONLY or
O_RDWR, if you really want to know whether the FH is writable. Or you
could simply look to see whether fileno() returns a defined value. Cheers!

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



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

Date: 21 Jun 2000 16:00:15 GMT
From: nobody@contract.Sun.COM (Nobody)
Subject: Re: Unix database for Perl
Message-Id: <8iqoqf$ie0$1@eastnews1.east.sun.com>

In article <8iiior$p6p$1@orpheus.gellyfish.com>,
Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>On Fri, 16 Jun 2000 11:34:08 -0700 Steve Leibel wrote:
>> In article <x6p25.4103$bc4.281608@news1.primary.net>, "Bob Tate"
>> <btate@primary.net> wrote:
>> 
>>> Anyone know a good database for a Unix system that Perl will talk to.
>> 
>> Most people will suggest Mysql, the most popular free database.  However
>> Mysql does not have transactions and does not implement all of the
>> language, such as subqueries. 
>
>Nor triggers, contraints and stored procedures (unless you have the
>wherewithall to write a C shared library).  I have seriously taken against
>MySQL after it fixed a corrupted index by altering the data to match the
>index - thus deleting all the data - D'oh !
>
>>                               I prefer Postgres, a free open-source
>> database that has full SQL features.  You can download Postgres at
>> http://www.postgresql.org/.
>> 
>
>I have PostgresSQL, MySQL and Informix SE on this machine and benchmarking
>suggests that the latter is by far the most efficient but of course it is
>not free on most platforms.
>

If you don't need the advanced features, MySQL is a decent solution.
Otherwise, if you are just doing development (or having fun with
it) for yourself and aren't doing anything commercial, download Oracle 
from their website.  They support Linux, Solaris, etc...
Definitely a powerful database to play with.

Anita



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

Date: Wed, 21 Jun 2000 11:38:40 -0500
From: Shawn Ribordy <pndswimming@hotmail.com>
Subject: Win32::Internet and flags
Message-Id: <3950EF8F.EA91B03D@hotmail.com>

I wrote a COM object using PerlCtrl that employs Win32::Internet.
I have been using the object in MS Excel(darkside) to download files
from our mainframe.

Generally, everything works great!
However, the downloaded file are cached, which means that when the file
changes on the mainframe and I download the updated file -- I get the
cached copy.
The only way that I do not get the cached copy is if I shut down MSExcel
and reopen it.

Win32::Internet is an interface to the WININET.dll which allows for
certain flags.

My question is this -- How do I get the flag
INTERNET_FLAG_NO_CACHE_WRITE to work so that the downloaded file is not
written to my cache.

The code that I have been using is below, but it doesn't seem to do the
trick!

use Win32::Internet;

%newHash = (
  "useragent" => "Perl-Win32::Internet/version",
  "opentype"  => "INTERNET_OPEN_TYPE_DIRECT",
  "proxy"     => "",
  "proxybypass" => "",
  "flags" => "INTERNET_FLAG_NO_CACHE_WRITE",
  );

$inet = new Win32::Internet(\%newHash);

Shawn__.pl



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

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


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