[29210] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 454 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 23 11:10:34 2007

Date: Wed, 23 May 2007 08:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 23 May 2007     Volume: 11 Number: 454

Today's topics:
        Generate Server Skeleton from WSDL Rich.Hephner@gmail.com
    Re: listing all available methods <baxter.brad@gmail.com>
    Re: listing all available methods <baxter.brad@gmail.com>
    Re: localtime(time()) <baxter.brad@gmail.com>
    Re: localtime(time()) <uri@stemsystems.com>
    Re: localtime(time()) <baxter.brad@gmail.com>
        Matching a french accent character <keepyourstupidspam@yahoo.co.uk>
    Re: Matching a french accent character <nobull67@gmail.com>
    Re: Matching a french accent character <nobull67@gmail.com>
    Re: Matching a french accent character <nobull67@gmail.com>
    Re: math::gmp install problem <jrpfinch@gmail.com>
    Re: Passing variables into another script <tadmc@augustmail.com>
    Re: Perl and German Umlauts <ben.usenet@bsb.me.uk>
        Question about pack function in 64bit 2 core CPU <sonet.all@msa.hinet.net>
    Re: Question about pack function in 64bit 2 core CPU <sisyphus1@nomail.afraid.org>
    Re: Question about pack function in 64bit 2 core CPU <sonet.all@msa.hinet.net>
    Re: Question about pack function in 64bit 2 core CPU <sonet.all@msa.hinet.net>
    Re: Question about pack function in 64bit 2 core CPU <hjp-usenet2@hjp.at>
    Re: Question about pack function in 64bit 2 core CPU QoS@domain.invalid
    Re: What's the point of these lines of code? <glennj@ncf.ca>
    Re: What's the point of these lines of code? <cdalten@gmail.com>
    Re: What's the point of these lines of code? <cdalten@gmail.com>
    Re: What's the point of these lines of code? <cdalten@gmail.com>
    Re: What's the point of these lines of code? <cdalten@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 23 May 2007 07:14:39 -0700
From: Rich.Hephner@gmail.com
Subject: Generate Server Skeleton from WSDL
Message-Id: <1179929679.597428.225420@w5g2000hsg.googlegroups.com>

Hello,

I have a complex WSDL created for a Java Web Service that needs to be
ported to Perl. Is there some kind of utility for Perl, that will
create a server skeleton based on an existing wsdl?

I'm aware of stubmaker, but it appears to only make client stubs, not
server.

Thanks.



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

Date: 23 May 2007 07:23:03 -0700
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: listing all available methods
Message-Id: <1179930183.095990.296840@h2g2000hsg.googlegroups.com>

On May 23, 3:34 am, "Skye Shaw!@#$" <skye.s...@gmail.com> wrote:
>
> ~ > perl -MCarp -le'for(keys %{Carp::}) { print $_ if defined &{"Carp::
> $_"} and $_ !~ /^_/ }'

Small nit:

perl -MCarp -le'for(keys %{Carp::}) { print if defined &{"Carp::$_"}
and ! /^_/ }'

I think $_ is prettier when you can't see it.  :-)

FWIW: my shell had trouble with !/^_/, therefore the space in ! /^_/

--
Brad



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

Date: 23 May 2007 07:26:25 -0700
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: listing all available methods
Message-Id: <1179930385.801029.131660@k79g2000hse.googlegroups.com>

On May 23, 3:34 am, "Skye Shaw!@#$" <skye.s...@gmail.com> wrote:
>
> ~ > perl -MCarp -le'for(keys %{Carp::}) { print $_ if defined &{"Carp::
> $_"} and $_ !~ /^_/ }'

Small nit:

perl -MCarp -le'for(keys %{Carp::}) { print if defined &{"Carp::$_"}
and ! /^_/ }'

I think $_ is prettier when you can't see it.  :-)

FWIW: my shell had trouble with !/^_/, therefore the space in ! /^_/

--
Brad



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

Date: 23 May 2007 07:10:00 -0700
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: localtime(time())
Message-Id: <1179929400.574424.308600@q69g2000hsb.googlegroups.com>

On May 22, 4:06 pm, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> Martin Trautmann schreef:
>
> > my $date =($year+1900)."-".
> > sprintf("%02d", $mon) ."-".
> > sprintf("%02d", $mday);
> >     print $date;'
>
>   my $date = sprintf( q[%s-%02d-%02d],
>                       $y + 1900,
>                       $m + 1,
>                       $d,
>              );
>   print $date;
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."

I've used a variant of the following for years.

#!/usr/local/bin/perl -l
use warnings;
use strict;

sub now {
    for( $_[0] ) {
       defined and /(.*?)yyyy(.*?)mm(.*?)dd(.*)/i and
           return sprintf( "$1%04d$2%02d$3%02d$4",
               sub { ( $_[5] + 1900, $_[4] + 1, $_[3] )
               }->( localtime ) );
    }
    scalar localtime;
}

print now;
print now 'yyyy-mm-dd';
print now 'YYYY/MM/DD';
print now 'Year: yyyy, Month: mm, Day: dd'

__END__
Wed May 23 10:06:26 2007
2007-05-23
2007/05/23
Year: 2007, Month: 05, Day: 23

--
Brad



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

Date: Wed, 23 May 2007 14:29:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: localtime(time())
Message-Id: <x74pm38vgo.fsf@mail.sysarch.com>

>>>>> "BB" == Brad Baxter <baxter.brad@gmail.com> writes:

  BB> I've used a variant of the following for years.

  BB> sub now {
  BB>     for( $_[0] ) {
  BB>        defined and /(.*?)yyyy(.*?)mm(.*?)dd(.*)/i and
  BB>            return sprintf( "$1%04d$2%02d$3%02d$4",
  BB>                sub { ( $_[5] + 1900, $_[4] + 1, $_[3] )
  BB>                }->( localtime ) );
  BB>     }
  BB>     scalar localtime;
  BB> }

bletcherific!!

what if you want a different format? days of week? use POSIX::strftime
and you get all you do there and much more.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 23 May 2007 08:01:12 -0700
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: localtime(time())
Message-Id: <1179932472.222177.28780@o5g2000hsb.googlegroups.com>

On May 23, 10:29 am, Uri Guttman <u...@stemsystems.com> wrote:
> >>>>> "BB" == Brad Baxter <baxter.b...@gmail.com> writes:
>
>   BB> I've used a variant of the following for years.
>
>   BB> sub now {
>   BB>     for( $_[0] ) {
>   BB>        defined and /(.*?)yyyy(.*?)mm(.*?)dd(.*)/i and
>   BB>            return sprintf( "$1%04d$2%02d$3%02d$4",
>   BB>                sub { ( $_[5] + 1900, $_[4] + 1, $_[3] )
>   BB>                }->( localtime ) );
>   BB>     }
>   BB>     scalar localtime;
>   BB> }
>
> bletcherific!!
>
> what if you want a different format? days of week? use POSIX::strftime
> and you get all you do there and much more.

:-)  That's true; I didn't say it was pretty.  Of course, the
ugliness is hidden behind a "use Now;", where all the other formats
I want are defined.  I personally find a format like 'yyyy' prettier
than '%Y', but that's just me.

I do actually concur with your advice, but of course, TMTOWTDI.

Cheers,

--
Brad




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

Date: 23 May 2007 04:36:42 -0700
From: endaman <keepyourstupidspam@yahoo.co.uk>
Subject: Matching a french accent character
Message-Id: <1179920202.894317.299690@k79g2000hse.googlegroups.com>

Hi,

I want to match this string


   # Societ=E9 Generale Long Dated


how can I match this whole string including the french accent
character?


Thanks,
Enda



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

Date: 23 May 2007 04:52:37 -0700
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: Matching a french accent character
Message-Id: <1179921157.511224.83210@w5g2000hsg.googlegroups.com>

On May 23, 12:36 pm, endaman <keepyourstupids...@yahoo.co.uk> wrote:
> Hi,
>
> I want to match this string
>
>    # Societ=E9 Generale Long Dated
>
> how can I match this whole string including the french accent
> character?

Er, I assume from the fact that you ask that just doing it didn't
work.

Please post a _minimal_ but _complete_ script in which you've tried
and it's failed. Since this is character set related make sure you
tell us what character encoding you used to save the script (utf8,
Latin1, Windows-1250 etc...)

There's no reason why just doing it should not work (in a script saved
in Latin1 encoding or in utf8 with 'use utf8') .

    if (/# Societ=E9 Generale Long Dated/) { do_stuff() }

If you want to avoid having to think about the encoding of the script.

    if (/# Societ\x{e9} Generale Long Dated/) { do_stuff() }




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

Date: 23 May 2007 05:09:15 -0700
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: Matching a french accent character
Message-Id: <1179922155.642276.265070@h2g2000hsg.googlegroups.com>

On May 23, 12:36 pm, endaman <keepyourstupids...@yahoo.co.uk> wrote:
> Hi,
>
> I want to match this string
>
>    # Societ=E9 Generale Long Dated
>
> how can I match this whole string including the french accent
> character?

Er, I assume from the fact that you ask that just doing it didn't
work.

Please post a _minimal_ but _complete_ script in which you've tried
and it's failed. Since this is character set related make sure you
tell us what character encoding you used to save the script (utf8,
Latin1, Windows-1250 etc...)

There's no reason why just doing it should not work (in a script saved
in Latin1 encoding or in utf8 with 'use utf8') .

    if (/# Societ=E9 Generale Long Dated/) { do_stuff() }

If you want to avoid having to think about the encoding of the script.

    if (/# Societ\x{e9} Generale Long Dated/) { do_stuff() }




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

Date: 23 May 2007 05:09:42 -0700
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: Matching a french accent character
Message-Id: <1179922182.390352.312960@u30g2000hsc.googlegroups.com>

On May 23, 12:36 pm, endaman <keepyourstupids...@yahoo.co.uk> wrote:
> Hi,
>
> I want to match this string
>
>    # Societ=E9 Generale Long Dated
>
> how can I match this whole string including the french accent
> character?

Er, I assume from the fact that you ask that just doing it didn't
work.

Please post a _minimal_ but _complete_ script in which you've tried
and it's failed. Since this is character set related make sure you
tell us what character encoding you used to save the script (utf8,
Latin1, Windows-1250 etc...)

There's no reason why just doing it should not work (in a script saved
in Latin1 encoding or in utf8 with 'use utf8') .

    if (/# Societ=E9 Generale Long Dated/) { do_stuff() }

If you want to avoid having to think about the encoding of the script.

    if (/# Societ\x{e9} Generale Long Dated/) { do_stuff() }




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

Date: 23 May 2007 03:43:40 -0700
From: jrpfinch <jrpfinch@gmail.com>
Subject: Re: math::gmp install problem
Message-Id: <1179917020.204325.179890@q75g2000hsh.googlegroups.com>

By a bit of trial and error and reading exhaustively through the docs
the problem was solved by setting the environment variable
LD_LIBRARY_PATH to equal the empty string and then executing the
following:

 ./configure CC='/opt/SUNWspro/bin/cc -xarch=v8plus' ABI=32

I had to get it to compile in 32 bit mode as this was how perl was
compiled.  ABI=32 was not enough - for some reason had to force it
into 32-bit by adding the xarch flag.

Cheers

Jon




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

Date: Wed, 23 May 2007 05:49:08 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Passing variables into another script
Message-Id: <slrnf58714.fth.tadmc@tadmc30.august.net>

Ken Soon <csoon@xilinx.com> wrote:

> Hmm, $data{'user'}{'joe'} = "System admin' is something like a 2D hash or 
> something? 


   perldoc -q structure
   perldoc perlreftut
   perldoc perlref
   perldoc perllol
   perldoc perldsc


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 23 May 2007 12:43:34 +0100
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
Subject: Re: Perl and German Umlauts
Message-Id: <87myzvg3yx.fsf@bsb.me.uk>

Dennis Winter <idontlikespam@denniswinter.de> writes:

> Ben Bacarisse schrieb:
>>> binmode STDOUT, ':encoding(cp850)';
>>> binmode STDIN, ':encoding(cp850)';
>>
>> That looks wrong.  You say the files are UTF-8 encoded so why not give
>> ':utf8' as the layer, at least for input?
>
> I did that at the top of the script. That helped me with nearly every
> appearance of Umlauts.
>
> When I try to set binmode STDIN, STDOUT temporarily to utf-8 right
> before the text file is read, the code
>
> ************* ORIGINAL ************
> binmode STDIN, ':encoding(utf-8)';
> binmode STDOUT, ':encoding(utf-8)';
> open (RJ, $wdir.$readjob) || die "ERROR: could not read $wdir$readjob:
> $!\n";
> while (<RJ>) {
>    my $dir = $_;
> *********** ORIGINAL END **********

You seem to be reading from RJ.  What has the IO encoding for STDIN
got to do with it?

> produces
>
> ************* ORIGINAL ************
> "\x{0084}" does not map to cp850 at actiontaker.pl line 227, <RJ> line 1.
> !E:\Freigaben\FILESERVER\allshares\austausch\anke\Vertriebs und
> Marketingans\x{0084}tze Everyone:(OI)(CI)F!
> *********** ORIGINAL END **********

See above.

> It appears to me that binmode can only be set once. Is there a way to
> temporarily change the binmode for the time during the file is read?
> Or even to determine which charset is used in the file an switch to
> that "on the fly and back"?

That would probably be wrong.  You can't tell be looking what encoding
is used.  You need to know how the file is encoded and open it using
the right IO layer.

The form:

   open(my $fh, "<:utf8", $fname);

is usually preferred.  Read "perldoc perlopentut".

-- 
Ben.


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

Date: Wed, 23 May 2007 18:13:39 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: Question about pack function in 64bit 2 core CPU
Message-Id: <f3144i$mjq$1@netnews.hinet.net>

The pack('N',$A) is 4 bytes in 32bit CPU.
But, the result is still 4 bytes in 64bit 2 core CPU?
Have any difference between 64bits and 32bits CPU in ActivePerl?




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

Date: Wed, 23 May 2007 20:29:54 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Question about pack function in 64bit 2 core CPU
Message-Id: <46541780$0$2869$afc38c87@news.optusnet.com.au>


"sonet" <sonet.all@msa.hinet.net> wrote in message 
news:f3144i$mjq$1@netnews.hinet.net...
> The pack('N',$A) is 4 bytes in 32bit CPU.
> But, the result is still 4 bytes in 64bit 2 core CPU?
> Have any difference between 64bits and 32bits CPU in ActivePerl?

'N' is for unsigned longs - and an unsigned long is 4 bytes on both 32-bit 
and 64-bit builds.

Perhaps you want pack('Q', $A) ?

Cheers,
Rob 



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

Date: Wed, 23 May 2007 18:37:44 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: Re: Question about pack function in 64bit 2 core CPU
Message-Id: <f315hm$f1r$1@netnews.hinet.net>

Thanks!


    Q   An unsigned quad value.
          (Quads are available only if your system supports 64-bit
           integer values _and_ if Perl has been compiled to support those.
           Causes a fatal error otherwise.)

The parameter Q is just for 64bit cpu.
I have so many code is developer on 32bits cpu.
I just want to know what do i need rewrite the code?



"Sisyphus" <sisyphus1@nomail.afraid.org> 
???????:46541780$0$2869$afc38c87@news.optusnet.com.au...
>
> "sonet" <sonet.all@msa.hinet.net> wrote in message 
> news:f3144i$mjq$1@netnews.hinet.net...
>> The pack('N',$A) is 4 bytes in 32bit CPU.
>> But, the result is still 4 bytes in 64bit 2 core CPU?
>> Have any difference between 64bits and 32bits CPU in ActivePerl?
>
> 'N' is for unsigned longs - and an unsigned long is 4 bytes on both 32-bit 
> and 64-bit builds.
>
> Perhaps you want pack('Q', $A) ?
>
> Cheers,
> Rob 




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

Date: Wed, 23 May 2007 18:39:45 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: Re: Question about pack function in 64bit 2 core CPU
Message-Id: <f315lg$gli$1@netnews.hinet.net>

Thanks!


    Q   An unsigned quad value.
          (Quads are available only if your system supports 64-bit
           integer values _and_ if Perl has been compiled to support those.
           Causes a fatal error otherwise.)

The parameter Q is just for 64bit cpu.
I have so many code is developer on 32bits cpu.
I just want to know have any code  i need to rewrite!


"Sisyphus" <sisyphus1@nomail.afraid.org> 
???????:46541780$0$2869$afc38c87@news.optusnet.com.au...
>
> "sonet" <sonet.all@msa.hinet.net> wrote in message 
> news:f3144i$mjq$1@netnews.hinet.net...
>> The pack('N',$A) is 4 bytes in 32bit CPU.
>> But, the result is still 4 bytes in 64bit 2 core CPU?
>> Have any difference between 64bits and 32bits CPU in ActivePerl?
>
> 'N' is for unsigned longs - and an unsigned long is 4 bytes on both 32-bit 
> and 64-bit builds.
>
> Perhaps you want pack('Q', $A) ?
>
> Cheers,
> Rob 




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

Date: Wed, 23 May 2007 15:44:13 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Question about pack function in 64bit 2 core CPU
Message-Id: <slrnf58h9d.rq0.hjp-usenet2@zeno.hjp.at>

On 2007-05-23 10:29, Sisyphus <sisyphus1@nomail.afraid.org> wrote:
> "sonet" <sonet.all@msa.hinet.net> wrote in message 
> news:f3144i$mjq$1@netnews.hinet.net...
>> The pack('N',$A) is 4 bytes in 32bit CPU.
>> But, the result is still 4 bytes in 64bit 2 core CPU?
>> Have any difference between 64bits and 32bits CPU in ActivePerl?
>
> 'N' is for unsigned longs - and an unsigned long is 4 bytes on both 32-bit 
> and 64-bit builds.

This is true only for pack, which defines 'L', 'N', and 'V' to be always
exactly 32 bit, regardless of the size of an 'unsigned long' defined by
the native C compiler (you get the latter with 'L!').

In C an 'unsigned long' is at least 32 bits. On 64-bit systems it is
often (but not always) 64 bits long.

It is better to avoid using the terms 'long' and 'short' for 'N', 'V',
'L', 'l', 'n', 'v', 'S' and 's', to avoid confusion with the C types of
the same name. Call them 32-bit resp. 16 bit values in network, vax, or
native byte order instead.

	hp

-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Sam in "Freefall"


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

Date: Wed, 23 May 2007 14:40:06 GMT
From: QoS@domain.invalid
Subject: Re: Question about pack function in 64bit 2 core CPU
Message-Id: <anY4i.24968$xu.19987@trndny07>


"sonet" <sonet.all@msa.hinet.net> wrote in message-id:  <f315lg$gli$1@netnews.hinet.net>

>
>Thanks!
>
>
>    Q   An unsigned quad value.
>          (Quads are available only if your system supports 64-bit
>           integer values _and_ if Perl has been compiled to support those.
>           Causes a fatal error otherwise.)
>
>The parameter Q is just for 64bit cpu.
>I have so many code is developer on 32bits cpu.
>I just want to know have any code  i need to rewrite!
>
>

Anything that uses CRC may need to be inspected again.



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

Date: 23 May 2007 14:35:15 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: What's the point of these lines of code?
Message-Id: <slrnf58k93.gfv.glennj@smeagol.ncf.ca>

At 2007-05-23 04:57AM, "Ian Wilson" wrote:
>  2) `my $version = q{ $Revision: 1.27 $ };`
>  allows the program to know and report its version, where the version 
>  number is maintained by checking changes to the file into the Revision 
>  Control System (RCS). RCS looks for and edits strings like "... 
>  $Revision: n.nn $ ..." which are usually placed in comments but can be 
>  placed in code statements if care is taken with the metacharacters.
>  
>  3) `$version =~ s/^[^0-9]+([0-9.]+).*$/$1/;`
>  strips out the word "Revision:" and the major part of the version 
>  number. RCS never increments the major number unless the developer 
>  explicitly sets it.

It does nothing with the major version number.  That RE leaves $version
with "1.27".  

It might be otherwise written as:
    ($version) = $version =~ /([\d.]+)/;
or
    $version = (split ' ', $version)[1];

-- 
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry


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

Date: 23 May 2007 07:50:40 -0700
From: grocery_stocker <cdalten@gmail.com>
Subject: Re: What's the point of these lines of code?
Message-Id: <1179931840.853319.100860@q69g2000hsb.googlegroups.com>

On May 23, 1:57 am, Ian Wilson <scoblo...@infotop.co.uk> wrote:
> grocery_stocker wrote:
> > On May 22, 6:13 pm, grocery_stocker <cdal...@gmail.com> wrote:
>
> >>This person has like 20 perl scripts related to Audio/Video streaming
> >>his stuff on the web. Just about every script has this near the top of
> >>it
>
> >>my $progname = $0; $progname =~ s@.*/@@g;
> >>my $version = q{ $Revision: 1.27 $ }; $version =~ s/^[^0-9]+([0-9.]+).*
> >>$/$1/;
>
> >>I thought he might be parsing some kind of RCS file to get the current
> >>version, but then that would  explain
>
> >>my $version = q{ $Revision: 1.27 $ };
>
> >>Can someone clarify this for me please.
>
> > Never mind. I found my answers via Google.
>
> Maybe you'd like to post the answers here so that anyone else with a
> similar problem who finds this thread isn't frustrated by the omission
> of the answers they seek.
>
> My guesses:
>
> 1) `my $progname = $0; $progname =~ s@.*/@@g;`
> removes the path from the program name
>
> 2) `my $version = q{ $Revision: 1.27 $ };`
> allows the program to know and report its version, where the version
> number is maintained by checking changes to the file into the Revision
> Control System (RCS). RCS looks for and edits strings like "...
> $Revision: n.nn $ ..." which are usually placed in comments but can be
> placed in code statements if care is taken with the metacharacters.
>
> 3) `$version =~ s/^[^0-9]+([0-9.]+).*$/$1/;`
> strips out the word "Revision:" and the major part of the version
> number. RCS never increments the major number unless the developer
> explicitly sets it.


Here is what I found, via google last night.

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/ad45f86af6222b2b/fad11945490cdf13?lnk=gst&q=getting+version+number&rnum=10#fad11945490cdf13



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

Date: 23 May 2007 07:51:08 -0700
From: grocery_stocker <cdalten@gmail.com>
Subject: Re: What's the point of these lines of code?
Message-Id: <1179931868.397363.110000@p47g2000hsd.googlegroups.com>

On May 23, 1:57 am, Ian Wilson <scoblo...@infotop.co.uk> wrote:
> grocery_stocker wrote:
> > On May 22, 6:13 pm, grocery_stocker <cdal...@gmail.com> wrote:
>
> >>This person has like 20 perl scripts related to Audio/Video streaming
> >>his stuff on the web. Just about every script has this near the top of
> >>it
>
> >>my $progname = $0; $progname =~ s@.*/@@g;
> >>my $version = q{ $Revision: 1.27 $ }; $version =~ s/^[^0-9]+([0-9.]+).*
> >>$/$1/;
>
> >>I thought he might be parsing some kind of RCS file to get the current
> >>version, but then that would  explain
>
> >>my $version = q{ $Revision: 1.27 $ };
>
> >>Can someone clarify this for me please.
>
> > Never mind. I found my answers via Google.
>
> Maybe you'd like to post the answers here so that anyone else with a
> similar problem who finds this thread isn't frustrated by the omission
> of the answers they seek.
>
> My guesses:
>
> 1) `my $progname = $0; $progname =~ s@.*/@@g;`
> removes the path from the program name
>
> 2) `my $version = q{ $Revision: 1.27 $ };`
> allows the program to know and report its version, where the version
> number is maintained by checking changes to the file into the Revision
> Control System (RCS). RCS looks for and edits strings like "...
> $Revision: n.nn $ ..." which are usually placed in comments but can be
> placed in code statements if care is taken with the metacharacters.
>
> 3) `$version =~ s/^[^0-9]+([0-9.]+).*$/$1/;`
> strips out the word "Revision:" and the major part of the version
> number. RCS never increments the major number unless the developer
> explicitly sets it.


Here is what I found, via google last night.

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/ad45f86af6222b2b/fad11945490cdf13?lnk=gst&q=getting+version+number&rnum=10#fad11945490cdf13



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

Date: 23 May 2007 07:57:28 -0700
From: grocery_stocker <cdalten@gmail.com>
Subject: Re: What's the point of these lines of code?
Message-Id: <1179932248.521243.14500@o5g2000hsb.googlegroups.com>

On May 23, 1:57 am, Ian Wilson <scoblo...@infotop.co.uk> wrote:
> grocery_stocker wrote:
> > On May 22, 6:13 pm, grocery_stocker <cdal...@gmail.com> wrote:
>
> >>This person has like 20 perl scripts related to Audio/Video streaming
> >>his stuff on the web. Just about every script has this near the top of
> >>it
>
> >>my $progname = $0; $progname =~ s@.*/@@g;
> >>my $version = q{ $Revision: 1.27 $ }; $version =~ s/^[^0-9]+([0-9.]+).*
> >>$/$1/;
>
> >>I thought he might be parsing some kind of RCS file to get the current
> >>version, but then that would  explain
>
> >>my $version = q{ $Revision: 1.27 $ };
>
> >>Can someone clarify this for me please.
>
> > Never mind. I found my answers via Google.
>
> Maybe you'd like to post the answers here so that anyone else with a
> similar problem who finds this thread isn't frustrated by the omission
> of the answers they seek.
>
> My guesses:
>
> 1) `my $progname = $0; $progname =~ s@.*/@@g;`
> removes the path from the program name
>
> 2) `my $version = q{ $Revision: 1.27 $ };`
> allows the program to know and report its version, where the version
> number is maintained by checking changes to the file into the Revision
> Control System (RCS). RCS looks for and edits strings like "...
> $Revision: n.nn $ ..." which are usually placed in comments but can be
> placed in code statements if care is taken with the metacharacters.
>
> 3) `$version =~ s/^[^0-9]+([0-9.]+).*$/$1/;`
> strips out the word "Revision:" and the major part of the version
> number. RCS never increments the major number unless the developer
> explicitly sets it.


Here is what I found, via google last night.

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/ad45f86af6222b2b/fad11945490cdf13?lnk=gst&q=getting+version+number&rnum=10#fad11945490cdf13



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

Date: 23 May 2007 08:02:53 -0700
From: grocery_stocker <cdalten@gmail.com>
Subject: Re: What's the point of these lines of code?
Message-Id: <1179932573.881778.84200@m36g2000hse.googlegroups.com>

On May 23, 7:50 am, grocery_stocker <cdal...@gmail.com> wrote:
> On May 23, 1:57 am, Ian Wilson <scoblo...@infotop.co.uk> wrote:
>
>
>
> > grocery_stocker wrote:
> > > On May 22, 6:13 pm, grocery_stocker <cdal...@gmail.com> wrote:
>
> > >>This person has like 20 perl scripts related to Audio/Video streaming
> > >>his stuff on the web. Just about every script has this near the top of
> > >>it
>
> > >>my $progname = $0; $progname =~ s@.*/@@g;
> > >>my $version = q{ $Revision: 1.27 $ }; $version =~ s/^[^0-9]+([0-9.]+).*
> > >>$/$1/;
>
> > >>I thought he might be parsing some kind of RCS file to get the current
> > >>version, but then that would  explain
>
> > >>my $version = q{ $Revision: 1.27 $ };
>
> > >>Can someone clarify this for me please.
>
> > > Never mind. I found my answers via Google.
>
> > Maybe you'd like to post the answers here so that anyone else with a
> > similar problem who finds this thread isn't frustrated by the omission
> > of the answers they seek.
>
> > My guesses:
>
> > 1) `my $progname = $0; $progname =~ s@.*/@@g;`
> > removes the path from the program name
>
> > 2) `my $version = q{ $Revision: 1.27 $ };`
> > allows the program to know and report its version, where the version
> > number is maintained by checking changes to the file into the Revision
> > Control System (RCS). RCS looks for and edits strings like "...
> > $Revision: n.nn $ ..." which are usually placed in comments but can be
> > placed in code statements if care is taken with the metacharacters.
>
> > 3) `$version =~ s/^[^0-9]+([0-9.]+).*$/$1/;`
> > strips out the word "Revision:" and the major part of the version
> > number. RCS never increments the major number unless the developer
> > explicitly sets it.
>
> Here is what I found, via google last night.
>
> http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thre...


Ughh.... I kept getting internal error when I tried to reply. After I
hit the "Discard" option, I saw my response posted 4 times.



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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 454
**************************************


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