Re: [ot] doubtless silly perl question

2003-09-16 Thread Rafael Garcia-Suarez
Joel Bernstein wrote:
   my $foo=( split ',' = $line )[7];

Side note : use /,/ instead of ','.
The 1st argument to split() is always a regexp (1), and write it this way
if you don't want to debug what's wrong with Csplit '|' = $foo.

­-
(1) except when it's a single space  . :-)



Re: [ot] doubtless silly perl question

2003-09-16 Thread Roger Burton West
On Tue, Sep 16, 2003 at 01:39:26AM +0100, Joel Bernstein wrote:

what do you understand by the line: 
   my $foo=( split ',' = $line )[7];
?

i'm trying to get the split to return an array, of which I then get the
7th element (and assign to $foo).

That's what it does for me (well, the 8th element, of course), even if
I use ',' rather than the more useful /,/. What's the problem?

R



Re: back to the 80's

2003-09-16 Thread Iain Tatch
On Monday, September 15, 2003, 9:15:39 PM, Steve Keay wrote:

SK A strange request, perhaps, but:

SK Does anyone happen to have a collection of old computers like BBC
SK micros, Commodore 64, ZX Spectrum, ZX 81, etc?  My g/f wants to
SK photograph them for a book being published for the Reader's Digest as
SK well as an annual price guide for lunatics that collect things.

There's a ZX81 in our server room at work.

No, really, there is.

I'm sure I could arrange for it to be photographed if necessary.

-- 
Iain | PGP mail preferred: pubkey @ www.deepsea.f9.co.uk/misc/iain.asc
($=,$,)=split m$13/$,qq;1313/tl\.rnh  r   HITtahkPctacriAneeeusaoJ;;
for(@[EMAIL PROTECTED] m,,,$,){$..=$$[$=];$$=$=[$=];[EMAIL PROTECTED];[EMAIL PROTECTED]
]eq$$$==$?;$==$?;for(@$)[EMAIL PROTECTED] eq$_;;last if!$@;$=++}}print$..$/




Re: perl on Solaris vs Linux

2003-09-16 Thread Andy Ford
OK - I have fixed this error. The actual issue I want to solve is a core
dump. The following occurs

I have recently written 3 scripts to...
script 1. write raw ICMP packets to an interface
script 2. sniff for them
script 3. act on non-response/response/RTT etc etc (i.e. the boss)

The sniffer script uses the following modules

Net::Pcap;
NetPacket::Ethernet;
NetPacket::IP;
IPC::Shareable;

The scripts work well on my Gentoo distribution but on Solaris I get a
core dump when I try to use ..

$src_IP = NetPacket::IP-decode($rawpkt)-{src_ip}; 

The error actually comes from tie-ing the shared memory at the beginning
of the script. If I comment out the tie $var declarations,
NetPacket::IP-decode($rawpkt)-{src_ip} works well.

So it seems to be a clash between IPC::Shareable and NetPacket::IP.

Anyone seen this before.

(Apologies for the earlier 'p is not of type pcap_tPtr' confusion. I had
two weeks off and my brain is mush!!)

Thanks

Andy

On Mon, 2003-09-15 at 14:31, Patrick Mulvany wrote:
 On Mon, Sep 15, 2003 at 12:04:21PM +0100, Andy Ford wrote:
  I have a perl script that works perfectly on my Gentoo Linux distro but
  fails on my Solaris 2.8 box. I am running v5.8.0 on both platforms and I
  have absolutely no clue on how to get it working on solaris. 
  
  Its actually a collection of scripts that use the following CPAN
  modules...
  
  IPC::Shareable
  Net::Pcap
  NetPacket::Ethernet
  NetPacket::IP
  Net::RawIP
  
  The error I have is the following...
  
  p is not of type pcap_tPtr at ./icmp_sniffer line 67.
  
  Line 67  68 of icmp_sniffer is ...
  die unable to compile $pktfilter\n
  if (Net::Pcap::compile($pcap_t ,\$compprog,$pktfilter,0,$netmask)) ;
  
  This script works perfectly on my Linux box but not Solaris.
  
  Anyone offering some useful/helpful pointers would be much appreciated
  
  Thanks
  
  Andy
  
 
 
 From the Net::RawIP Readme :-
 
 NOTE: Ethernet related methods currently implemented only on Linux and *BSD!
 Help with port eth.c to other platforms is very appreciated.
 
 This would not be related would it?
 
 Paddy
  




Re: back to the 80's

2003-09-16 Thread Jason Clifford
On Mon, 15 Sep 2003, Steve Keay wrote:

 Does anyone happen to have a collection of old computers like BBC
 micros, Commodore 64, ZX Spectrum, ZX 81, etc?  My g/f wants to
 photograph them for a book being published for the Reader's Digest as
 well as an annual price guide for lunatics that collect things.

The British Computer Museum at Bletchley Park have quite a good collection 
of old personal computer equipment including, I think, all of the above.

Jason Clifford
-- 
UKFSN.ORG   Finance Free Software while you surf the 'net
http://www.ukfsn.org/   ADSL Broadband available now




Re: Perl reference book

2003-09-16 Thread Mark Fowler
On Mon, 15 Sep 2003, Andy Ford wrote:

 Can anyone suggest a good Perl reference book, something equivalent to
 the Kernigan and Richie C book would be great

Firstly, look at the Perl Book website:

  http://books.perl.org/

Secondly, I agree with everything Dave Cantrell said (well, about books
in this thread anyhow)

Thirdly:

 * The Perl CD Bookshelf (published by ORA) isn't a bad place to start as
   a collection of good books.  If you want Real Paper (tm) then you could
   do worse just to buy dead tree copies of each of the books.
   http://www.oreilly.com/catalog/perlcdbs3/  (v4 out in December)

 * Data Munging With Perl (Cross, published by Manning.)  Good choice for
   a practical how-to to get the best out of Perl for day to day tasks
   once you've got a basic grip on the language.  Helpfully mentions a
   wide range of basic modules off of CPAN you should know about.
   http://www.manning.com/cross/index.html

 * Object Orintated Perl (Conway, published by Manning.) Everything you
   wanted to know about OO and were afraid to ask.  Reading this book will
   allow you to really understand what's going on with the Perl langauges.
   http://www.manning.com/Conway/index.html

Mark.

-- 
#!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, [EMAIL PROTECTED], http://twoshortplanks.com/};



Re: [ot] doubtless silly perl question

2003-09-16 Thread Joel Bernstein
On Tue, Sep 16, 2003 at 09:20:04AM +0100, Roger Burton West wrote:
 On Tue, Sep 16, 2003 at 01:39:26AM +0100, Joel Bernstein wrote:
 
 what do you understand by the line: 
  my $foo=( split ',' = $line )[7];
 ?
 
 i'm trying to get the split to return an array, of which I then get the
 7th element (and assign to $foo).
 
 That's what it does for me (well, the 8th element, of course), even if

I count from the zero'th ;)

 I use ',' rather than the more useful /,/. What's the problem?

Yeah, OK, point taken about stringifying the , altho' I expect that the
= doesn't help in that respect.

If that line's OK, then it's another I have a problem with. Ho hum.
 
 R
 

/joel



RE: back to the 80's

2003-09-16 Thread Taylor James
Steve Keay wrote:
 A strange request, perhaps, but:
 
 Does anyone happen to have a collection of old computers like BBC
 micros, Commodore 64, ZX Spectrum, ZX 81, etc?  My g/f wants to
 photograph them for a book being published for the Reader's Digest as
 well as an annual price guide for lunatics that collect things.
 

I have a BBC Micro (can't remember which exactly), a Commodore VIC20 (with
2k expansion pack!), a Spectrum +2 and a Spectrum +3. Oh, and an Amiga A500+
and an Atari ST (not sure if therse are retro enough for you). They're in
Shepherd's Bush, West London. If she want's to pick them up (and return
them) she can do what she wants with them.

-- 
james




The information contained in this e-mail is intended for the recipient or
entity to whom it is addressed. It may contain confidential information that
is exempt from disclosure by law and if you are not the intended recipient,
you must not copy, distribute or take any act in reliance on it. If you have
received this e-mail in error, please notify the sender immediately and
delete from your system. 



How many lines of Perl code?

2003-09-16 Thread Andy Wardley
Just for fun:
  How many lines of Perl code have been written?  Ever.

Here's my back-of-an-envelope guess:
  First, how many Perl programmers are there?

  Well, let's say that there are ~200 london.pm members who live in the 
  london catchment area and can be bothered to go to a london.pm meeting.

  Approx 1 in 5 Perl programmers care about Perl enough to go to a meeting.
  That suggests there are around 1000 Perl programmers in the London area.

  The London catchment area covers approx one fifth of the UK population.

  That suggest there are around 5000 Perl programmers in the UK.
  There are also lots of programmers who write the occasional bit of Perl 
  code, but we're not worried about them right now.  They don't add much to 
  the hill of beans compared to the hackers writing Perl day in, day out.

  Now, how much Perl does the typical Perl programmer write?  Well, I'm 
  guessing that the average Perl programmer has written 50k lines of Perl 
  code.  That's only 10k lines a year over 5 years, or 200 lines a week.

  That suggests that 5k * 50k = 250 million lines of Perl code have been 
  written by UK Perl programmers.  

  If the UK contains roughly 1/4 of Europe's Perl programmers, then that
  is a billion (1 x 10^9) lines of Perl code in Europe.  The US is
  roughly the same size as Europe.  The rest of the World probably accounts
  for the same again.

  So my guess is that approximately 3 x 10^9 lines of Perl code have been 
  written.  Or in other words, there is one line of Perl code for every
  2 people on the planet.  Who will you share yours with?

Can anyone do any better?  Or think of a more original, accurate and/or 
amusing way of estimating?  CPAN must be a rich source of clues.

Anyway, I'm off to write the three-billion-and-first line of Perl code

A









Re: Perl reference book

2003-09-16 Thread Dave Cross
On Tue, Sep 16, 2003 at 10:22:35AM +0100, Mark Fowler ([EMAIL PROTECTED]) wrote:
 
  * Data Munging With Perl (Cross, published by Manning.)  Good choice for
a practical how-to to get the best out of Perl for day to day tasks
once you've got a basic grip on the language.  Helpfully mentions a
wide range of basic modules off of CPAN you should know about.
http://www.manning.com/cross/index.html

/me hands Mark a fiver :)

Dave...

-- 
  Brian: Oh screw Maximilian!
  Sally: I do.
  Brian: So do I.



Re: [ot] doubtless silly perl question

2003-09-16 Thread Dave Cross
On Tue, Sep 16, 2003 at 01:39:26AM +0100, Joel Bernstein ([EMAIL PROTECTED]) wrote:
 
 i'm trying to get the split to return an array, of which I then get the
 7th element (and assign to $foo).

pedant
That's never going to happen. split returns a list not an array. Of
course, you can take a slice of the return list using the syntax that
you show so your incorrect terminology isn't casuing the problems that
you're seeing. 
/pedant

Dave...

-- 
  Remember... what the dormouse said



Re: How many lines of Perl code?

2003-09-16 Thread Rafael Garcia-Suarez
Andy Wardley wrote:
 Just for fun:
   How many lines of Perl code have been written?  Ever.

And, how many lines of Perl code have been cargo-culted from Matt's
script archive ?  Ever ;-)



Re: web testing

2003-09-16 Thread Paul Makepeace
Je 2003-09-16 11:32:44 +0100, Michael Stevens skribis:
 Can anyone recommend any good software for automated testing of
 websites? I'm hoping for something fairly simple that will record usage
 of a website in a web-browser, and then can re-run that later and look
 for inconsistencies.

I wrote something like this a couple of years ago. You would set the
browser to proxy through a piece of software that recorded cookies 
HTTP requests and then later replay then with a frames interface. At
each page you could then assign regexes/md5 tests to check that
consistency.

The proxy neatly (IMO) got around the problem of rewriting URLs,
cookies, and JavaScript. I thought quite hard about this and couldn't
see a non-proxy way of doing it. (Bueller?)

Is that the sort of thing you're talking about? Are you looking for
an online service or tarball? I'm heading toward implementing the
former route.

Cheers, Paul

-- 
Paul Makepeace ... http://paulm.com/

What is a true division of labor? It can only be street-cleaning.
   -- http://paulm.com/toys/surrealism/



Re: How many lines of Perl code?

2003-09-16 Thread Dave Cross
On Tue, Sep 16, 2003 at 12:33:48PM +0200, Rafael Garcia-Suarez ([EMAIL PROTECTED]) 
wrote:
 Andy Wardley wrote:
  Just for fun:
How many lines of Perl code have been written?  Ever.
 
 And, how many lines of Perl code have been cargo-culted from Matt's
 script archive ?  Ever ;-)
 
Most of them... unfortunately.

Dave...

-- 
  Love is a fire of flaming brandy
  Upon a crepe suzette



Re: How many lines of Perl code?

2003-09-16 Thread Patrick Mulvany
On Tue, Sep 16, 2003 at 11:42:53AM +0100, Michael Stevens wrote:
 On Tue, Sep 16, 2003 at 10:51:12AM +0100, Andy Wardley wrote:
Well, let's say that there are ~200 london.pm members who live in the 
london catchment area and can be bothered to go to a london.pm meeting.
 
 I'd say nearer 50-100 myself.
 
Approx 1 in 5 Perl programmers care about Perl enough to go to a meeting.
 
 I suspect this is a significant overestimate. My wild guess would
 be closer to 1 in 20.
 
That suggests there are around 1000 Perl programmers in the London area.
  
The London catchment area covers approx one fifth of the UK population.
 
 Yes, but IT jobs are not evenly distributed over the UK - I would guess
 there's a significant bias towards the south-east and London, even more
 so than the greater population density would imply.
 
 Your final numbers look very high to me, but I don't have the data to
 argue against them in detail. I suspect you're overestimating the
 productivity of the average programmer.
 
  amusing way of estimating?  CPAN must be a rich source of clues.
 
 I keep meaning to play around with sloccount and CPAN, generate some
 meaningless numbers on how long various CPAN modules took to write,
 and how long all of CPAN took to write. I believe someone on #perl
 has already done this, but I haven't seen detailed numbers.
 
 sloccount estimates that perl took about 120 person-years to write,
 IIRC.
 
 Michael


A possible way of analysing this would be to shread the whole of CPAN and then count 
the distinct MD5 checksums.

Any one want to have a try?

Paddy

 



[OT] accessors pragma

2003-09-16 Thread Steve Purkis
Hi all,

With the help of others, I've been bashing out an 'accessors' pragma[1]:

	use accessors qw( foo bar baz );

There are two popular styles of accessor I'd like to support:

# classic:
print I set foo! if $obj-foo( $a_value );
# chaining:
$obj-foo( $a_value )
-bar( $another_value );
Question is: what style should be the default?  I'm not looking for a 
debate here, just some numbers.  If you don't wanna post to the list, 
reply to me directly.

The other will likely end up as a sub-class:

use accessors::classic qw( foo bar baz );
use accessors::chained qw( foo bar baz );
or perhaps:

use accessors qw( foo bar baz :classic );
use accessors qw( foo bar baz :chained );
If you have a preference here, let me know.

PS: Apologies for the complete lack of non-perl content up there.  
How's this: I just read in Wired that Buffy was not 'tired' but 
'expired'?  Kinda sad they had to add that third column... I remember 
when the wired/tired thing was actually funny.

-Steve

[1] yes, yet another accessor generator.  difference is interface, and 
minimal feature creep.




Re: web testing

2003-09-16 Thread David Landgren
Paul Makepeace wrote:

Je 2003-09-16 11:32:44 +0100, Michael Stevens skribis:

Can anyone recommend any good software for automated testing of
websites? I'm hoping for something fairly simple that will record usage
of a website in a web-browser, and then can re-run that later and look
for inconsistencies.


I wrote something like this a couple of years ago. You would set the
browser to proxy through a piece of software that recorded cookies 
HTTP requests and then later replay then with a frames interface. At
each page you could then assign regexes/md5 tests to check that
consistency.
This sounds like something you could do with BoOK's HTTP::Proxy module.

David




Re: back to the 80's

2003-09-16 Thread Richard Atkinson
On Tue, 16 Sep 2003, Joel Bernstein wrote:

 Richard Atkinson, aka vortexion (or rga24, if you're a cambridge person)
 is a compsci type with special interests in 8-bit computers (and
 specifically the 8bit fm synthesis audio hardware they had) and old
 reel-to-reel tape machines. I'm pretty sure his website has a load of
 photos of his kit on them.

No website I'm afraid, Joel, but I do have a large collection which I am
gradually selling off on eBay! Steve, if you don't mind travelling to
Guildford, Surrey there's a fair number of unusual machines here from the
US, Japan and even Brazil, as well as old favourites like an Issue 1
Spectrum and a rather tatty-looking ZX80.

 I think Richard might like the book. You're welcome to buy me beer,
 though.

I'm rather partial to beer, myself. Having said that, you might find it
easier to license pictures off one of the existing computer collections on
the web, such as Stefan Walgenbach's at http://www.homecomputer.de/


Richard



Re: [OT] accessors pragma

2003-09-16 Thread Tom Insam
At 13:09 +0100 2003/09/16, Steve Purkis wrote:
Hi all,

With the help of others, I've been bashing out an 'accessors' pragma[1]:

	use accessors qw( foo bar baz );

There are two popular styles of accessor I'd like to support:

# classic:
print I set foo! if $obj-foo( $a_value );
# chaining:
$obj-foo( $a_value )
-bar( $another_value );
I've seen:

  print Old version of foo was  . $obj-foo( $new_foo );

(gtk, I think), and

  print New version of foo is now  . $obj-foo( $new_foo );

Having said that, I like chaining.

--
.tom


Re: back to the 80's

2003-09-16 Thread Luis Campos de Carvalho
Jason Clifford wrote:
On Mon, 15 Sep 2003, Steve Keay wrote:


Does anyone happen to have a collection of old computers like BBC
micros, Commodore 64, ZX Spectrum, ZX 81, etc?  My g/f wants to
photograph them for a book being published for the Reader's Digest as
well as an annual price guide for lunatics that collect things.


The British Computer Museum at Bletchley Park have quite a good collection 
of old personal computer equipment including, I think, all of the above.
Shevek wrote about his collection:
(..)This includes most of the Sinclairs including two unique modded QLs (1983,
32 bit, 1Mb+ of RAM, wahey), a C64, a YD8100 (the only one still existing,
I think, but it's 1970 so predates your target), Apple II, an Electron,
some incomplete Apple III stuff, an Atari, some Amigas, a CPC6128, and if
I get my finger out, Dragons, BBCs, a 380Z, Arcs, etc. I also have an EISA
system, some Suns, HPs, an RS6K, and probably access to a Dec3k, an Indy,
and erm. Some NCD stuff and if I'm lucky some random 68Ks.(...)
  So I'm inclined to conclude that Shevek lives at the British Computer 
Museum... ;-)
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Luis Campos de Carvalho is Computer Scientist,
  PerlMonk [SiteDocClan], Cascavel-pm Moderator,
  Unix Sys Admin  Certified Oracle DBA
  http://br.geocities.com/monsieur_champs/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




Re: [OT] accessors pragma

2003-09-16 Thread Steve Purkis
On Tuesday, September 16, 2003, at 01:27  pm, Tom Insam wrote:

At 13:09 +0100 2003/09/16, Steve Purkis wrote:
Hi all,

With the help of others, I've been bashing out an 'accessors' 
pragma[1]:

	use accessors qw( foo bar baz );

There are two popular styles of accessor I'd like to support:

# classic:
print I set foo! if $obj-foo( $a_value );
# chaining:
$obj-foo( $a_value )
-bar( $another_value );
I've seen:

  print Old version of foo was  . $obj-foo( $new_foo );

(gtk, I think), and

  print New version of foo is now  . $obj-foo( $new_foo );
This is the 'classic' style I had in mind.


Having said that, I like chaining.
Duly noted.

Ta for that,
-Steve



Re: [OT] accessors pragma

2003-09-16 Thread Shevek
On Tue, 16 Sep 2003, Steve Purkis wrote:

 Hi all,
 
 With the help of others, I've been bashing out an 'accessors' pragma[1]:
 
   use accessors qw( foo bar baz );
 
 There are two popular styles of accessor I'd like to support:
 
   # classic:
   print I set foo! if $obj-foo( $a_value );
 
   # chaining:
   $obj-foo( $a_value )
   -bar( $another_value );

This whole chained accessors thing is a definite perl-ism and will do you 
no favours with people for whom Perl is not a primary language.

Possible return values for write-accessors:

true/false
undef/error message
the previous value
the new value
[I would never have considered the object itself a valid return value 
until I saw Perl people doing it. I still don't.]

 Question is: what style should be the default?  I'm not looking for a 
 debate here, just some numbers.  If you don't wanna post to the list, 
 reply to me directly.

I tend to use a simple true/false, except in complex cases where I return
undef or an error message. There's no point putting any effort into giving
the programmer something he already has. All of the other options fall 
into this category [object, new value, previous value].

S.

-- 
Shevekhttp://www.anarres.org/
I am the Borg. http://www.gothnicity.org/



Re: back to the 80's

2003-09-16 Thread Shevek
On Tue, 16 Sep 2003 [EMAIL PROTECTED] wrote:

 On Tue, Sep 16, 2003 at 01:07:12AM +0100, Shevek wrote:
  Other random amusements include a PC with nearly 250 CD-ROMs. *snigger*
  It's kind of rackmounted...
 
 Wow, are they all connected?  (128 channel ide controllers can't be
 *that* expensive).

Yes. I made the BIOS shit itself by putting all the SCSI cards and the 
network card and the mouse on the same IRQ. It's very, very rackmount.

 I had great fun with our ten racks of linux servers by doing eject;
 eject -t (cup holder pops out, then back in again).  By doing this on
 all the servers in quick succesion you get a kind of mexican wave
 going.  Really quite spooky when it happens in a deserted data centre.
 Don't tell anyone though.  Doh, this list isn't archived anywhere,
 right?

When I got my NAS systems, I discovered that they each had 12 LEDs on the
front, and by appropriately hitting the SMBus, the network cards, the
SMBus again, and the tristates and I/O for each disk in turn, I could do a
mexican wave on the lights. Nowadays the lights are mostly on all the time
so I have less fun. I have to play with the lights on the switch instead. 
It's fun being able to query the front panel LEDs using SNMP.

S.

-- 
Shevekhttp://www.anarres.org/
I am the Borg. http://www.gothnicity.org/



Re: web testing

2003-09-16 Thread Andy Lester
This sounds like something you could do with BoOK's HTTP::Proxy module.

Linda Lee Julien has written HTTP::Recorder that goes thru 
HTTP::Proxy to keep track of you actions, and then generates 
WWW::Mechanize scripts for you.

xoa

--
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance


Re: [OT] accessors pragma

2003-09-16 Thread David Cantrell
On Tue, Sep 16, 2003 at 02:18:57PM +0100, Steve Purkis wrote:
 On Tuesday, September 16, 2003, at 01:27  pm, Tom Insam wrote:
  Having said that, I like chaining.
 Duly noted.

So do I.  I have recently fallen in love with Scalar::Properties (thanks
Marcel!) and do stuff like ...

return 0-reason(ERR_BAD_PARAM)-details('foo')
  unless($params{foo}  $params{foo}-isa('Foo'));

-- 
Grand Inquisitor David Cantrell | http://www.cantrell.org.uk/david

Considering the number of wheels Microsoft has found reason
to invent, one never ceases to be baffled by the minuscule
number whose shape even vaguely resembles a circle.
  -- anon, on Usenet



Surrey.pm (was: back to the 80's)

2003-09-16 Thread Andy Wardley
Richard Atkinson wrote:
 If you don't mind travelling to Guildford, Surrey 
[...]
 I'm rather partial to beer, myself. 

I live in Guildford, Surrey and I'm also rather partial to beer.
I think it must be time to organise the second ever Surrey.pm 
meeting.

A




Re: web testing

2003-09-16 Thread Chris Devers
On Tue, 16 Sep 2003, Michael Stevens wrote:

 On Tue, Sep 16, 2003 at 11:57:42AM +0100, Paul Makepeace wrote:
  The proxy neatly (IMO) got around the problem of rewriting URLs,
  cookies, and JavaScript. I thought quite hard about this and couldn't
  see a non-proxy way of doing it. (Bueller?)
 
  Is that the sort of thing you're talking about? Are you looking for
  an online service or tarball? I'm heading toward implementing the
  former route.

 Yeah, that's the sort of thing. Prefer a a piece of software I can
 install. I've used expensive commercial windows stuff which will do this
 by automating IE, which I'd rather avoid.

I was doing something similar to this for Zope testing a few months ago.
It was the same basic idea: run a little proxy daemon, then point your
browser[s] at it. For each request, it would generate a .in  a .out file
with the contents of the HTTP request  response. Then there was another
tool that could play back those input  output files looking for relevant
patterns in the data stream.

One insight that the programmer I was working with had was to use XPath to
aid in parsing the responses.  It was more robust than regex matching, but
slightly less complex than parsing out everything by hand; basically, it
allowed us to say there's going to be a string wrapped in a foo tag,
and the foo tag will be nested under bar, baz, and blimey.  If
that last one is nested in anything else, we don't care.

In most cases, this was good enough to zoom on exactly on what was needed.


The system was written in a mix of Bourne shell  Python code, but most of
the elements were pretty self contained and I see no reason why it
wouldn't have cooperated with anything written in Perl or most other
languages.  I don't *think* I have a copy anymore, but it may be possible
to find it somewhere on zope.org -- look for 'ftrunner' / 'utrunner'.


Around the time I was working on this, there was a talk at Boston.pm about
WWW::Mechanize, which seemed very complimentary to these tools. That might
be something worth looking into.

I think the proxy is the important bit though: if you can get that to
work, and it can record all the data in a useful format, then you can use
whatever tools you like to analyze the results.



-- 
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

np: 'Ma Muse M´amuse'
 by Rabih Abou-Khalil
 from 'The Cactus Of Knowledge'



Re: [OT] accessors pragma

2003-09-16 Thread Robin Berjon
Shevek wrote:
This whole chained accessors thing is a definite perl-ism and will do you 
no favours with people for whom Perl is not a primary language.

Possible return values for write-accessors:

true/false
undef/error message
the previous value
the new value
[I would never have considered the object itself a valid return value 
	until I saw Perl people doing it. I still don't.]
Bah. I've seen Java code doing it. I've seen EcmaScript code doing it. SmallTalk 
does it pretty much all the time. Besides, I like it :)

--
Robin Berjon [EMAIL PROTECTED]
Research Scientist, Expway  http://expway.com/
7FC0 6F5F D864 EFB8 08CE  8E74 58E6 D5DB 4889 2488



Re: [OT] accessors pragma

2003-09-16 Thread David Cantrell
On Tue, Sep 16, 2003 at 02:44:25PM +0100, Shevek wrote:

 This whole chained accessors thing is a definite perl-ism and will do you 
 no favours with people for whom Perl is not a primary language.

I see similar method chaining in Java.

poing = foo.convert_to_bar().do_stuff_to_object().convert_to_string();

-- 
Lord Protector David Cantrell  |  http://www.cantrell.org.uk/david

I often think that if we Brits had any gratitude in our hearts, we
would put up a statue to Heinz Guderian - who probably saved us from
ruin by booting our Army off the continent before we could do
ourselves real harm.
   -- Mike Stone, in soc.history.what-if



Re: [OT] accessors pragma

2003-09-16 Thread Steve Purkis
On Tuesday, September 16, 2003, at 02:44  pm, Shevek wrote:

On Tue, 16 Sep 2003, Steve Purkis wrote:

Hi all,

With the help of others, I've been bashing out an 'accessors' 
pragma[1]:

	use accessors qw( foo bar baz );

There are two popular styles of accessor I'd like to support:

# classic:
print I set foo! if $obj-foo( $a_value );
# chaining:
$obj-foo( $a_value )
-bar( $another_value );
This whole chained accessors thing is a definite perl-ism and will do 
you
no favours with people for whom Perl is not a primary language.
AFAIK, it was stolen from Smalltalk...


Possible return values for write-accessors:

true/false
undef/error message
the previous value
the new value
[I would never have considered the object itself a valid return value
until I saw Perl people doing it. I still don't.]
Question is: what style should be the default?  I'm not looking for a
debate here, just some numbers.  If you don't wanna post to the list,
reply to me directly.
I tend to use a simple true/false, except in complex cases where I 
return
undef or an error message. There's no point putting any effort into 
giving
the programmer something he already has. All of the other options fall
into this category [object, new value, previous value].
I see your point, but I also think it's very much up to the 
individual..  which is why I tread carefully to avoid a style war ;)

Thanks for the feedback,
-Steve



Re: [OT] accessors pragma

2003-09-16 Thread Andy Wardley
Steve Purkis wrote:
   # chaining:
   $obj-foo( $a_value )
   -bar( $another_value );

I recognise how useful this can be but I'm not a fan of it.
IMHO, the foo() method of an object should return the foo of 
the object.  It shouldn't magically switch to returning the 
object itself just because you passed a parameter.  

Of course you can argue that it shouldn't magically switch
from getting to setting based on there being a parameter or
not, but that doesn't bother me so much.  They are both operations
on the foo of the object and the method name doesn't make any 
implication about what kind of operation.  The only implication
is that you'll get the foo returned back when called.

On the other hand, I find it quite acceptable to have get_foo() 
that returns the foo, and set_foo($new_value) which sets the 
new value for foo and returns the object.  In this case, the 
action is explicit in the method name.  

  # this is when chaining is good, IMHO
  $obj-set_foo(10)-set_bar(20)-set_baz(30);

 Question is: what style should be the default?  I'm not looking for a 
 debate here, 

Ooops, sorry.

If you just want numbers, then I'm for classic.  I like chainability,
but only if the accessor is prefixed with 'set_' or something similar.
The foo() should always return the foo(), IMHO.  If it doesn't then
chainability is broken for accessing items.

  # why chaining is bad, IMHO
  $book-author()-name();   # author.name
  $book-author($a)-name(); # book.name

One returns the author name, the other returns the book name.  And what
if $a is undef?  Does that return the book name or author name?  

Oops, sorry.  No debate.  I forgot.

 If you have a preference here, let me know.

Dark chocolate and raspberry wheat ale.  :-)

A




Re: back to the 80's

2003-09-16 Thread Mark Overmeer
* Luis Campos de Carvalho ([EMAIL PROTECTED]) [030916 15:37]:
 Jason Clifford wrote:
  On Mon, 15 Sep 2003, Steve Keay wrote:
 Does anyone happen to have a collection of old computers like BBC
 micros, Commodore 64, ZX Spectrum, ZX 81, etc?  My g/f wants to
 photograph them for a book being published for the Reader's Digest as
 well as an annual price guide for lunatics that collect things.

See http://www.belgers.com/computers/
-- 
   MarkOv


drs Mark A.C.J. OvermeerMARKOV Solutions
   [EMAIL PROTECTED]  [EMAIL PROTECTED]
http://Mark.Overmeer.net   http://solutions.overmeer.net



Re: Surrey.pm (was: back to the 80's)

2003-09-16 Thread Richard Atkinson
On Tue, 16 Sep 2003, Andy Wardley wrote:

 I live in Guildford, Surrey and I'm also rather partial to beer.
 I think it must be time to organise the second ever Surrey.pm
 meeting.

But /are/ there any decent real ale pubs in Guildford? It's all trendy
wine bars these days, from what I've seen. Oh how my heart pines for the
Penderel's, the Knight's Templar or the Calthorpe :(

(Though I am definitely agreed in principle on a surrey.pm meet)


Richard



Re: [OT] accessors pragma

2003-09-16 Thread Paul Makepeace
Je 2003-09-16 15:40:45 +0100, David Cantrell skribis:
 On Tue, Sep 16, 2003 at 02:44:25PM +0100, Shevek wrote:
 
  This whole chained accessors thing is a definite perl-ism and will do you 
  no favours with people for whom Perl is not a primary language.
 
 I see similar method chaining in Java.
 
 poing = foo.convert_to_bar().do_stuff_to_object().convert_to_string();

I don't think chaining per se is under discussion, rather accessors
that chain.

Are any of those methods in your example accessors?

Paul what Andy said M.

-- 
Paul Makepeace ... http://paulm.com/

If the moon is a balloon, then it would be ruined for everyone.
   -- http://paulm.com/toys/surrealism/



Re: [OT] accessors pragma

2003-09-16 Thread Shevek
On Tue, 16 Sep 2003, David Cantrell wrote:

 On Tue, Sep 16, 2003 at 02:44:25PM +0100, Shevek wrote:
 
  This whole chained accessors thing is a definite perl-ism and will do you 
  no favours with people for whom Perl is not a primary language.
 
 I see similar method chaining in Java.
 
 poing = foo.convert_to_bar().do_stuff_to_object().convert_to_string();

In this case, I don't see that foo.convert_to_bar() is returning foo. I 
don't claim that method chaining is wrong. I claim that method chaining 
when equivalent to foo.a(); foo.b(); is unpleasant and unnecessary.

David Cantrell attempted to pronounce:

 return 0-reason(ERR_BAD_PARAM)-details('foo')

Case in point. This is an ugly neo-perlism. I like the freedom of Perl,
but this kind of thing does it no favours. It increases effort for the
maintainer, but makes no immediate saving whatsoever. It's syntax for the
purpose of syntax. It's in violation of the KISS rule.

I tell my students that one of the important things when writing code is
to write the code that your maintainer expects to see unless you have a 
very good reason for doing otherwise. This reduces maintenance costs.

S.

-- 
Shevekhttp://www.anarres.org/
I am the Borg. http://www.gothnicity.org/



Re: [OT] accessors pragma

2003-09-16 Thread Steve Purkis
On Tuesday, September 16, 2003, at 03:37  pm, David Cantrell wrote:

On Tue, Sep 16, 2003 at 02:18:57PM +0100, Steve Purkis wrote:
On Tuesday, September 16, 2003, at 01:27  pm, Tom Insam wrote:
Having said that, I like chaining.
Duly noted.
So do I.  I have recently fallen in love with Scalar::Properties 
(thanks
Marcel!) and do stuff like ...

return 0-reason(ERR_BAD_PARAM)-details('foo')
  unless($params{foo}  $params{foo}-isa('Foo'));
Yikes!
*steve hides*
Sounds like a bit of XS magic going on there...

-Steve




Re: Surrey.pm (was: back to the 80's)

2003-09-16 Thread Bob Walker
On Tue, 16 Sep 2003, Richard Atkinson wrote:

 On Tue, 16 Sep 2003, Andy Wardley wrote:

  I live in Guildford, Surrey and I'm also rather partial to beer.
  I think it must be time to organise the second ever Surrey.pm
  meeting.

 But /are/ there any decent real ale pubs in Guildford? It's all trendy
 wine bars these days, from what I've seen. Oh how my heart pines for the
 Penderel's, the Knight's Templar or the Calthorpe :(
the white house down by the river.
the three pidgeons should still be okay.
or of course you could go to the red lion in godalming.




 (Though I am definitely agreed in principle on a surrey.pm meet)


 Richard



-- 
Bob Walker
http://www.randomness.org.uk/
3 s.f that is the accuracy of the number of the beast



Re: [OT] accessors pragma

2003-09-16 Thread Paul Makepeace
Je 2003-09-16 15:37:49 +0100, David Cantrell skribis:
 return 0-reason(ERR_BAD_PARAM)-details('foo')
   unless($params{foo}  $params{foo}-isa('Foo'));

WTF is that?! If I saw this in a forest I'd shoot it first, assuming it
was more likely going to kill me than not.

P

-- 
Paul Makepeace ... http://paulm.com/

If the sun quacks, then grab your coathanger!
   -- http://paulm.com/toys/surrealism/



Re: [OT] accessors pragma

2003-09-16 Thread Shevek
On Tue, 16 Sep 2003, Paul Makepeace wrote:

 Je 2003-09-16 15:37:49 +0100, David Cantrell skribis:
  return 0-reason(ERR_BAD_PARAM)-details('foo')
unless($params{foo}  $params{foo}-isa('Foo'));
 
 WTF is that?! If I saw this in a forest I'd shoot it first, assuming it
 was more likely going to kill me than not.

Actually, I note that you're also allowed to call methods on null in Java:

public class Test {

public static void main(String[] args) {
((Test)null).new InnerClass();
}

private class InnerClass {
private InnerClass() {
System.out.println(Foobar);
}
}
}

I would credit who wrote this, but I'm not sure if he'd want it known.

*snigger*

S.

-- 
Shevekhttp://www.anarres.org/
I am the Borg. http://www.gothnicity.org/



Re: [OT] accessors pragma

2003-09-16 Thread Steve Purkis
On Tuesday, September 16, 2003, at 02:53  pm, Andy Wardley wrote:

Steve Purkis wrote:
# chaining:
$obj-foo( $a_value )
-bar( $another_value );
I recognise how useful this can be but I'm not a fan of it.
IMHO, the foo() method of an object should return the foo of
the object.  It shouldn't magically switch to returning the
object itself just because you passed a parameter.
Of course you can argue that it shouldn't magically switch
from getting to setting based on there being a parameter or
not, but that doesn't bother me so much.  They are both operations
on the foo of the object and the method name doesn't make any
implication about what kind of operation.  The only implication
is that you'll get the foo returned back when called.
On the other hand, I find it quite acceptable to have get_foo()
that returns the foo, and set_foo($new_value) which sets the
new value for foo and returns the object.  In this case, the
action is explicit in the method name.
  # this is when chaining is good, IMHO
  $obj-set_foo(10)-set_bar(20)-set_baz(30);
Question is: what style should be the default?  I'm not looking for a
debate here,
Ooops, sorry.

If you just want numbers, then I'm for classic.  I like chainability,
but only if the accessor is prefixed with 'set_' or something similar.
The foo() should always return the foo(), IMHO.  If it doesn't then
chainability is broken for accessing items.
  # why chaining is bad, IMHO
  $book-author()-name();   # author.name
  $book-author($a)-name(); # book.name
One returns the author name, the other returns the book name.  And what
if $a is undef?  Does that return the book name or author name?
Oops, sorry.  No debate.  I forgot.
;-)

I see your point, but like I've said before, methinks this is a style 
issue.  I'm trying to find out which style most people prefer so the 
majority of people can benefit from the module.

But you bring up some points I've gotta answer -- first off, 'set_'  
'get_' don't seem to be too popular (laziness?) so unless people prove 
me wrong here, they're out for accessors.pm. [1]

Secondly, with the current implementation an 'undef' argument will 
trigger a set for both 'classic' and 'chained' accessors:

	$book-author($a); # still sets when $a = undef

If you pass an empty list, it will act as a get and your original code 
would prolly break:

	$book-author(@a)-name; # buggy code if @a = ()!


If you have a preference here, let me know.
Dark chocolate and raspberry wheat ale.  :-)
Mmm..  evil tempter..
Uppercanada used to do this maple beer that was really nice... digs 
around try:

	http://www.uppercanada.com/template.asp?CName=ATheBeer2

-Steve

[1] As a complete aside, I don't think 'get_' and 'set_' are bad ideas. 
 There's no reason reason someone couldn't write 'accessors::setget', 
or 'getters' and 'setters' pragmas.  Michael Schwern recently pointed 
me to Ruby's 'attr_reader' and 'attr_writer' shortcuts - see 
http://www.rubycentral.com/book/tut_classes.html




Class:DBI problems...

2003-09-16 Thread Graham Seaman
Hi,

A live site which has not been touched for some time has suddenly and
mysteriously started failing with error messages like:

Failure while doing 'SELECT issue_id, title, number, current
FROM   tableSite::Issue/table
WHERE   current = ? 
' with 'SearchSQL in Site::Issue'
DBD::mysql::st execute failed: You have an error in your SQL syntax near 
'tableSite::Issue/table
WHERE   current = '1' 
' at line 2 at /usr/lib/perl5/site_perl/5.6.1/Ima/DBI.pm line 735

grepping turns up nowhere at all that this table is being wrapped round
class names, let alone where it should be stripped out... and I've got 
kind of lost trying to track this through the rather convoluted structure
of Class::DBI and associated modules.

Can anyone hazard a guess as to what might have happened here (this is
Class:DBI 0.90 running on perl 5.6.1), or point me to a more appropriate
forum?

Sorry, no non-perl stuff :-(

Cheers
Graham

 




Re: back to the 80's

2003-09-16 Thread Tony Bowden
On Tue, Sep 16, 2003 at 09:27:46AM +0100, Iain Tatch wrote:
 There's a ZX81 in our server room at work.

There was a shelf at BlackStar, underneath the shelf marked Cables,
and beside the shelf marked Mice, marked ZX80s.

And, yes, it was occupied...

Tony



Re: Class:DBI problems...

2003-09-16 Thread Tony Bowden
On Tue, Sep 16, 2003 at 06:15:19PM +0100, Graham Seaman wrote:
 Failure while doing 'SELECT issue_id, title, number, current
 FROM   tableSite::Issue/table
 WHERE   current = ? 
 ' with 'SearchSQL in Site::Issue'
 DBD::mysql::st execute failed: You have an error in your SQL syntax near 
 'tableSite::Issue/table
 WHERE   current = '1' 
 ' at line 2 at /usr/lib/perl5/site_perl/5.6.1/Ima/DBI.pm line 735
 grepping turns up nowhere at all that this table is being wrapped round
 class names, let alone where it should be stripped out... and I've got 
 kind of lost trying to track this through the rather convoluted structure
 of Class::DBI and associated modules.

There's nothing in Class::DBI or Ima::DBI that should be doing this.
That said, Class::DBI 0.90 is rather old now, and how all this works has
changed significantly in the last year ...

My main guess would be that $class-table somehow is returning
tableSite::Issue/table. Would that be true?

 Can anyone hazard a guess as to what might have happened here (this is
 Class:DBI 0.90 running on perl 5.6.1), or point me to a more appropriate
 forum?

The Class::DBI list may be able to help you better ...

Tony




Re: web testing

2003-09-16 Thread Philippe 'BooK' Bruhat
Le mardi 16 septembre 2003 à 09:25, Andy Lester écrivait:
 This sounds like something you could do with BoOK's HTTP::Proxy module.
 
 
 Linda Lee Julien has written HTTP::Recorder that goes thru 
 HTTP::Proxy to keep track of you actions, and then generates 
 WWW::Mechanize scripts for you.

Wow! That's exactly what I wanted to do with HTTP:Proxy when I started
the project. :-)

HTTP::Recorder might encounter a few problems when HTTP::Proxy 0.10
is out, since the filter API (and the push_filter() method) will change
a lot. I think I've found a better and more flexible API, and will stick
with it for a while.

http://http-proxy.mongueurs.net/ is the home of the module.

For those who want to try out the proxy and what it can do, reconfigure
your browsers to use home.bruhat.net port 8080 as a proxy.

UGGC::Cebkl ehyrf! ;-)

-- 
 Philippe BooK Bruhat

 For every winner, there must be one or more losers.
(Moral to the Sage story in Groo #111 (Epic))



Re: [OT] accessors pragma

2003-09-16 Thread David Cantrell
Shevek wrote:
On Tue, 16 Sep 2003, David Cantrell wrote:
I see similar method chaining in Java.
poing = foo.convert_to_bar().do_stuff_to_object().convert_to_string();
In this case, I don't see that foo.convert_to_bar() is returning foo. I 
don't claim that method chaining is wrong. I claim that method chaining 
when equivalent to foo.a(); foo.b(); is unpleasant and unnecessary.
I saw what you meant after I'd posted.  I still disagree with you.

return 0-reason(ERR_BAD_PARAM)-details('foo')
Case in point. This is an ugly neo-perlism. I like the freedom of Perl,
but this kind of thing does it no favours. It increases effort for the
maintainer, but makes no immediate saving whatsoever. It's syntax for the
purpose of syntax. It's in violation of the KISS rule.
Ugliness is in the eye of the beholder.

When I'm programming in perl, I will program using a perlish idiom. 
When programming in $other_language I will try to use the 
other_languageish idiom.

I simply have to disagree that it increases effort for the maintainer. 
Sure, to understand that line, you have to understand that I'm using 
Scalar::Properties.  But then, you have to understand what 
Scalar::Properties does if you're going to understand the whole thing, 
not just to understand that one line.  My documentation makes it very 
clear that I'm using that.

I tell my students that one of the important things when writing code is
to write the code that your maintainer expects to see unless you have a 
very good reason for doing otherwise. This reduces maintenance costs.
You won't get any argument from me there.  I see nothing particularly 
unexpected about what I'm doing, nothing which the maintainer couldn't 
be expected to understand after reading the documentation.

--
David Cantrell | Reality Engineer, Ministry of Information
If you have received this email in error, please add some nutmeg
and egg whites, whisk, and place in a warm oven for 40 minutes.



Re: [OT] accessors pragma

2003-09-16 Thread David Cantrell
Paul Makepeace wrote:
Je 2003-09-16 15:37:49 +0100, David Cantrell skribis:
return 0-reason(ERR_BAD_PARAM)-details('foo')
 unless($params{foo}  $params{foo}-isa('Foo'));
WTF is that?! If I saw this in a forest I'd shoot it first, assuming it
was more likely going to kill me than not.
Something which makes perfect sense when read in conjunction with the 
documentation.  What, exactly, do you find difficult about it?

--
David Cantrell | Reality Engineer, Ministry of Information
  It would be reasonable to judge cannabis less of a threat to health
  than alcohol or tobacco ... this should be borne in mind by social
  legislators who, disapproving of other people's indulgences, seek
  to make them illegal.
-- The Lancet, Volume 352, Number 9140, 14 November 1998



Re: web testing

2003-09-16 Thread Philippe 'BooK' Bruhat
Le mardi 16 septembre 2003 à 20:42, Philippe 'BooK' Bruhat écrivait:
 Le mardi 16 septembre 2003 à 09:25, Andy Lester écrivait:
  This sounds like something you could do with BoOK's HTTP::Proxy module.
  
  
  Linda Lee Julien has written HTTP::Recorder that goes thru 
  HTTP::Proxy to keep track of you actions, and then generates 
  WWW::Mechanize scripts for you.
 
 Wow! That's exactly what I wanted to do with HTTP:Proxy when I started
 the project. :-)

The very intersting part being that she didn't use any filter.
She's actually using a modified agent to be used by the proxy.
Very clever. The HTTP::Recorder agent can probably be used in
other ways.

I predict that HTTP::Recorder will work well with further versions of
HTTP::Proxy. :-)

-- 
 Philippe BooK Bruhat

 When you create a climate of peace, you have only fair weather.
 But where the climate is one of violence, it can only rain blood.
   (Moral from Groo The Wanderer #120 (Epic))



Re: [OT] accessors pragma

2003-09-16 Thread Shevek
On Tue, 16 Sep 2003, David Cantrell wrote:

 Paul Makepeace wrote:
  Je 2003-09-16 15:37:49 +0100, David Cantrell skribis:
 return 0-reason(ERR_BAD_PARAM)-details('foo')
   unless($params{foo}  $params{foo}-isa('Foo'));
  WTF is that?! If I saw this in a forest I'd shoot it first, assuming it
  was more likely going to kill me than not.
 
 Something which makes perfect sense when read in conjunction with the 
 documentation.  What, exactly, do you find difficult about it?

The very fact that one has to resort to the documentation to discover that
this is just an assbackwards way of doing something perfectly simple. That
in itself quite clearly increases effort for the maintainer, in
contradiction of your earlier mail.

S.

-- 
Shevekhttp://www.anarres.org/
I am the Borg. http://www.gothnicity.org/



Re: [OT] accessors pragma

2003-09-16 Thread David Cantrell
Shevek wrote:
On Tue, 16 Sep 2003, David Cantrell wrote:
Paul Makepeace wrote:
WTF is that?! If I saw this in a forest I'd shoot it first, assuming it
was more likely going to kill me than not.
Something which makes perfect sense when read in conjunction with the 
documentation.  What, exactly, do you find difficult about it?
The very fact that one has to resort to the documentation to discover that
this is just an assbackwards way of doing something perfectly simple. That
in itself quite clearly increases effort for the maintainer, in
contradiction of your earlier mail.
As I already explained, I am using a particular module for reasons which 
I have documented.  I assume that the maintainer has RTFM.  I assume 
that they have read the documentation of any dependencies with which 
they are not familiar.  Where the dependencies are unusual (as in this 
case) I have made a point of highlighting them in the docs.  Therefore 
they will understand what is happening there.  They will understand both 
what that line does, and why I wrote it.

Or do you believe that documentation exists for the sake of 
documentation and for no useful purpose?

--
David Cantrell | Reality Engineer, Ministry of Information
Do not be afraid of cooking, as your ingredients will know and misbehave
   -- Fergus Henderson



Re: [OT] accessors pragma

2003-09-16 Thread Adrian Howard
On Tuesday, Sep 16, 2003, at 13:09 Europe/London, Steve Purkis wrote:
[snip]
If you have a preference here, let me know.
[snip]

I quite like chaining myself - but then I like Smalltalk too :-)

Adrian




Re: [OT] accessors pragma

2003-09-16 Thread Damian Conway
For what it's worth...

Perl 6 classes will autogenerate accessors that return the underlying 
attribute itself as an lvalue:

class DogTag {
has $.name is public;
has $.rank is public;
has $.serial is readonly;
has @.medals is public;

submethod BUILD ($id) { $.serial = $id }
method title () { return $.rank $.name }
}
	my $grunt = DogTag.new(71625371);

$grunt.name = Pyle;
$grunt.rank = Private;
	print $grunt.title ($grunt.serial)\n;

And Perl 6 supports chaining of accessors using $_ and the unary dot 
operator, not return values:

given $grunt {
.name = Patton;
.rank = General;
push .medals, Purple heart;
}
The closest equivalent Perl 5 would be:

package DogTag;

sub new {
my ($class, $id) = @_;
bless { name=undef, rank=undef, serial=$id, medals=[] },
  $class;
}
sub name : lvalue { $_[0]{name} }
sub rank : lvalue { $_[0]{rank} }
sub serial{ $_[0]{serial} }
sub medals{ $_[0]{medals} }
sub title { return $_[0]{rank} $_[0]{name} }

	package main;

	my $grunt = DogTag-new(71625371);

$grunt-name = Pyle;
$grunt-rank = Private;
	print $grunt-title,  (, $grunt-serial, )\n;

And for chaining:

for ($grunt) {
$_-name = Patton;
$_-rank = General;
push @{$_-medals}, Purple heart;
}
Damian	




Re: [OT] accessors pragma

2003-09-16 Thread Randal L. Schwartz
 Steve == Steve Purkis [EMAIL PROTECTED] writes:

 I've seen:
 
 print Old version of foo was  . $obj-foo( $new_foo );
 
 (gtk, I think), and
 
 print New version of foo is now  . $obj-foo( $new_foo );

Steve This is the 'classic' style I had in mind.

Then your naming is odd.  I thought classic returned $new_foo,
not $old_foo.



-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!