[28410] in Perl-Users-Digest
Perl-Users Digest, Issue: 9774 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 27 09:05:57 2006
Date: Wed, 27 Sep 2006 06: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)
Perl-Users Digest Wed, 27 Sep 2006 Volume: 10 Number: 9774
Today's topics:
Re: An interactive interpreter/shell? <bik.mido@tiscalinet.it>
Re: An interactive interpreter/shell? <bik.mido@tiscalinet.it>
Re: An interactive interpreter/shell? <bik.mido@tiscalinet.it>
Battlefield Weapon Popularity Trend (was: Computer Lang <peace.is.our.profession@gmx.de>
Re: Computer Language Popularity Trend <mark.hoemmen@gmail.com>
Re: Computer Language Popularity Trend <jon+usenet@unequivocal.co.uk>
Re: Computer Language Popularity Trend <jstroud@mbi.ucla.edu>
Re: Computer Language Popularity Trend cartercc@gmail.com
Re: Endless loop in Text::Format::reformat() <noreply@gunnar.cc>
FA: Llama book (UK) mark@tranchant.co.uk
Re: FA: Llama book (UK) usenet@DavidFilmer.com
Re: FA: Llama book (UK) mark@tranchant.co.uk
Re: FA: Llama book (UK) <David.Squire@no.spam.from.here.au>
Re: FA: Llama book (UK) mark@tranchant.co.uk
Re: Help with "require" and importing constants <nobull67@gmail.com>
Passing object from subroutine problem <traggatt@gmail.com>
Re: Passing object from subroutine problem <mritty@gmail.com>
Re: Passing object from subroutine problem <traggatt@gmail.com>
Re: Passing object from subroutine problem (reading news)
Re: Passing object from subroutine problem <peace.is.our.profession@gmx.de>
Re: Passing object from subroutine problem <mritty@gmail.com>
Problem with glob and filenames containing '[' and ']' <David.Squire@no.spam.from.here.au>
Re: question about $list[1] x @list2 <bik.mido@tiscalinet.it>
Re: Reading from standard input <bik.mido@tiscalinet.it>
Re: Reference to hash value anno4000@radom.zrz.tu-berlin.de
Re: regular expression pb. with tags steeve_dun@SoftHome.net
Re: Splitting and keeping key/value <mr@sandman.net>
Re: WIn32API and keyboard <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Sep 2006 09:12:11 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: An interactive interpreter/shell?
Message-Id: <u29kh2hjd93sh27mnlqlo06vlmee7gg4ov@4ax.com>
On Tue, 26 Sep 2006 20:31:51 GMT, "Mumia W. (reading news)"
<paduille.4058.mumia.w@earthlink.net> wrote:
>> DB<5> $info;
>
>By itself, "$info;" is a useless statement; you probably meant "print
>$info;"
Or
x $info
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 27 Sep 2006 11:06:53 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: An interactive interpreter/shell?
Message-Id: <smckh2hbmm8ai4cdithlqco991snm6t6nu@4ax.com>
On 26 Sep 2006 10:22:46 -0700, "robb@acm.org" <robb@acm.org> wrote:
>Yes, you're right. I'm sorry about the sarcastic reply earlier.
>Here's a description of a few things that the perl interpreter doesn't
>do interactively:
>
> http://dev.perl.org/perl6/rfc/184.html
Err, well, yes: it's a debugger and not an actual interpreter,
although it offers much of the functionality of the latter. It has
some commands and stuff that is not a command gets eval()'d in the
context of the current package. So you may still write basically any
amount of code you like provided it's all on one line.
>The Python interpreter offers a lot more, though. As a Python
I bet it does. Though evidence is that Perl programmers do not really
suffer from the lack of such a beast. And the debugger is more than
enough to type some perl interactively.
>developer, I'm used to being able to start the interpreter, instantiate
>some of my new classes I've written, invoke methods, determine the
>types of the objects.
All this *is* possibile in the debugger.
>The Python interpreter feels a lot like Smalltalk without the graphic
>interface.
Not having any more experience with Smalltalk than with Python, this
doesn't help much. Still, I have some experience with languages that
have an interactive interpreter, but I don't feel the need for one in
Perl.
>It's a common development style for Python programmers, and I was
>hoping to use it with my Perl development. Here's an example of what I
I guess you will have to abandon your hope...
>>>> class Dog (object):
>... def bark(self):
>... print "Woof"
>...
>>>> Dog
><class '__main__.Dog'>
>>>> Dog.bark
DB<1> package Dog; sub bark { print "Woof" }
DB<2> x *Dog
0 *main::Dog
DB<3> Dog->bark
Woof
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 27 Sep 2006 11:06:55 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: An interactive interpreter/shell?
Message-Id: <g6ekh2d23sletla88fhlgdreciq5emrots@4ax.com>
On 26 Sep 2006 10:28:09 -0700, "robb@acm.org" <robb@acm.org> wrote:
>And, I didn't get too far using the perl interpreter. Maybe I did
>something wrong? But also - it's not clear to me that this kind of
>work is supported:
>
>DB<1> print "hello\n";
>DB<2> use lib '/home/web/lib/perl';
>DB<3> use Trillium::Info;
>DB<4> my $info = Trillium::Info->new();
From perldoc perldebug:
: Note that the said "eval" is bound by an implicit scope. As a result
: any newly introduced lexical variable or any modified capture buffer
: content is lost after the eval. The debugger is a nice environment to
: learn Perl, but if you interactively experiment using material which
: should be in the same scope, stuff it in one line.
Sorry!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 27 Sep 2006 09:29:10 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Battlefield Weapon Popularity Trend (was: Computer Language Popularity Trend)
Message-Id: <efd9g0$sn5$1@mlucom4.urz.uni-halle.de>
Thus spoke Xah Lee (on 2006-09-27 05:03):
> This page gives a visual report of computer languages's
> popularity, as indicated by their traffic level in newsgroups.
> ...
> http://xahlee.org/lang_traf/index.html
When the Samurai of medieval Japan were confronted
with new 'battlefield language', e.g. early Shotguns,
they resisted because one could push any peasant
behind a gun -- thus nullifying the result of
the Samurai Art of Warfare that required a life
full of learning - in the end wiping out a
complete culture.
Same trend here - the reason is: 'cost' ;-)
Regards & scnr
Mirco
f'up: clpm, clp
------------------------------
Date: 27 Sep 2006 02:37:47 -0700
From: "mark.hoemmen@gmail.com" <mark.hoemmen@gmail.com>
Subject: Re: Computer Language Popularity Trend
Message-Id: <1159349867.827187.270390@h48g2000cwc.googlegroups.com>
Xah Lee wrote:
> Computer Language Popularity Trend
>
> This page gives a visual report of computer languages's popularity, as
> indicated by their traffic level in newsgroups. This is not a
> comprehensive or fair survey, but does give some indications of
> popularity trends.
>
> http://xahlee.org/lang_traf/index.html
Careful there with the sweeping generalizations and quick judgments
about languages :)
Furthermore, it's nice to conclude that Lisp is getting more popular,
but we also have to take into account global trends (maybe more people
are using usenet in general? maybe the total number of programmers in
the world is increasing?).
Still, it's nice to see trends plotted out like that, thanks for the
work :)
mfh
------------------------------
Date: 27 Sep 2006 09:43:20 GMT
From: Jon Ribbens <jon+usenet@unequivocal.co.uk>
Subject: Re: Computer Language Popularity Trend
Message-Id: <slrnehkht4.7kj.jon+usenet@snowy.squish.net>
In article <1159349867.827187.270390@h48g2000cwc.googlegroups.com>, mark.hoemmen@gmail.com wrote:
>> http://xahlee.org/lang_traf/index.html
>
> Careful there with the sweeping generalizations and quick judgments
> about languages :)
I just read "PHP as a language is rather dry and business-like",
and fell off my chair.
------------------------------
Date: Wed, 27 Sep 2006 10:54:36 GMT
From: James Stroud <jstroud@mbi.ucla.edu>
Subject: Re: Computer Language Popularity Trend
Message-Id: <MLsSg.16766$IA.2205@newssvr11.news.prodigy.com>
mark.hoemmen@gmail.com wrote:
> Xah Lee wrote:
>> Computer Language Popularity Trend
>>
>> This page gives a visual report of computer languages's popularity, as
>> indicated by their traffic level in newsgroups. This is not a
>> comprehensive or fair survey, but does give some indications of
>> popularity trends.
>>
>> http://xahlee.org/lang_traf/index.html
>
> Careful there with the sweeping generalizations and quick judgments
> about languages :)
>
> Furthermore, it's nice to conclude that Lisp is getting more popular,
> but we also have to take into account global trends (maybe more people
> are using usenet in general? maybe the total number of programmers in
> the world is increasing?).
>
> Still, it's nice to see trends plotted out like that, thanks for the
> work :)
>
> mfh
>
Finally, a contribution of substance from lambda. Who woulda thunk it?
------------------------------
Date: 27 Sep 2006 05:15:26 -0700
From: cartercc@gmail.com
Subject: Re: Computer Language Popularity Trend
Message-Id: <1159359326.496431.293370@i3g2000cwc.googlegroups.com>
I, too, attempt to track the popularity of computer languages, but I
like to look at the job boards. My theory is that the number of
employers looking for particular skills indicates the relative
popularity of the language. This is a somewhat crude measure,
particularly with Microsoft technologies (VB, VB6, VB.NET, VS, etc). I
think it's much more reliable with open source languages, such as Java,
Perl, PHP, and so on.
'Popularity' is a slippery concept as well. C isn't real popular in
terms of jobs, but it is in terms of compensation. In system
administration (which I also follow), Windows has large numbers of
jobs, but a low level of compensation. OSes like AIX on the other hand
have lower numbers of available jobs, but those tend to be more highly
compensated. One could argue that compensation is a function of
popularity, with the more unpoular technologies having carrying a
bigger price to attract more people -- an example of supply and demand
-- but then one would have to argue that garbade collectors should be
more highly compensated that physicians.
You can also get a rough measure ot the popularity of web scripting
languages from an analysis of the URLs. The last time I did this was in
2003, and as I recall, these were the results:
PHP 30% and increasing
Perl 28% and falling
ASP 25% and falling fast
ColdFusion 6% and steady
Java and JSP 5% and increasing
others, Python, Ruby, ...
Again, this is a very rough measure. Java, for instance, is used by big
companies (like auto manufacturers, aerospace industries, defense
contractors, big retailers, etc.) One site/one vote isn't
representative necessarily, plus the bigger companies employ more
people than the smaller companies that tend to use FOSS.
Finally, in my area, we have a lot of banking and insurance jobs. These
companies internally are exclusively Microsoft shops. It's virtually
impossible to work there unless you know Visual Studio and SQL Server.
Misrosoft people tend not to prowl the newsgroups, and I would suspect
that any measurement based on numbers of newsgroup postings would be
skewed for this reason.
CC
------------------------------
Date: Wed, 27 Sep 2006 12:28:10 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Endless loop in Text::Format::reformat()
Message-Id: <4nv21sFc8sngU1@individual.net>
Brian McCauley wrote:
> Ah, well since $1 is null we know that /^(.+)? (.*)/ is matching but
> the first subexpression is not. As far as I can see this can only be is
> there's only one space. Which as you said means I can't explain the
> infinite loop.
Right, but you were close - see Bob's explanation in another sub-thread.
I'm about to update CGI::ContactForm, and have just reported the bug in
Text::Flowed: http://rt.cpan.org/Ticket/Display.html?id=21739
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 27 Sep 2006 01:03:14 -0700
From: mark@tranchant.co.uk
Subject: FA: Llama book (UK)
Message-Id: <1159344194.862036.121630@b28g2000cwb.googlegroups.com>
Randall Schwartz and Tom Phoenix's "Learning Perl": the O'Reilly Llama
book:
http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=130031468090
--
Mark.
------------------------------
Date: 27 Sep 2006 01:22:40 -0700
From: usenet@DavidFilmer.com
Subject: Re: FA: Llama book (UK)
Message-Id: <1159345360.814466.161550@h48g2000cwc.googlegroups.com>
mark@tranchant.co.uk wrote:
> Randall Schwartz and Tom Phoenix's "Learning Perl": the O'Reilly Llama
> book:
>
> http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=130031468090
>
usenet is not the place to advertise auctions. Thus, I have sabotaged
the auction, and you will not see a penny (because I placed a huge bid
which I have no intention of honoring), and I promise that I will do
this for each and every auction you attempt to advertise in this
newsgroup.
--
David Filmer (http//DavidFilmer.com)
------------------------------
Date: 27 Sep 2006 04:21:08 -0700
From: mark@tranchant.co.uk
Subject: Re: FA: Llama book (UK)
Message-Id: <1159356068.882491.172570@e3g2000cwe.googlegroups.com>
usenet@DavidFilmer.com wrote:
> usenet is not the place to advertise auctions. Thus, I have sabotaged
> the auction, and you will not see a penny (because I placed a huge bid
> which I have no intention of honoring), and I promise that I will do
> this for each and every auction you attempt to advertise in this
> newsgroup.
Sigh. Apologies - I thought this might be useful to someone looking for
a cheap copy of the textbook, as that's how I found one myself.
Can't you just set your newsreader to block posts beginning "FA:"?
--
m.
------------------------------
Date: Wed, 27 Sep 2006 12:22:53 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: FA: Llama book (UK)
Message-Id: <efdmud$ft4$1@gemini.csx.cam.ac.uk>
mark@tranchant.co.uk wrote:
> usenet@DavidFilmer.com wrote:
>
>> usenet is not the place to advertise auctions. Thus, I have sabotaged
>> the auction, and you will not see a penny (because I placed a huge bid
>> which I have no intention of honoring), and I promise that I will do
>> this for each and every auction you attempt to advertise in this
>> newsgroup.
>
> Sigh. Apologies - I thought this might be useful to someone looking for
> a cheap copy of the textbook, as that's how I found one myself.
>
> Can't you just set your newsreader to block posts beginning "FA:"?
>
No. This is a newsgroup for language discussion. Keep your spam out of it.
DS
------------------------------
Date: 27 Sep 2006 04:24:53 -0700
From: mark@tranchant.co.uk
Subject: Re: FA: Llama book (UK)
Message-Id: <1159356293.532459.35730@m73g2000cwd.googlegroups.com>
David Squire wrote:
> No. This is a newsgroup for language discussion. Keep your spam out of it.
OK, OK, point taken.
--
m.
------------------------------
Date: 27 Sep 2006 00:07:13 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Help with "require" and importing constants
Message-Id: <1159340833.284953.192450@i42g2000cwa.googlegroups.com>
Henry Law wrote:
>
> But follow-up questions if I may. ARCHIVE isn't a function, it's a
> constant.
As others have pointed out, Perl constants _are_ functions. They have a
special attribute so that the compiler knows to call them at compile
time and simply compile in the value.
But since you are compiling the code that uses ARCHIVE before you load
the module that defines it, ARCHIVE cannot be compiled as a constant
in your code, it's just a simple function call.
------------------------------
Date: 27 Sep 2006 05:08:36 -0700
From: "tim" <traggatt@gmail.com>
Subject: Passing object from subroutine problem
Message-Id: <1159358916.632200.267650@i42g2000cwa.googlegroups.com>
Hello
I'm new here, so, hi!
I've been having the following problem. I have a module which I am
creating to manage sessions for my website. I have the following sub in
it:
#takes an active db handle, returns a new session object.
sub newSession {
my $dbh = @_[1];
my %session;
tie %session, 'Apache::Session::MySQL', undef,
{ Handle => $dbh,
LockHandle => $dbh};
print "Session session ref = ". \%session . "\n";
return \%session;
}
In the calling routine, I have the following code:
my $sessionref = SessionManager->newSession($dbh);
my %session = %$sessionref;
tied(%session)->delete;
The first two lines seem to work ok, but the 3rd gives this error:
Can't call method "delete" on an undefined value at ./tester line 31.
Bizarely, it seems I can access the object in other ways from the same
context, as the following lines work as expected:
print "session id = $session{_session_id}\n";
print "testing session ref = " . $sessionref . "\n";
(i.e. session id is printed)
I'd really appreciate any comments or suggestions on why the above may
be occuring.
Many thanks
Tim.
------------------------------
Date: 27 Sep 2006 05:18:38 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Passing object from subroutine problem
Message-Id: <1159359518.552816.134390@d34g2000cwd.googlegroups.com>
tim wrote:
> I'm new here, so, hi!
Welcome! Please make sure you read the Posting Guidelines for this
group (posted here twice a week) to learn valuable tips to maximize the
potential usefulness of posting here...
> I've been having the following problem. I have a module which I am
> creating to manage sessions for my website. I have the following sub in
> it:
>
> #takes an active db handle, returns a new session object.
> sub newSession {
> my $dbh = @_[1];
Always always always use warnings when devleoping Perl code. This
should have told you:
Scalar value @_[1] better written as $_[1]
> my %session;
> tie %session, 'Apache::Session::MySQL', undef,
> { Handle => $dbh,
> LockHandle => $dbh};
> print "Session session ref = ". \%session . "\n";
> return \%session;
> }
>
> In the calling routine, I have the following code:
>
> my $sessionref = SessionManager->newSession($dbh);
> my %session = %$sessionref;
%session is a brand new hash, simply populated with the values that are
currently in the variable %$sessionref. It is in all other ways
unrelated to $sessionref. It is not tied to any object of the
Apache::Session::MySQL class.
> tied(%session)->delete;
>
> The first two lines seem to work ok, but the 3rd gives this error:
>
> Can't call method "delete" on an undefined value at ./tester line 31.
Because %session is not a tied variable, tied() returns undef.
>
> Bizarely, it seems I can access the object in other ways from the same
> context, as the following lines work as expected:
>
> print "session id = $session{_session_id}\n";
_session_id is one of the keys you copied over when you created the new
hash, so yes, that works.
> print "testing session ref = " . $sessionref . "\n";
>
> (i.e. session id is printed)
$sessionref is a reference to the original tied variable, so yes, that
works.
> I'd really appreciate any comments or suggestions on why the above may
> be occuring.
Copying a hash does not copy the tied nature of the variable.
Paul Lalli
------------------------------
Date: 27 Sep 2006 05:43:17 -0700
From: "tim" <traggatt@gmail.com>
Subject: Re: Passing object from subroutine problem
Message-Id: <1159360997.498168.152360@i42g2000cwa.googlegroups.com>
Thanks Paul
Whoops- didn't notice that warnings were off. I'll make sure they're on
before posting next time!!
Tim
Paul Lalli wrote:
> tim wrote:
>
> > I'm new here, so, hi!
>
> Welcome! Please make sure you read the Posting Guidelines for this
> group (posted here twice a week) to learn valuable tips to maximize the
> potential usefulness of posting here...
>
> > I've been having the following problem. I have a module which I am
> > creating to manage sessions for my website. I have the following sub in
> > it:
> >
> > #takes an active db handle, returns a new session object.
> > sub newSession {
> > my $dbh = @_[1];
>
> Always always always use warnings when devleoping Perl code. This
> should have told you:
> Scalar value @_[1] better written as $_[1]
>
> > my %session;
> > tie %session, 'Apache::Session::MySQL', undef,
> > { Handle => $dbh,
> > LockHandle => $dbh};
> > print "Session session ref = ". \%session . "\n";
> > return \%session;
> > }
> >
> > In the calling routine, I have the following code:
> >
> > my $sessionref = SessionManager->newSession($dbh);
> > my %session = %$sessionref;
>
> %session is a brand new hash, simply populated with the values that are
> currently in the variable %$sessionref. It is in all other ways
> unrelated to $sessionref. It is not tied to any object of the
> Apache::Session::MySQL class.
>
> > tied(%session)->delete;
> >
> > The first two lines seem to work ok, but the 3rd gives this error:
> >
> > Can't call method "delete" on an undefined value at ./tester line 31.
>
> Because %session is not a tied variable, tied() returns undef.
>
> >
> > Bizarely, it seems I can access the object in other ways from the same
> > context, as the following lines work as expected:
> >
> > print "session id = $session{_session_id}\n";
>
> _session_id is one of the keys you copied over when you created the new
> hash, so yes, that works.
>
> > print "testing session ref = " . $sessionref . "\n";
> >
> > (i.e. session id is printed)
>
> $sessionref is a reference to the original tied variable, so yes, that
> works.
>
> > I'd really appreciate any comments or suggestions on why the above may
> > be occuring.
>
> Copying a hash does not copy the tied nature of the variable.
>
> Paul Lalli
------------------------------
Date: Wed, 27 Sep 2006 12:47:01 GMT
From: "Mumia W. (reading news)" <paduille.4058.mumia.w@earthlink.net>
Subject: Re: Passing object from subroutine problem
Message-Id: <9puSg.13245$v%4.12309@newsread1.news.pas.earthlink.net>
On 09/27/2006 07:08 AM, tim wrote:
> Hello
>
> I'm new here, so, hi!
>
> I've been having the following problem. I have a module which I am
> creating to manage sessions for my website. I have the following sub in
> it:
>
> #takes an active db handle, returns a new session object.
> sub newSession {
> my $dbh = @_[1];
> my %session;
> tie %session, 'Apache::Session::MySQL', undef,
> { Handle => $dbh,
> LockHandle => $dbh};
> print "Session session ref = ". \%session . "\n";
> return \%session;
> }
>
> In the calling routine, I have the following code:
>
> [29:] my $sessionref = SessionManager->newSession($dbh);
> [30:] my %session = %$sessionref;
> [31:] tied(%session)->delete;
>
The hash is no longer tied to 'Apache::Session.' Line 30 makes a /copy/
of the tied hash returned by newSession(). However, the tying does not
survive the copying, so $sessionref is still tied, but %session is not,
so the "tied" function returns undef for %session.
> The first two lines seem to work ok, but the 3rd gives this error:
>
> Can't call method "delete" on an undefined value at ./tester line 31.
>
It's the same as saying that this is invalid:
undef->delete();
> Bizarely, it seems I can access the object in other ways from the same
> context, as the following lines work as expected:
>
> print "session id = $session{_session_id}\n";
> print "testing session ref = " . $sessionref . "\n";
>
> (i.e. session id is printed)
>
Try this:
tied(%$sessionref)->delete();
> I'd really appreciate any comments or suggestions on why the above may
> be occuring.
>
> Many thanks
>
> Tim.
>
You're welcome.
--
paduille.4058.mumia.w@earthlink.net
------------------------------
Date: Wed, 27 Sep 2006 14:51:09 +0200
From: Mirco Wahab <peace.is.our.profession@gmx.de>
Subject: Re: Passing object from subroutine problem
Message-Id: <efdsbm$4tl$1@mlucom4.urz.uni-halle.de>
Thus spoke tim (on 2006-09-27 14:08):
> I'm new here, so, hi!
Great!
> #takes an active db handle, returns a new session object.
> sub newSession {
> my $dbh = @_[1];
Shouldn't the @_[1], which is
a array slice containing the
*second* argument of the caller,
read: $_[0] ... ?
> my $sessionref = SessionManager->newSession($dbh);
> my %session = %$sessionref;
> tied(%session)->delete;
Here you drop a single argument to your function ...
(The return will be a ref to empty hash or sth.)
Regards
Mirco
------------------------------
Date: 27 Sep 2006 06:02:40 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Passing object from subroutine problem
Message-Id: <1159362160.663293.122640@k70g2000cwa.googlegroups.com>
Mirco Wahab wrote:
> Thus spoke tim (on 2006-09-27 14:08):
>
> > I'm new here, so, hi!
>
> Great!
>
> > #takes an active db handle, returns a new session object.
> > sub newSession {
> > my $dbh = @_[1];
>
> Shouldn't the @_[1], which is
> a array slice containing the
> *second* argument of the caller,
> read: $_[0] ... ?
No. Please take a few moments to learn about method calls in Perl:
perldoc perlmod
> > my $sessionref = SessionManager->newSession($dbh);
> > my %session = %$sessionref;
> > tied(%session)->delete;
>
> Here you drop a single argument to your function ...
Yes, but Perl passed an additional first argument - the object itself.
Paul Lalli
------------------------------
Date: Wed, 27 Sep 2006 12:33:26 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Problem with glob and filenames containing '[' and ']'
Message-Id: <efdni6$haf$1@gemini.csx.cam.ac.uk>
Hi folks,
I'm having trouble using glob to find filenames that contain '[' and
']', even though I am escaping those meta-characters. Here is an example
script and output:
----
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Deurl;
for my $EncodedFile (
'/damocles/documents/ENH1260/2006/2/Short
assignment/20331975_week9%5B1%5D.txt',
'/damocles/documents/ENH1260/2006/2/Short
assignment/20331975_week9.txt',
) {
my $OriginalFileBase = deurlstr($EncodedFile);
$OriginalFileBase =~ s/\.[^.]+$//; # trim extension
$OriginalFileBase =~ s/([\[\]{}?*~\ ,'`"])/\\$1/g; # escape
characters that are meta in glob;
print "\$OriginalFileBase = $OriginalFileBase\n";
my @CandidateOrigFiles = glob ("$OriginalFileBase*");
print "\@CandidateOrigFiles:\n", join "\n", @CandidateOrigFiles;
print "\n###########################################################\n";
}
----
Output:
Sep 27 - 9:31pm % ./test.pl
<ENTER THE CGI QUERY. End with CTRL+D>
$OriginalFileBase = /damocles/documents/ENH1260/2006/2/Short\
assignment/20331975_week9\[1\]
@CandidateOrigFiles:
###########################################################
$OriginalFileBase = /damocles/documents/ENH1260/2006/2/Short\
assignment/20331975_week9
@CandidateOrigFiles:
/damocles/documents/ENH1260/2006/2/Short
assignment/20331975_week9%5B1%5D.txt
/damocles/documents/ENH1260/2006/2/Short
assignment/20331975_week9%5B1%5D.txt.webbed
/damocles/documents/ENH1260/2006/2/Short assignment/20331975_week9[1].doc
###########################################################
----
As you can see, the first iteration of the for loop produces no matches.
I have included the second, shortened filename, example to demonstrate
that the file I want really does exist. Likewise, at the bash prompt I
can do:
Sep 27 - 9:31pm % ls /damocles/documents/ENH1260/2006/2/Short\
assignment/20331975_week9\[1\]*
/damocles/documents/ENH1260/2006/2/Short assignment/20331975_week9[1].doc
I am at a loss...
DS
------------------------------
Date: 27 Sep 2006 11:06:57 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: question about $list[1] x @list2
Message-Id: <n5akh2pld5d1snv1gk95r6i3rbh3ufbigm@4ax.com>
On 26 Sep 2006 20:09:57 -0700, "jialin" <JialinLi1981@gmail.com>
wrote:
>i know the output will be "acacacacac",
>but what this x means in $list1[2] x @list2,
perldoc perlop
and search for 'Binary "x"'.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 27 Sep 2006 11:06:56 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Reading from standard input
Message-Id: <jm9kh29h6tdahk2pbd761fgp8naikklj6g@4ax.com>
(I don't have John's post so I'm replying to you)
On 26 Sep 2006 21:40:18 -0700, "Harpreet" <harpreet.saluja@gmail.com>
wrote:
>> You are trying to open the file '-', standard input is not involved when
>> opening a plain file.
>>
>> The *only* time that '-' has anything to do with standard input is when @ARGV
>> and <> are used:
I thought so too. But that is *not* the case, and the docs confirm
that:
: In the 2-arguments (and 1-argument) form opening '-' opens STDIN
: and opening '>-' opens STDOUT.
Yet, not a particularly good reason to use it, especially when you
already have STDIN.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 27 Sep 2006 10:56:02 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Reference to hash value
Message-Id: <4nv3m2Fc74pdU1@news.dfncis.de>
Michele Dondi <bik.mido@tiscalinet.it> wrote in comp.lang.perl.misc:
> On 26 Sep 2006 00:43:51 -0700, schwarzenschafe@gmail.com wrote:
>
> >Assuming $hashref1->{"key"} is a hashref I want to copy (not
> >reference), and %hash is never used. My best guess is:
> >
> >$hashref2 = \%{$hashref1->{"key"}};
>
> No. Dereference and reference inverse functions. If you compose them
> you obtain identity.
...with one exception. When $x is an object that overloads hash
de-referencing \%$x is in general different from $x.
Anno
------------------------------
Date: 27 Sep 2006 00:56:14 -0700
From: steeve_dun@SoftHome.net
Subject: Re: regular expression pb. with tags
Message-Id: <1159343774.927057.50550@m7g2000cwm.googlegroups.com>
Thank you all
-steve
------------------------------
Date: Wed, 27 Sep 2006 13:46:03 +0200
From: Sandman <mr@sandman.net>
Subject: Re: Splitting and keeping key/value
Message-Id: <mr-132BAB.13460327092006@individual.net>
In article <slrnehjb5i.9b3.tadmc@magna.augustmail.com>,
Tad McClellan <tadmc@augustmail.com> wrote:
> > I keep getting reminded
>
> An easy way to avoid that would be to stop coming back.
Indeed. But I could also get lucky and come upon someone that's
helpful. Not that big of a chance in this group, I know. But it has
happened before.
--
Sandman[.net]
------------------------------
Date: Wed, 27 Sep 2006 18:00:08 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: WIn32API and keyboard
Message-Id: <451a308e$0$17214$afc38c87@news.optusnet.com.au>
"mw" <mbw@vp.pl> wrote in message news:efbam2$t17$1@news.onet.pl...
> Hi !
>
> I test GetAsyncKeyState function on my XP.
> Here is my code :
>
> use Win32::API;
>
> my $rsGetAsyncKeyState = new Win32::API("user32", "GetAsyncKeyState", "N",
> "I");
>
> sub GetAsyncKeyState {
> my ($keyCode) = @_;
> my $ret = $rsGetAsyncKeyState->Call($keyCode);
> print "ret = $ret\n";
> return( $ret & 1 );
> }
>
>
> while () {
> sleep 1 ;
> $keystate=GetAsyncKeyState(97) ;
> # 97 is "a" ascii code
> #print "a state=$keystate\n" ; ;
> }
>
>
> When I run this code and press "a" key I see only :
>
> .
> .
> ret = 0
> ret = 0
> ret = 0
> .
> .
> .
> It means that "a" key is not pressed.
> What's wrong ?
>
No - it means that the numeric keypad "1" key has not been pressed. (These
are "Virtual-Key" codes, not ascii codes. There should be a listing of them
somewhere on the Microsoft website.)
Press the "1" key in your numeric keypad and you'll see 'ret = 1' appear at
the next iteration of the loop.
Cheers,
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.
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 9774
***************************************