[27977] in Perl-Users-Digest
Perl-Users Digest, Issue: 9341 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 22 09:05:39 2006
Date: Thu, 22 Jun 2006 06:05:04 -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 Thu, 22 Jun 2006 Volume: 10 Number: 9341
Today's topics:
Re: extracting regular expressions (Anno Siegel)
extraction of multiple extensions of a file path name . <martps100@gmail.com>
Re: extraction of multiple extensions of a file path na <rvtol+news@isolution.nl>
Re: List context versus list context xhoster@gmail.com
Native language versions <nisbeti@googlemail.com>
Re: Native language versions <josef.moellers@fujitsu-siemens.com>
Re: Native language versions <corff@zedat.fu-berlin.de>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <rvtol+news@isolution.nl>
Re: Running another program in daemon server <josef.moellers@fujitsu-siemens.com>
Re: Running another program in daemon server <bart@nijlen.com>
Re: Running another program in daemon server xhoster@gmail.com
Re: Special variable "@$" <corff@zedat.fu-berlin.de>
Re: What is Expressiveness in a Computer Language <rossberg@ps.uni-sb.de>
Re: What is Expressiveness in a Computer Language <pc@p-cos.net>
Re: What is Expressiveness in a Computer Language <pjb@informatimago.com>
Re: What is Expressiveness in a Computer Language <pjb@informatimago.com>
working with perfmon in windows <hara.acharya@gmail.com>
working with perfmon <hara.acharya@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Jun 2006 12:32:19 GMT
From: anno4000@radom.zrz.TU-Berlin.DE (Anno Siegel)
Subject: Re: extracting regular expressions
Message-Id: <4fvgujF1kbm3cU1@news.dfncis.de>
In article <1150907933.364748.49710@i40g2000cwc.googlegroups.com>,
"Xicheng Jia" <xicheng@gmail.com> writes:
> Nospam wrote:
>> I am wondering say I had a string, en email address sample@example.com and I
>> wanted to ignore everything from the @ and place in a variable, would
>> something like this suffice:
[...]
>> my $var1= sample@example.com;
>>
>> my $var2 = $var !=~ m/(\@*.$)(.*)/s;
>>
>> however I am not making any progress and looking at perltut I am unable to
>> find a regular expression to do just this
>
> (my $var2 = $var1) = ~s/\@.*//;
>
> this will assign 'sample' to $var2
It will, but I don't see why you would use a substitution to extract a bit
of text when a pattern match will do.
my ( $var2) = $var1 =~ /(.*)@/;
It isn't exactly equivalent in the presence of more than one "@", but
that can be modified. The OP hasn't been specified that case anyway.
As a principle, use the simplest tool that does the job.
Anno
------------------------------
Date: 22 Jun 2006 04:22:23 -0700
From: "martin" <martps100@gmail.com>
Subject: extraction of multiple extensions of a file path name ...
Message-Id: <1150975343.594884.38060@b68g2000cwa.googlegroups.com>
I have a newbie question about extracting extensions of file names;
bascially I have ful path name to some files with no, single, or
multiple extensinos, for example:
/dir1/dir2/.../dirN/filename.ext1.ext2.ext3
The extensions coud be anything, I just used ext1, ext2, so on.
I like to extraxt two things:
1- all the extensions up to the last one , in this case
ext1.ext2 (without .ex3)
Now if some of the interim extensions are numerical, I like to skip
them and get all the extensions exclusing the n umerical ones.
2- How can I extract the full pathname up to but not including last
extension, i.e. to get:
/dir1/dir2/.../dirN/filename.ext1.ext2
Thanks. Martin
------------------------------
Date: Thu, 22 Jun 2006 13:49:08 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: extraction of multiple extensions of a file path name ...
Message-Id: <e7e74v.18g.1@news.isolution.nl>
martin schreef:
> /dir1/dir2/.../dirN/filename.ext1.ext2.ext3
> The extensions coud be anything, I just used ext1, ext2, so on.
> I like to extraxt two things:
> 1- all the extensions up to the last one, in this case
> ext1.ext2 (without .ex3)
> Now if some of the interim extensions are numerical, I like to skip
> them and get all the extensions exclusing the n umerical ones.
> 2- How can I extract the full pathname up to but not including last
> extension, i.e. to get:
> /dir1/dir2/.../dirN/filename.ext1.ext2
Have you read the Posting Guidelines?
http://www.augustmail.com/~tadmc/clpmisc/
Where is your code, and what didn't work?
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 22 Jun 2006 11:43:10 GMT
From: xhoster@gmail.com
Subject: Re: List context versus list context
Message-Id: <20060622074404.400$Y5@newsreader.com>
Ch Lamprecht <christoph.lamprecht.no.spam@web.de> wrote:
> Tad McClellan wrote:
> > Bo Lindbergh <blgl@stacken.kth.se> wrote:
> >
> >>Consider this snippet:
> >>{
> >> sub foo {
> >> print scalar(@_)," arguments\n";
> >> }
> >>
> >> foo((17)[2,1]);
> >> foo(my @foo=(17)[2,1]);
> >>}
> >>
> >>When run by my perl 5.8.8, it produces these two lines of output:
> >>2 arguments
> >>0 arguments
> >
> >
> >
> >>So there seems to be (at least) two kinds of list context,
> >>one used for evaluating function arguments and another one used
> >>for evaluating the rhs of an assignment.
> >
> >
> >
> > It isn't really a context issue. It is a slice issue.
> >
> > Slices are special-cased for list assignment.
> >
> >
> >
> >>I can't find any mention
> >>of this in perldata.pod.
> >
> >
> >
> > @c = (0,1)[2,3]; # @c has no elements
> > ...
> > This makes it easy to write loops that terminate when a null list
> > is returned
> > ...
> >
> >
> I thought the context question was, why in this case
> foo((17)[2,1]);
> the expression (17)[2,1] evaluates to (undef,undef) ??
>
> Maybe it has something to do with aliasing of function arguments...
It is starting to look like a bug.
A slice of an empty list is an empty list in both assignment and sub-arg.
A slice off the end of a nonempty list is an empty list in an assignment,
but not as the arg to a sub.
> perl -e 'use Data::Dumper; sub foo {return @_}; \
print Dumper [foo(()[4..6])]'
$VAR1 = [];
> perl -e 'use Data::Dumper; sub foo {return @_}; \
print Dumper [(()[4..6])]'
$VAR1 = [];
> perl -e 'use Data::Dumper; sub foo {return @_}; \
print Dumper [((1)[4..6])]'
$VAR1 = [];
> perl -e 'use Data::Dumper; sub foo {return @_}; \
print Dumper [foo((1)[4..6])]'
$VAR1 = [
undef,
undef,
undef
];
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 22 Jun 2006 04:03:44 -0700
From: "Ian" <nisbeti@googlemail.com>
Subject: Native language versions
Message-Id: <1150974224.552872.262280@g10g2000cwb.googlegroups.com>
Has anyone tried translating the command set of Perl into other
languages (French, Japanese, Arabic etc.), so that native speakers do
not need to learn any English in order to program, then writing a
suitable compiler?
------------------------------
Date: Thu, 22 Jun 2006 13:13:21 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Native language versions
Message-Id: <e7du6k$o1e$1@nntp.fujitsu-siemens.com>
Ian wrote:
> Has anyone tried translating the command set of Perl into other
> languages (French, Japanese, Arabic etc.), so that native speakers do
> not need to learn any English in order to program, then writing a
> suitable compiler?
>=20
=2E.. and loose the possibility to use CPAN modules?
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 22 Jun 2006 12:13:49 GMT
From: <corff@zedat.fu-berlin.de>
Subject: Re: Native language versions
Message-Id: <4fvfrtF1kic2kU1@uni-berlin.de>
Ian <nisbeti@googlemail.com> wrote:
: Has anyone tried translating the command set of Perl into other
: languages (French, Japanese, Arabic etc.), so that native speakers do
: not need to learn any English in order to program, then writing a
: suitable compiler?
Many years ago I as in Japan for the first time and had access to a
computer. At that time, computers still came with built-in ROM with
BASIC, which I could try after starting the machine. I was astonished
and disappointed to see that print statements still were named print,
and not insatsu (in whichever writing system that would be rendered
doesn't really matter). Naively, I asked myself why the advanced
technology of Japan had not brought forth a computer that would natively
"work in Japanese".
Years and many languages later I understood that such an endeavour is
of little meaning. Any given language consists of more than words, there
is also grammar. While you could replace "print" by "insatsu", you
would also have to transform
print $calar;
into
$calar wo insatsu;
("wo" being grammatical glue).
suddenly you go from PO to OP (predicate-object to object-predicate).
Your complete stack mechanism gets upset, ending up with a language
like Forth or PostScript. Japanese is a bit like RPN for calculators.
Saying
insatsu $calar;
would be completely ungrammatical, hence incomprehensible, in Japanese.
Things get worse if you talk about conditionals.
if ($a eq $b) {do something}
would become
($a,$b to ha onaji).dattara {katsudou}
since the condition in Japanese is expressed as a verb form, not as
a particle.
Worse with Arab which modifies the vowel structure of a consonantal skeleton
in order to arrive at new meanings.
No, this approach is completely impractical and not even of any academic
interest. You cannot learn French while, for the sake of making things
easy, maintain that you replace the French words by English. On y va -
let's go? How will you transform that?
The German-, French-, ... ized versions of MS Excel macro language and
friends show how utterly useless the approach is. You gain ease of talking
while loosing your complete audience. What a trade-off.
Oliver.
--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
------------------------------
Date: Thu, 22 Jun 2006 13:37:24 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <e7e6gi.1fc.1@news.isolution.nl>
tadmc@augustmail.com schreef:
> http://mail.augustmail.com/~tadmc/clpmisc.shtml
ITTSB:
http://www.augustmail.com/~tadmc/clpmisc/
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 22 Jun 2006 12:50:10 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Running another program in daemon server
Message-Id: <e7dsqs$j13$1@nntp.fujitsu-siemens.com>
janicehwang1325@yahoo.com wrote:
> hi,
>=20
> I came across a problem which is when i run the server program without
> the daemon code, calling another program by `perl second.pl` is just
> fine. However, when i put the server to be in daemon, calling to
> another program by using `perl <something>.pl` is not working anymore.
> What is the cause and how to solve?=20
>=20
> Thank you very much.
>=20
Making a daemon occasionally involves changing the working directory=20
(from the Linux manpage of the daemon() function):
"Unless the argument nochdir is non-zero, daemon() changes the current=20
working directory to the root ("/")."
Check where you are.
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 22 Jun 2006 04:01:45 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: Running another program in daemon server
Message-Id: <1150974105.279886.254390@m73g2000cwd.googlegroups.com>
janicehwang1325@yahoo.com wrote:
> I came across a problem which is when i run the server program without
> the daemon code, calling another program by `perl second.pl` is just
> fine. However, when i put the server to be in daemon, calling to
> another program by using `perl <something>.pl` is not working anymore.
> What is the cause and how to solve?
I would say:
`/path/to/perl /path/to/second.pl`;
or just
`/path/to/second.pl`;
But it's better to avoid backticks unless you need the output of the
external program. See
perldoc -f system
--
Bart
------------------------------
Date: 22 Jun 2006 11:51:52 GMT
From: xhoster@gmail.com
Subject: Re: Running another program in daemon server
Message-Id: <20060622075245.797$AC@newsreader.com>
"janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com> wrote:
> hi,
>
> I came across a problem which is when i run the server program without
> the daemon code, calling another program by `perl second.pl` is just
> fine. However, when i put the server to be in daemon, calling to
> another program by using `perl <something>.pl` is not working anymore.
> What is the cause and how to solve?
If $? is nonzero, then the cause, or something resembling it, is in $!.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 22 Jun 2006 10:07:57 GMT
From: <corff@zedat.fu-berlin.de>
Subject: Re: Special variable "@$"
Message-Id: <4fv8ftF1k1mj9U1@uni-berlin.de>
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
: > $fields_1=@_;
Written as it is, $fields_1 holds the number of elements in @_, not more,
not less.
Oliver.
--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
------------------------------
Date: Thu, 22 Jun 2006 13:53:26 +0200
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e7e0bm$8r8i0$2@hades.rz.uni-saarland.de>
Pascal Costanza wrote:
>
> Consider a simple expression like 'a + b': In a dynamically typed
> language, all I need to have in mind is that the program will attempt to
> add two numbers. In a statically typed language, I additionally need to
> know that there must a guarantee that a and b will always hold numbers.
I'm confused. Are you telling that you just write a+b in your programs
without trying to ensure that a and b are in fact numbers??
- Andreas
------------------------------
Date: Thu, 22 Jun 2006 14:15:13 +0200
From: Pascal Costanza <pc@p-cos.net>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <4fvfuiF1kncqtU1@individual.net>
Andreas Rossberg wrote:
> Pascal Costanza wrote:
>>
>> Consider a simple expression like 'a + b': In a dynamically typed
>> language, all I need to have in mind is that the program will attempt
>> to add two numbers. In a statically typed language, I additionally
>> need to know that there must a guarantee that a and b will always hold
>> numbers.
>
> I'm confused. Are you telling that you just write a+b in your programs
> without trying to ensure that a and b are in fact numbers??
Basically, yes.
Note that this is a simplistic example. Consider, instead, sending a
message to an object, or calling a generic function, without ensuring
that there will be applicable methods for all possible cases. When I get
a "message not understood" exception, I can then decide whether that
kind of object shouldn't be a receiver in the first place, or else
whether I should define an appropriate method. I don't want to be forced
to decide this upfront, because either I don't want to be bothered, or
maybe I simply can't because I don't understand the domain well enough
yet, or maybe I want to keep a hook to be able to update the program
appropriately while it is running.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
------------------------------
Date: Thu, 22 Jun 2006 14:15:37 +0200
From: Pascal Bourguignon <pjb@informatimago.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <87irmt9yja.fsf@thalassa.informatimago.com>
Andreas Rossberg <rossberg@ps.uni-sb.de> writes:
> Pascal Costanza wrote:
>> Consider a simple expression like 'a + b': In a dynamically typed
>> language, all I need to have in mind is that the program will
>> attempt to add two numbers. In a statically typed language, I
>> additionally need to know that there must a guarantee that a and b
>> will always hold numbers.
>
> I'm confused. Are you telling that you just write a+b in your programs
> without trying to ensure that a and b are in fact numbers??
Of course.
(shadow '(+ *))
(defun + (&rest args) `(+ ,@args))
(defun * (&rest args) `(* ,@args))
(let ((var 'x) (init 'b) (slop 'a))
(+ init (* slop var)))
--> (+ B (* A X))
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
------------------------------
Date: Thu, 22 Jun 2006 14:33:57 +0200
From: Pascal Bourguignon <pjb@informatimago.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <87ejxh9xoq.fsf@thalassa.informatimago.com>
Pascal Costanza <pc@p-cos.net> writes:
> Andreas Rossberg wrote:
>> Pascal Costanza wrote:
>>>
>>> Consider a simple expression like 'a + b': In a dynamically typed
>>> language, all I need to have in mind is that the program will
>>> attempt to add two numbers. In a statically typed language, I
>>> additionally need to know that there must a guarantee that a and b
>>> will always hold numbers.
>> I'm confused. Are you telling that you just write a+b in your
>> programs without trying to ensure that a and b are in fact numbers??
>
> Basically, yes.
>
> Note that this is a simplistic example. Consider, instead, sending a
> message to an object, or calling a generic function, without ensuring
> that there will be applicable methods for all possible cases. When I
> get a "message not understood" exception, I can then decide whether
> that kind of object shouldn't be a receiver in the first place, or
> else whether I should define an appropriate method. I don't want to be
> forced to decide this upfront, because either I don't want to be
> bothered, or maybe I simply can't because I don't understand the
> domain well enough yet, or maybe I want to keep a hook to be able to
> update the program appropriately while it is running.
Moreover, a good proportion of the program and a good number of
algorithms don't even need to know the type of the objects they
manipulate.
For example, sort doesn't need to know what type the objects it sorts
are. It only needs to be given a function that is able to compare the
objects.
Only a few "primitive" functions need specific types.
So basically, you've got a big black box of applicaition code in the
middle that doesn't care what type of value they get, and you've got a
few input values of a specific type, a few processing functions
needing a specific type and returning a specific type, and a few
output values that are expected to be of a specific type. At anytime,
you may change the type of the input values, and ensure that the
needed processing functions will be able to handle this new input
type, and the output gets mapped to the expected type.
Why should adding a few functions or methods, and providing input
values of a new type be rejected from a statically checked point of
view by a compiled program that would be mostly bit-for-bit the same
with or without this new type?
Of course, in the process of so modifying the program, we may get some
dynamically detected type errors that we would correct as Pascal
indicated.
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Specifications are for the weak and timid!"
------------------------------
Date: 22 Jun 2006 03:54:48 -0700
From: "king" <hara.acharya@gmail.com>
Subject: working with perfmon in windows
Message-Id: <1150973688.036099.217970@m73g2000cwd.googlegroups.com>
Hi,
I am always creating the same perfmon logfile before running any
knowledge script on daily basis.
Actually i am running a knowledge script and the same log file of
perfmon which will create a graph by taking the data from the perfmon
log file.
can i automate the creation of log file and the graph of perfmon using
perl.
Can any body help?
------------------------------
Date: 22 Jun 2006 03:54:34 -0700
From: "king" <hara.acharya@gmail.com>
Subject: working with perfmon
Message-Id: <1150973674.091023.187110@i40g2000cwc.googlegroups.com>
Hi,
I am always creating the same perfmon logfile before running any
knowledge script on daily basis.
Actually i am running a knowledge script and the same log file of
perfmon which will create a graph by taking the data from the perfmon
log file.
can i automate the creation of log file and the graph of perfmon using
perl.
Can any body help?
------------------------------
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 V10 Issue 9341
***************************************