[18639] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 807 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 1 00:06:26 2001

Date: Mon, 30 Apr 2001 21:05:07 -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: <988689907-v10-i807@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 30 Apr 2001     Volume: 10 Number: 807

Today's topics:
        ANNOUNCE: Attribute::Handlers 0.51 (Damian Conway)
    Re: AUTOLOAD Clarification (Garry Williams)
    Re: Chicago Perl Consultants Needed <jdblack@black.metronet.com>
        editing perl on windows: Komodo v Arachnophilia v Ultra <"relaxedrob@optushome.com.au">
        GD::Graph <styrrell@mtest.teradyne.com>
    Re: GD::Graph (Martien Verbruggen)
    Re: Html link in mysql data <carlfox@netdoor.com>
    Re: Html link in mysql data <carlfox@netdoor.com>
    Re: Html link in mysql data <carlfox@netdoor.com>
    Re: Perl script to execute program on NT (Gil G.)
    Re: port problem <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: re-sizing GIF images on the fly (Iain Chalmers)
    Re: RegEx Question <ren@tivoli.com>
        simple problem (ugh) <gasper@cis.ohio-state.edu>
    Re: simple problem (ugh) <thelma@alpha2.csd.uwm.edu>
    Re: simple problem (ugh) <bwalton@rochester.rr.com>
    Re: simple problem (ugh) (Garry Williams)
    Re: simple problem (ugh) <gasper@cis.ohio-state.edu>
        spoke too soon..  <"relaxedrob@optushome.com.au">
    Re: Strange string -> num conversion <ren@tivoli.com>
    Re: string manipulation <dodger@necrosoft.net>
    Re: System Call within Daemon - TAKE 2 (Garry Williams)
    Re: System Call within Daemon - TAKE 2 (Garry Williams)
    Re: System Call within Daemon - TAKE 2 <uri@sysarch.com>
        Windows Komodo users get input on debug? <"relaxedrob@optushome.com.au">
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 30 Apr 2001 20:35:42 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Attribute::Handlers 0.51
Message-Id: <tesbr0oce0dv09@corp.supernews.com>
Keywords: perl, module, release

==============================================================================
                Release of version 0.51 of Attribute::Handlers
==============================================================================

The version released yesterday would not install,
due to a bug in the MANIFEST :-(

==============================================================================


NAME
    Attribute::Handlers - Simpler definition of attribute handlers

VERSION
    This document describes version 0.50 of Attribute::Handlers, released
    November 1, 2000.


DESCRIPTION
    This module, when inherited by a package, allows that package's class to
    define attribute handler subroutines for specific attributes. Variables
    and subroutines subsequently defined in that package, or in packages
    derived from that package may be given attributes with the same names as
    the attribute handler subroutines, which will then be called at the end
    of the compilation phase (i.e. in a `CHECK' block).

EXAMPLE

	package UNIVERSAL;
	use Attribute::Handlers;

	my %name;
	sub name { return $name{$_[2]}||*{$_[1]}{NAME} }

	sub Name    :ATTR { $name{$_[2]} = $_[4] }

	sub Purpose :ATTR { print STDERR "Purpose of ", &name, " is $_[4]\n" }

	sub Unit    :ATTR { print STDERR &name, " measured in $_[4]\n" }


	package main;

	my $capacity : Name(capacity)
		     : Purpose(to store max storage capacity for files)
		     : Unit(Gb);

	package Other;

	sub foo : Purpose(to foo all data before barring it) { }


AUTHOR
    Damian Conway (damian@conway.org)

COPYRIGHT
             Copyright (c) 2001, Damian Conway. All Rights Reserved.
           This module is free software. It may be used, redistributed
          and/or modified under the terms of the Perl Artistic License
                (see http://www.perl.com/perl/misc/Artistic.html)


==============================================================================

CHANGES IN VERSION 0.51

	- Fixed fatal file path error in MANIFEST (thanks Marcel and Jost)


==============================================================================

AVAILABILITY

Attribute::Handlers has been uploaded to the CPAN
and is also available from:

	http://www.csse.monash.edu.au/~damian/CPAN/Attribute-Handlers.tar.gz

==============================================================================




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

Date: Tue, 01 May 2001 03:20:52 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: AUTOLOAD Clarification
Message-Id: <slrn9esask.cgu.garry@zfw.zvolve.net>

On Mon, 30 Apr 2001 10:15:55 -0700, Jason Hurst <jasonh@colubs.com> wrote:
> I'm having problems understanding the autoload method.  I understand the
> principle as to how it works: when a method isn't defined, it goes to the
> autoload method instead.  My confusion is when you're extending a module
> that has an autoload function and your new module ALSO has an autoload
> function.  Can I access the SUPER::AUTOLOAD if the function doesn't exist in
> my new module.  So, for example, lets say you have something like this:

  # Delegate to parent's AUTOLOAD
  our $AUTOLOAD
  sub AUTOLOAD {
      my $self = shift;
      my $name = $AUTOLOAD;
      my $parent;

      return if $name =~ /::DESTROY$/;
      $name =~ s/.*:://;

      # Determine that you do not have this method

      $parent = "SUPER::$name";
      $self->$parent(@_);
  }

-- 
Garry Williams


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

Date: Mon, 30 Apr 2001 21:14:34 -0500
From: "W.W.J.D. Black" <jdblack@black.metronet.com>
Subject: Re: Chicago Perl Consultants Needed
Message-Id: <300420012114343152%jdblack@black.metronet.com>


Hash: SHA1

In article <9cjqj9$rs9@spamz.news.aol.com>, Jason C. Hill
<jhill@technoslave.net> wrote:

}Don't make me skin you alive for making these lame posts about potatoes!!!
}

Didn't Dan Q. get in trouble for spelling taters like that?

jdb


Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOu4cBmy/lre8y0dpEQJ6BQCeN5YtNXST7qaciDnYmKAzBL+s+8UAoLDT
M39cnWB5KYFrE/EZJJ5Hkfwy
=YBEW
-----END PGP SIGNATURE-----


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

Date: Tue, 01 May 2001 02:13:48 GMT
From: "Rob" <"relaxedrob@optushome.com.au">
Subject: editing perl on windows: Komodo v Arachnophilia v UltraEdit
Message-Id: <wZoH6.1070$76.4179@news1.rdc1.nsw.optushome.com.au>

Howdy all!

So far I have tested Komodo and Arachnophilia for my purposes (perl script
editing) and compare them to UltraEdit.

Weight:
    Komodo: pretty heavy, is slow on a PIII 500MHz with 128 MB ram, crashed
on a right click in debug view
    Kawa: heavy, seems to load a bit faster than Komodo
    UltraEdit: fast
    Arachnophilia: fast

Editing for Perl:
    Komodo: color coding (code completion ?)
    Kawa: color coding, no code completion
    UltraEdit: color coding, no code completion
    Arachnophilia: no color coding, no code completion, has a 'beautify'
option

Output Window
    Komodo: Can run scripts in debug mode to view output
    Kawa: Can run scripts and view output - does not seem to understand
standard input for perl
    UltraEdit: Opens a DOS box, lets the script run through and captures
output at completion as a new document
    Arachnophilia: none

So far I am testing Komodo further.. I really liked Kawa for java and it was
going well with perl scripts too (running them internall) until I tried to
run a script requiring input.

UltraEdit remains the steadfast standby for me - for quick editing and
find/replace operations I always use UltreEdit - it is very fast and has a
good user interface. Sometimes for super-simple operations I even open up
NotePad..

Anyway.. just my thoughts so far..

Rob




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

Date: Mon, 30 Apr 2001 18:34:33 -0700
From: Sarah Tyrrell <styrrell@mtest.teradyne.com>
Subject: GD::Graph
Message-Id: <3AEE12A9.8D485A2F@mtest.teradyne.com>

I'm using the GD library to plot graphs.  I've run into some difficulty
with the fonts.  I try to set the fonts so that they are larger and
no matter what size I set them to, they are always the same size.  At
this
point they are too small and make for some difficult reading.  It almost
seems that there are some flags that need to be set, however, I saw
nothing
regarding this in the man pages.

Can someone give me some clue to how I can make the fonts larger,
especially,
for the x and y labels?

Thanks,

Kevin Sezen and Sarah Tyrrell

Please respond to sezenk@mtest.teradyne.com or
styrrell@mtest.teradyne.com.


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

Date: Tue, 01 May 2001 02:22:30 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GD::Graph
Message-Id: <slrn9es7e9.bf0.mgjv@verbruggen.comdyn.com.au>

On Mon, 30 Apr 2001 18:34:33 -0700,
	Sarah Tyrrell <styrrell@mtest.teradyne.com> wrote:
> Can someone give me some clue to how I can make the fonts larger,
> especially,
> for the x and y labels?

The builtin GD fonts cannot be scaled. They have only one size, and
there are four of them.

You can use TrueType fonts, which are handled in GD::Graph as a
GD::Text::Align object. The ways to do this are documented in the
GD::Graph documentation, and the GD::Text::Align documentation.

See the various set_.*_font methods in the GD::Graph documentation,
and the section with the title FONTS. This latter section refers to
the GD::Text documentation, which will inform you how to set default
search paths for font files, and stuff like that. The FONTS section
contains some example lines of code.

> Please respond to sezenk@mtest.teradyne.com or
> styrrell@mtest.teradyne.com.

Sorry. I only reply by post.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 30 Apr 2001 21:51:28 -0700
From: carlfox <carlfox@netdoor.com>
Subject: Re: Html link in mysql data
Message-Id: <3AEE40D0.AF793810@netdoor.com>

Hi Tad,

Thanks for the reply.  I'll try to be more specific and explicit for you and the
other kind souls who have responded.


Carl Fox



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

Date: Mon, 30 Apr 2001 22:00:19 -0700
From: carlfox <carlfox@netdoor.com>
Subject: Re: Html link in mysql data
Message-Id: <3AEE42E3.26D5291@netdoor.com>

Hi Simon,

Thank you for your kind reply.  And it was kind.  I appreciate it.  I'll rub on
some corn huskers lotion to thicken my skin  next time I post a question.

I apologize for not being more specific, earlier.

I am using a browser to invoke a perl query of a mysql server.  Command line
Perl works, at least it doesn't crash.

I think I am beginning to understand that  the problem is in my perl code not
reporting the html tag  as a link versus reporting it as text.  I'll investigate
your pointer to the remedy, and will then get you the code snippet.   Have to go
out of town tomorrow for about a week, and will pick back up when I rerturn.

Thanks, again!

Carl


***********************************

Simon Flack wrote:

> > My perl question is:
> >
> > How does one get an html tag,  returned in a mysql query report, to show
> up
> > as a link in a table, using a perl script?  I placed an html tag into the
> > mysql database and in the resultant table printed out by the perl script,
> it
> > ignored the html tag form and just printed out the html tag as text.  I
> want
> > it printed out as an html  link so one can just click on the link.
>
> Hi Carl,
>
> What happens if you view source of the resulting HTML? I am not interested
> in the flames that have gone on already, but it would help to see a small
> snippet of the html source and the code you are using to pull the info out
> of the DB and display it on the page. Don't show the whole script, just the
> relevant bits.
>
> My guess is that somewhere between putting info into the db\pulling it out
> again\displaying it on the page, you have encoded the HTML entities so a '<'
> becomes &lt; etc.That would be my first thought, but we can't really help
> without more info.
>
> Good luck and don't be put off posting again. It's a learning experience.
>
> Simon



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

Date: Mon, 30 Apr 2001 22:02:16 -0700
From: carlfox <carlfox@netdoor.com>
Subject: Re: Html link in mysql data
Message-Id: <3AEE4358.E13C305D@netdoor.com>

Hi Simon,

Thank you for your kind reply.  And it was kind.  I appreciate it.  I'll rub on
some corn huskers lotion to thicken my skin  next time I post a question.

I apologize for not being more specific, earlier.

I am using a browser to invoke a perl query of a mysql server.  Command line
Perl works, at least it doesn't crash.

I think I am beginning to understand that  the problem is in my perl code not
reporting the html tag  as a link versus reporting it as text.  I'll investigate
your pointer to the remedy, and will then get you the code snippet.   Have to go
out of town tomorrow for about a week, and will pick back up when I rerturn.

Thanks, again!

Carl


***********************************

Simon Flack wrote:

> > My perl question is:
> >
> > How does one get an html tag,  returned in a mysql query report, to show
> up
> > as a link in a table, using a perl script?  I placed an html tag into the
> > mysql database and in the resultant table printed out by the perl script,
> it
> > ignored the html tag form and just printed out the html tag as text.  I
> want
> > it printed out as an html  link so one can just click on the link.
>
> Hi Carl,
>
> What happens if you view source of the resulting HTML? I am not interested
> in the flames that have gone on already, but it would help to see a small
> snippet of the html source and the code you are using to pull the info out
> of the DB and display it on the page. Don't show the whole script, just the
> relevant bits.
>
> My guess is that somewhere between putting info into the db\pulling it out
> again\displaying it on the page, you have encoded the HTML entities so a '<'
> becomes &lt; etc.That would be my first thought, but we can't really help
> without more info.
>
> Good luck and don't be put off posting again. It's a learning experience.
>
> Simon



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

Date: Tue, 01 May 2001 01:48:01 GMT
From: gil@nospam-keskydee.com (Gil G.)
Subject: Re: Perl script to execute program on NT
Message-Id: <3aee1595.1119535@news-server>

On Mon, 30 Apr 2001 13:51:29 +0200, "Ib Hansen" <ibh@2t.dk> wrote:

>Hi,
>
>As a newbie i am trying to execute a program using Perl.
>
>I need to have an object i can  click on i a HTML document, so that i can
>execute a program
>
>I wrote the following script, but it does not work can anybody help
>
>$| = 1;
>
>$Q = new CGI;
>
>print $Q->header(),
> $Q->start_html(),
> "<h1>Output from script</h1>\n",
> "<p>EXPECT1:", `expect.exe reset.exp 1`,
> $Q->end_html();
>
>Thanks in advance
>
>Ib
>
>
>
Hi, 

You could simply use system('program.exe');

Gil.
---------------------------
http://keskydee.com/scripts.php


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

Date: 01 May 2001 01:07:53 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: port problem
Message-Id: <867l01op06.fsf@jon_ericson.jpl.nasa.gov>

"Kien Y. Yee" <kienyeny@uci.edu> writes:

> I'm a real newbie in perl programming, and I'm real stuck with this
> assignment that I'm doing now. Wonder if anybody could help.

Some people might read the above paragraph thusly: "I'm too lazy to do
the work myself, so I'll ask c.l.p.m and hope some sucker will write
my homework for me."

> Problem 1:
> I have to create a fake web server on a xxx.com:8080/~userID/file.pl to make
> a connection to the 8080 port. I don't seem to get the connection done.

Have you tried anything yet?  http://www.stonehenge.com has an example
of a mini http server in perl.  Be sure to credit Randal L. Schwartz
if you use his ideas -- otherwise you might run afoul of academic
honesty guidelines.

Jon


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

Date: Tue, 01 May 2001 12:28:40 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: re-sizing GIF images on the fly
Message-Id: <bigiain-0105011228400001@bigman.mighty.com.au>

In article <Zl2w4IAJFb76EwYp@letsgouk.com>, Graham Stow
<graham@letsgouk.com> wrote:

>>> Now what's dumb about that?
>>
>>Because you're requiring the browser to download the full-size image and
>>then rescale it down (something, BTW, the browsers tend to do an
>>esthetically *ugly* job of). 

<snip>
>
>Whoops. Sorry. Not thinking straight.
>
>This seems to leave only one option - have my ISP install ImageMagick
>(assuming they'll play ball) then use the Image::Magic module to
>properly re-size the GIF and store the resultant thumbnail (as opposed
>to "dumbnail") on the server.
>
>Could somebody confirm?

Well, there _are_ other ways. You _could_ install Image::Magic on _your_
machine, and run a cron job to rsync your images directory from your isp,
create thumbnails for any new images, then rsync the new thumbnails back
to your isp...

This is getting a _long_ way from being a perl question though...

big


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

Date: 30 Apr 2001 19:16:36 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: RegEx Question
Message-Id: <m3ae4xordn.fsf@dhcp9-172.support.tivoli.com>

On Tue, 01 May 2001, nospam@newsranger.com wrote:

> Here is a portion of the data I am using:
> 
> SEVERE WEATHER STATEMENT
> NATIONAL WEATHER SERVICE ST LOUIS MO
> 617 PM CDT MON APR 30 2001
> 
> How can I use a regular expression to get all the text after
> SERVICE?

It's good that you gave the data -- people often leave that part out.
And, you've stated what you are trying to achieve, though it could
have been a little more clear.  As stated, it's not completely clear
whether the results should be " ST LOUIS MO" or:

 ST LOUIS MO
617 PM CDT MON APR 30 2001

or something else (perhaps excluding the space before "ST").

But the piece of information that is most notably missing is some
description of what you've already tried, or even an example of the
code you've tried.

I realize that you've asked for a regular expression to do this, so I
will point you to the perlre(1) man page (which at the very least you
should be able to find by typing "perldoc perlre" at a command
prompt).

However, I'd also suggest going about this a different way.  Use the
index and substr functions to find the position of the string you
want.  It may not be as flashy as a regex, but it's probably a better
solution for things like this.  Something like:

$result = substr($data, index($data, "SERVICE")+7);

Note that 7 is the length of "SERVICE".  If you want to exclude the
space as well, make that an 8.  Of course, in real code that should be
a variable and its length.

I hope that at least gets you started.  If you still have trouble, be
sure and post what you've tried.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Mon, 30 Apr 2001 22:54:51 -0400
From: "Keith G" <gasper@cis.ohio-state.edu>
Subject: simple problem (ugh)
Message-Id: <9cl8ds$7o3$1@news.cis.ohio-state.edu>

Anyone see what the problem is with this? No
matter what the value of $answer (be it "y", "n"
or "d"), the script prints out YND. Doesn't a
pair of ='s compare a pair of scalars? Help!

 .....
# begin code snip
$answer=param("poll");

if ($answer == "y") {print "Y";}
if ($answer == "n") {print "N";}
if ($answer == "d") {print "D";}

# end code snip
 ...




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

Date: 1 May 2001 03:00:12 GMT
From: Thelma Lubkin <thelma@alpha2.csd.uwm.edu>
Subject: Re: simple problem (ugh)
Message-Id: <9cl8rs$5hk$1@uwm.edu>

Keith G <gasper@cis.ohio-state.edu> wrote:
: Anyone see what the problem is with this? No
: matter what the value of $answer (be it "y", "n"
: or "d"), the script prints out YND. Doesn't a
: pair of ='s compare a pair of scalars? Help!

: .....
: # begin code snip
: $answer=param("poll");

: if ($answer == "y") {print "Y";}
: if ($answer == "n") {print "N";}
: if ($answer == "d") {print "D";}

: # end code snip
: ...


        if( $answer eq .. )
        use == for numeric data.
             --thelma


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

Date: Tue, 01 May 2001 03:08:42 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: simple problem (ugh)
Message-Id: <3AEE2900.A0FE0FF1@rochester.rr.com>

Keith G wrote:
> 
> Anyone see what the problem is with this? No
> matter what the value of $answer (be it "y", "n"
> or "d"), the script prints out YND. Doesn't a
> pair of ='s compare a pair of scalars? Help!
> 
> .....
> # begin code snip
> $answer=param("poll");
> 
> if ($answer == "y") {print "Y";}
> if ($answer == "n") {print "N";}
> if ($answer == "d") {print "D";}
> 
> # end code snip
> ...

Keith, == does a numeric compare (converts strings to numbers, then
compares numerically).  So in your case, the strings are all being
converted to zero, and then compare as equal.

You want to use the "eq" operator to do a string compare, as in:

  if ($answer eq "y") {print "Y";}

for example.  HTH.
-- 
Bob Walton


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

Date: Tue, 01 May 2001 03:31:15 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: simple problem (ugh)
Message-Id: <slrn9esbg3.chs.garry@zfw.zvolve.net>

On Mon, 30 Apr 2001 22:54:51 -0400, Keith G <gasper@cis.ohio-state.edu> wrote:
> Anyone see what the problem is with this? No
> matter what the value of $answer (be it "y", "n"
> or "d"), the script prints out YND. Doesn't a
> pair of ='s compare a pair of scalars? Help!
> 
> .....
> # begin code snip
> $answer=param("poll");
> 
> if ($answer == "y") {print "Y";}
> if ($answer == "n") {print "N";}
> if ($answer == "d") {print "D";}

Others have answered your question, but you could have answered your
own question, if you enabled warnings.  

-- 
Garry Williams


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

Date: Mon, 30 Apr 2001 23:34:34 -0400
From: "Keith G" <gasper@cis.ohio-state.edu>
Subject: Re: simple problem (ugh)
Message-Id: <9claob$94h$1@news.cis.ohio-state.edu>

thanks everyone - this fixes my headache!
keith

"Bob Walton" <bwalton@rochester.rr.com> wrote in message news:3AEE2900.A0FE0FF1@rochester.rr.com...
> Keith G wrote:
> >
> > Anyone see what the problem is with this? No
> > matter what the value of $answer (be it "y", "n"
> > or "d"), the script prints out YND. Doesn't a
> > pair of ='s compare a pair of scalars? Help!
> >
> > .....
> > # begin code snip
> > $answer=param("poll");
> >
> > if ($answer == "y") {print "Y";}
> > if ($answer == "n") {print "N";}
> > if ($answer == "d") {print "D";}
> >
> > # end code snip
> > ...
>
> Keith, == does a numeric compare (converts strings to numbers, then
> compares numerically).  So in your case, the strings are all being
> converted to zero, and then compare as equal.
>
> You want to use the "eq" operator to do a string compare, as in:
>
>   if ($answer eq "y") {print "Y";}
>
> for example.  HTH.
> --
> Bob Walton




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

Date: Tue, 01 May 2001 02:57:50 GMT
From: "Rob" <"relaxedrob@optushome.com.au">
Subject: spoke too soon.. 
Message-Id: <OCpH6.1085$76.4291@news1.rdc1.nsw.optushome.com.au>


> Output Window
>     Komodo: Can run scripts in debug mode to view output

But won't allow me to enter input!
:(

Rob




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

Date: 30 Apr 2001 18:49:43 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Strange string -> num conversion
Message-Id: <m3g0eqne20.fsf@dhcp9-172.support.tivoli.com>

On Mon, 30 Apr 2001, eins@durchnull.de wrote:

> so C's atof has the same behaviour as perl's implicit string->num
> conversion.  To those who do _not_ get either 18 or 0 on

Drat... so close.  I forgot to look at atof (and strtod) and instead
looked at atol (and strtol).  strtol has a base argument, and atol
uses base 10.  strtod does not have a base argument, nor does the man
page on my system make any mention of it handling bases in any way:

       The expected form of the string is optional leading  white
       space  as  checked by isspace(3), an optional plus (``+'')
       or minus sign (``-'') followed by  a  sequence  of  digits
       optionally  containing  a decimal-point character, option­
       ally followed by an exponent.  An exponent consists of  an
       ``E''  or  ``e'',  followed  by  an optional plus or minus
       sign, followed by a non-empty sequence of digits.  If  the
       locale  is  not  "C"  or "POSIX", different formats may be
       used.

That "sequence of digits" part bothers me a bit in comparison to the
observed behavior.  I'd be surprised to find that the POSIX standard
left the format of the number so up in the air -- guess I need to look
it up.

Still, the only way I can get the original "2.125" output is by
including a decimal place:

perl -le 'print 1 + "0x1.2"'

or, by dividing by 16:

perl -le 'print 1 + "0x12" / 16'
perl -le 'print 1 + "0x12" / "0x10"'

-- 
Ren Maddox
ren@tivoli.com


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

Date: Tue, 01 May 2001 03:57:04 GMT
From: "Dodger" <dodger@necrosoft.net>
Subject: Re: string manipulation
Message-Id: <kuqH6.41322$B22.10075388@news1.rdc2.pa.home.com>

"Brian Richardson" <lamecow78@hotmail.com> wrote in message
news:9jnH6.75232$Zn4.801667@news1.rdc1.ab.home.com...
> > $path =~ s[/local/cgi-bin/]
> >                  [/html/ie/]g;
> >
>
> my turn to be obnoxious:
>
> $path =~ s!/local/cgi-bin/!
>                   /html/ie/!gx;
>
> unless the above is some syntax i have never seen before. don't the
> delimiters have to be the
> same on both sides? and i'm _sure_ you need the 'x' qualifier to span
> multiple lines like that.

quote-like operators can use obviously paired delimiters rather than
identical ones.
thus qq{Something to $say} is okay, as is tr(a-z) (A-Z)

You don't need the x to span multiple lines when using paired delimiters,
because whitespace BETWEEN the first end and second start delimiter is
ignored, and a return is whitespace. The \n....... doesn't fall inside
either set of delimiters.

So with
s,something,something else,g
you do need an x to add ignored whitespace, and with
s{something} {something else}g
space between the }{ is irrelevant, but you still need an x for this:
s{something
    important
    with
    space chars
   ignored}{something stupid}gx
to ignore the spaces in the pattern match.

--
Dodger
www.dodger.org
www.necrosoft.net
www.gothic-classifieds.com





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

Date: Tue, 01 May 2001 02:38:02 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: System Call within Daemon - TAKE 2
Message-Id: <slrn9es8ca.cgu.garry@zfw.zvolve.net>

On Mon, 30 Apr 2001 16:51:29 -0500, Michael Vera <mxvera@qwest.com>
wrote:

[snip]

> What I need to do is simply fork and exec a system call withOUT the
> child inheriting ownership of the socket.

> The problem is, within my socket server, if I start a system daemon,
                                                ^^^^^^^^^^^^^^^^^^^^^
I wonder what that means?  

> the
> system daemon takes on ownership of my socket. If my socket server
> quits, the system daemon controls the socket, and I can't start the
> socket server due to the fact that the socket is already open.
> 
> Does anyone know how to solve this? Or can you please point me in the
> right direction? What the 'fork'? :)

Well, I suppose what you are asking is "how do I close a file
descriptor across an exec()?"  You need to set FD_CLOEXEC on the file
descriptor in question.  See your system's fcntl(2) manual page, the
Perl Fcntl manual page and the fcntl() section of the perlfunc manual
page.  

  [untested]

  use Fcntl;
  ...
  fcntl($fh, F_GETFD, my $fd_flags)         || die "F_GETFD: $!";
  fcntl($fh, F_SETFD, $fd_flags|FD_CLOEXEC) || die "F_SETFD: $!";
  exec(@cmd);
  die "exec @cmd failed: $!";

-- 
Garry Williams


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

Date: Tue, 01 May 2001 02:46:12 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: System Call within Daemon - TAKE 2
Message-Id: <slrn9es8rk.cgu.garry@zfw.zvolve.net>

On 30 Apr 2001 21:59:06 GMT, Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de> wrote:

> According to Michael Vera  <mxvera@qwest.com>:
>> -=-=-=-=-=-
>> 
>> Ok, my question didn't get answered, so please let me try again.
> 
> It's not a Perl question.  Maybe that's why.

This may be strictly true, but...

>> What I need to do is simply fork and exec a system call withOUT the
>> child inheriting ownership of the socket.
> 
> [...]
> 
> Close the socket in the child.  It's a good habit to close un-needed
> filehandles of any sort after a fork.

I think the OP want's to retain an open file handle in the parent, but
have it closed before his exec'ed program receives control.  This is
an option for any file descriptor across an exec().  I think Perl's
default behavior is to *not* set FD_CLOEXEC on its files.  See my
followup.  

-- 
Garry Williams


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

Date: Tue, 01 May 2001 03:37:07 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: System Call within Daemon - TAKE 2
Message-Id: <x7wv81eo3u.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  AS> According to Michael Vera  <mxvera@qwest.com>:

  >> What I need to do is simply fork and exec a system call withOUT the
  >> child inheriting ownership of the socket.

  AS> Close the socket in the child.  It's a good habit to close un-needed
  AS> filehandles of any sort after a fork.

in general during an exec only stdin/stdout/stderr stay open. there is a
flag on fidle descriptors called close on exec (see fctnl(2)) which is
usually set on new descriptors except those three. so an exec normally
closes all others. the problem probably lies elsewhere.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Tue, 01 May 2001 03:09:53 GMT
From: "Rob" <"relaxedrob@optushome.com.au">
Subject: Windows Komodo users get input on debug?
Message-Id: <5OpH6.1086$76.4343@news1.rdc1.nsw.optushome.com.au>

Hi all!

I am interested to hear from anyone using Komodo on Windows who is able to
send input to their perl scripts through the debugger. This feature does not
seem to work on my machine. I have submitted a bug report but am after
anyone else who has had the same..

Rob




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

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


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