From stephen.m.baker at intel.com Tue Sep 3 12:36:06 2002 From: stephen.m.baker at intel.com (Baker, Stephen M) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's Message-ID: <288F9BF66CD9D5118DF400508B68C446020DA726@orsmsx113.jf.intel.com> I need to parse quickly through a file of the following format: heading1: data1.1 heading2: data2.1 heading3: data3.1 heading1: data1.2 heading2: data2.2 heading3: data3.2 heading1: data1.3 heading2: data2.3 heading3: data3.3 to populate a data structure. Is regular expressions the way to go about this? OR does somebody have a trick for how this might be done? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at tensegrity.net Tue Sep 3 14:38:20 2002 From: jimfl at tensegrity.net (Jim Flanagan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's In-Reply-To: <288F9BF66CD9D5118DF400508B68C446020DA726@orsmsx113.jf.intel.com> Message-ID: On Tue, 3 Sep 2002, Baker, Stephen M wrote: > > I need to parse quickly through a file of the following format: > > heading1: data1.1 > heading2: data2.1 > heading3: data3.1 > > heading1: data1.2 > heading2: data2.2 > heading3: data3.2 > > heading1: data1.3 > heading2: data2.3 > heading3: data3.3 > > to populate a data structure. Is regular expressions the way to go about > this? OR does somebody have a trick for how this might be done? Since it appears that the pattern is simple, you can use split here. use FileHandle; my %datahash; my $fh = new FileHandle(") { next if $line =~ /^$/; my ($k, $v) = split(/:\s+/, $line); die "Error in datafile\n" unless data_seems_reasonable($k, $v); push @{$datahash{$v}}, $v; } close $fh; do_something_with($datahash{heading1}->[0]); for my $h2 (@{$datahash{heading2}}) { do_something_else($h2) } -- Flanagan::Jim http://jimfl.tensegrity.net mailto:jimfl%40t%65ns%65gr%69ty.n%65t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cansubaykan at hotmail.com Tue Sep 3 14:40:14 2002 From: cansubaykan at hotmail.com (John Subaykan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's Message-ID: Once you open the file and assign a filehandle (FH), you can do something like this: while () { next unless /\S/; # skip empty lines my ($one,$two) = split /\s*:\s*/; chomp($two); # trailing space; print "ONE: $one TWO: $two\n"; # now you can do whatever you want with $one and $two # like make a hash $data{$one} = $two etc.. } if you want to capture 3 elements like 'heading1' and 'data1' and '1' : while () { next unless /\S/; # this is general, you can make it more specific by including # literal values like 'heading' or 'data' my ($h, $d, $n) = /(\w+)\s*:\s*(\w+)\.(\w+)/; print "H: $h D: $d N: $n\n"; } you can do more complicated pattern matching as needed, based on your data. Hope that helps. ----Original Message Follows---- From: "Baker, Stephen M" To: "'spug-list@pm.org'" Subject: SPUG: reg exp's Date: Tue, 3 Sep 2002 10:36:06 -0700 I need to parse quickly through a file of the following format: heading1: data1.1 heading2: data2.1 heading3: data3.1 heading1: data1.2 heading2: data2.2 heading3: data3.2 heading1: data1.3 heading2: data2.3 heading3: data3.3 to populate a data structure. Is regular expressions the way to go about this? OR does somebody have a trick for how this might be done? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Tue Sep 3 17:31:02 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's References: <288F9BF66CD9D5118DF400508B68C446020DA726@orsmsx113.jf.intel.com> Message-ID: On Tue, 3 Sep 2002 10:36:06 -0700 , stephen.m.baker@intel.com wrote: >I need to parse quickly through a file of the following format: [snip] >to populate a data structure. Is regular expressions the way to go about >this? OR does somebody have a trick for how this might be done? You don't say what the data structure should look like, but you might try something like this: ============================== use strict; use warnings; my $data; $/ = ''; # read in a paragraph at a time while () { push @$data, { split /:\s*(.*)\n+/ } } use Data::Dumper; print Dumper($data); __DATA__ heading1: data1.1 heading2: data2.1 heading3: data3.1 heading1: data1.2 heading2: data2.2 heading3: data3.2 heading1: data1.3 heading2: data2.3 heading3: data3.3 ============================== (I hope you aren't a consultant for Intel...) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at tensegrity.net Tue Sep 3 18:18:45 2002 From: jimfl at tensegrity.net (Jim Flanagan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's In-Reply-To: Message-ID: On Tue, 3 Sep 2002, Jim Flanagan wrote: > push @{$datahash{$v}}, $v; There is an error in my example. That line should read push @{$datahash{$k}}, $v; -- Flanagan::Jim http://jimfl.tensegrity.net mailto:jimfl%40t%65ns%65gr%69ty.n%65t - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jgardn at alumni.washington.edu Tue Sep 3 21:42:35 2002 From: jgardn at alumni.washington.edu (Jonathan Gardner) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's In-Reply-To: <288F9BF66CD9D5118DF400508B68C446020DA726@orsmsx113.jf.intel.com> References: <288F9BF66CD9D5118DF400508B68C446020DA726@orsmsx113.jf.intel.com> Message-ID: <200209031942.35188.jgardn@alumni.washington.edu> On Tuesday 03 September 2002 10:36 am, Baker, Stephen M wrote: > I need to parse quickly through a file of the following format: > > heading1: data1.1 > heading2: data2.1 > heading3: data3.1 > > heading1: data1.2 > heading2: data2.2 > heading3: data3.2 > > heading1: data1.3 > heading2: data2.3 > heading3: data3.3 > #!/usr/bin/perl -w use strict; while (<>) { /^(.*?):(.*)$/; my $heading = $1; my $data = $2; ... do your stuff ... } -- Jonathan Gardner jgardn@alumni.washington.edu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ced at carios2.ca.boeing.com Wed Sep 4 21:17:07 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's Message-ID: <200209050217.TAA06372@carios2.ca.boeing.com> > while (<>) { > /^(.*?):(.*)$/; > my $heading = $1; > my $data = $2; > ... do your stuff ... > } Be careful to test for regex success though. If there were no match [an embedded blank line somewhere within valid data for instance], $1, etc will be undefined. if (/^(.*?):(.*)/) { ... } Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Wed Sep 4 22:30:29 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E710A@wacorpml03.wwireless.com> Ok, gotta add my two cents. Some of the other solutions won't work because heading1 in group one will get overwritten by heading 1 in group 2 and then on to three etc. In my opinion the best data structure for this situation would be an array of hash refs. Each hash ref is it's own group. Each group is terminated in the file by a single blank line. So here's my code. This will even make sure that multiple newlines between groups or at the end of the file won't cause multiple hasrefs with the single key 'undef' :) --BEGIN-- #!/usr/bin/perl use strict; use Data::Dumper qw(Dumper); $ARGV[0] or die "Usage: $0 /path/to/data/file\n"; open(IN,$ARGV[0]) or die "Couldn't open $ARGV[0]: $!\n"; my @shiznit = ({}); # Make sure to initialize since we work on upper boundary my $last_is_blank = 0; while(chomp($_ = )) { if(/^\s*$/) { $last_is_blank = 1; next; } my($key,$val) = split(/:\s/); if($last_is_blank) { push @shiznit,{ $key => $val }; } else { $shiznit[$#shiznit]->{$key} = $val; } $last_is_blank = 0; } print Dumper(\@shiznit); --END-- -- Ryan Parr -----Original Message----- From: Baker, Stephen M [mailto:stephen.m.baker@intel.com] Sent: Tuesday, September 03, 2002 10:36 AM To: 'spug-list@pm.org' Subject: SPUG: reg exp's I need to parse quickly through a file of the following format: heading1: data1.1 heading2: data2.1 heading3: data3.1 heading1: data1.2 heading2: data2.2 heading3: data3.2 heading1: data1.3 heading2: data2.3 heading3: data3.3 to populate a data structure. Is regular expressions the way to go about this? OR does somebody have a trick for how this might be done? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Thu Sep 5 16:21:19 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's References: <6D6F0541E2B1D411A75B0002A513016D082E710A@wacorpml03.wwireless.com> Message-ID: On Wed, 4 Sep 2002 20:30:29 -0700 , Ryan.Parr@wwireless.com wrote: >Ok, gotta add my two cents. Some of the other solutions won't work because >heading1 in group one will get overwritten by heading 1 in group 2 and then >on to three etc. I didn't see any that did that. >In my opinion the best data structure for this situation would be an array >of hash refs. Each hash ref is it's own group. Each group is terminated in >the file by a single blank line. > >So here's my code. This will even make sure that multiple newlines between >groups or at the end of the file won't cause multiple hasrefs with the >single key 'undef' :) Or that. Though yours gives an empty hashref if there are leading empty lines. >#!/usr/bin/perl >use strict; missing "use warnings" here. >while(chomp($_ = )) { With warnings enabled, you get a warning on the chomp. Put the chomp in the body: while () { chomp; > if(/^\s*$/) { > $last_is_blank = 1; > next; > } > > my($key,$val) = split(/:\s/); > if($last_is_blank) { > push @shiznit,{ $key => $val }; > } > else { > $shiznit[$#shiznit]->{$key} = $val; > } > $last_is_blank = 0; >} Other than that, yours does pretty much the same as mine: my $data; $/ = ''; # read in a paragraph at a time while () { push @$data, { split /:\s*(.*)\n+/ } } though for non-quick&dirty use I'd do something more like yours with user warning messages for bad data. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Thu Sep 5 20:54:15 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: reg exp's Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E710D@wacorpml03.wwireless.com> On Wed, 4 Sep 2002 20:30:29 -0700 , Ryan.Parr@wwireless.com wrote: >>Some of the other solutions won't work because >>heading1 in group one will get overwritten by heading 1 in group 2 and then >>on to three etc. >I didn't see any that did that. I should've added my standard disclaimer that incorrect rambling probabilities increase with my regularly scheduled crack ingenstion. >>In my opinion the best data structure for this situation would be an array >>of hash refs. Each hash ref is it's own group. Each group is terminated in >>the file by a single blank line. >> >>So here's my code. This will even make sure that multiple newlines between >>groups or at the end of the file won't cause multiple hasrefs with the >>single key 'undef' :) >Or that. Though yours gives an empty hashref if there are leading empty >lines. Damnit, you're right. >>#!/usr/bin/perl >>use strict; >missing "use warnings" here. Yeah... snip... >Other than that, yours does pretty much the same as mine: >my $data; >$/ = ''; # read in a paragraph at a time >while () { > push @$data, { split /:\s*(.*)\n+/ } >} I glanced at yours, missed where you split inside a hash ref, and that *you* were the one smoking crack. >though for non-quick&dirty use I'd do something more like yours >with user warning messages for bad data. Why though? Your's handles a little better. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Fri Sep 6 09:30:39 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: OO Perl object backrefrence question Message-ID: Friends, Another stupid question... I'm working on building a series of objects in a hierarchy that represents a survey. The survey object will hold page objects which will hold questions object, etc. I'm wondering if there is a standard way for an object to know what it's parent object is so I can pull properties from the parent instead of storing it in each child object. So, I want to be able to do something like $self->Parent->ClientName to get the client name of the survey a page object is part of. There are two ways that I can see of doing this, but they're both not great. The first would be to give the child a reference to the parent object to store in a parent property, but this has problems with circular references, and I'd probably have to do my own garbage collection. The other is to pass a string containing the name of the variable containing the parent object (i.e. "$Main::MySurvey") then use "no strict 'refs'; $$Parent->whatever()" to de-reference it when it needs to be used. This would keep garbage collection working, but wouldn't, I believe, be storable, because the name would likely be different next time the script is executed. Anyway, I was hoping that in addition to the normal messages letting me know that this is all a bad thing to do someone might have some advise on setting my objects up like this. :) Thanks, Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Fri Sep 6 10:23:42 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: OO Perl object backrefrence question Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E7110@wacorpml03.wwireless.com> There's an article by Matt Sergeant on Perl.com right now that covers exactly this. http://www.perl.com/pub/a/2002/08/07/proxyobject.html Basically it shows how to pass a parent object to a child without creating a circular reference. -- Ryan -----Original Message----- From: Peter Darley [mailto:pdarley@kinesis-cem.com] Sent: Friday, September 06, 2002 7:31 AM To: SPUG Subject: SPUG: OO Perl object backrefrence question Friends, Another stupid question... I'm working on building a series of objects in a hierarchy that represents a survey. The survey object will hold page objects which will hold questions object, etc. I'm wondering if there is a standard way for an object to know what it's parent object is so I can pull properties from the parent instead of storing it in each child object. So, I want to be able to do something like $self->Parent->ClientName to get the client name of the survey a page object is part of. There are two ways that I can see of doing this, but they're both not great. The first would be to give the child a reference to the parent object to store in a parent property, but this has problems with circular references, and I'd probably have to do my own garbage collection. The other is to pass a string containing the name of the variable containing the parent object (i.e. "$Main::MySurvey") then use "no strict 'refs'; $$Parent->whatever()" to de-reference it when it needs to be used. This would keep garbage collection working, but wouldn't, I believe, be storable, because the name would likely be different next time the script is executed. Anyway, I was hoping that in addition to the normal messages letting me know that this is all a bad thing to do someone might have some advise on setting my objects up like this. :) Thanks, Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Fri Sep 6 10:37:13 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: OO Perl object backrefrence question In-Reply-To: Message-ID: Umar, In this case I'm not inheriting, I'm using objects to hold info on it's self, as well as collections of other objects that make up a hierarchy. So, the page class isn't an inherited class of the survey class, the page objects are just included in a property of the survey object. There might be a structure like: [My::Survey=HASH(0x80f6459)] = {ClientName => 'The Client', Pages[1] => [My::Page=HASH(0x80f6460)] Pages[2] => [My::Page=HASH(0x80f6461)]} So, what I would like to be able to do is in the My::Page package be able to do something like $Self->Parent->{'ClientName'} and get back 'The Client'. I don't know if that makes any sence or not... Thanks, Peter Darley -----Original Message----- From: Umar Cheema [mailto:umar@drizzle.com] Sent: Friday, September 06, 2002 8:00 AM To: Peter Darley Subject: Re: SPUG: OO Perl object backrefrence question Hmmm. Maybe I am not understanding it correctly but if you're inheriting from the parent object wouldn't you be able to accomplish that by calling a method like $self->setClientName($client_name); from the page object and having the setClientName method placed in the parent object. Then you can simply call a getter method like $self->getClientName() which will simply return the client name from the parent object that you have already set by calling setClientName from the page object? On Fri, 6 Sep 2002, Peter Darley wrote: > Friends, > Another stupid question... > > I'm working on building a series of objects in a hierarchy that represents > a survey. The survey object will hold page objects which will hold > questions object, etc. > I'm wondering if there is a standard way for an object to know what it's > parent object is so I can pull properties from the parent instead of storing > it in each child object. So, I want to be able to do something like > $self->Parent->ClientName to get the client name of the survey a page object > is part of. > There are two ways that I can see of doing this, but they're both not > great. The first would be to give the child a reference to the parent > object to store in a parent property, but this has problems with circular > references, and I'd probably have to do my own garbage collection. > The other is to pass a string containing the name of the variable > containing the parent object (i.e. "$Main::MySurvey") then use "no strict > 'refs'; $$Parent->whatever()" to de-reference it when it needs to be used. > This would keep garbage collection working, but wouldn't, I believe, be > storable, because the name would likely be different next time the script is > executed. > Anyway, I was hoping that in addition to the normal messages letting me > know that this is all a bad thing to do someone might have some advise on > setting my objects up like this. :) > > Thanks, > Peter Darley > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Fri Sep 6 10:50:41 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: OO Perl object backrefrence question In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D082E7110@wacorpml03.wwireless.com> Message-ID: Ryan, Thanks! That's exactly what I was looking for. Thanks, Peter Darley -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Parr, Ryan Sent: Friday, September 06, 2002 8:24 AM To: SPUG Subject: RE: SPUG: OO Perl object backrefrence question There's an article by Matt Sergeant on Perl.com right now that covers exactly this. http://www.perl.com/pub/a/2002/08/07/proxyobject.html Basically it shows how to pass a parent object to a child without creating a circular reference. -- Ryan -----Original Message----- From: Peter Darley [mailto:pdarley@kinesis-cem.com] Sent: Friday, September 06, 2002 7:31 AM To: SPUG Subject: SPUG: OO Perl object backrefrence question Friends, Another stupid question... I'm working on building a series of objects in a hierarchy that represents a survey. The survey object will hold page objects which will hold questions object, etc. I'm wondering if there is a standard way for an object to know what it's parent object is so I can pull properties from the parent instead of storing it in each child object. So, I want to be able to do something like $self->Parent->ClientName to get the client name of the survey a page object is part of. There are two ways that I can see of doing this, but they're both not great. The first would be to give the child a reference to the parent object to store in a parent property, but this has problems with circular references, and I'd probably have to do my own garbage collection. The other is to pass a string containing the name of the variable containing the parent object (i.e. "$Main::MySurvey") then use "no strict 'refs'; $$Parent->whatever()" to de-reference it when it needs to be used. This would keep garbage collection working, but wouldn't, I believe, be storable, because the name would likely be different next time the script is executed. Anyway, I was hoping that in addition to the normal messages letting me know that this is all a bad thing to do someone might have some advise on setting my objects up like this. :) Thanks, Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From umar at drizzle.com Fri Sep 6 11:06:07 2002 From: umar at drizzle.com (Umar Cheema) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: OO Perl object backrefrence question In-Reply-To: Message-ID: Ah. In that case read the article Ryan just sent out. It has just the right stuff for you. On Fri, 6 Sep 2002, Peter Darley wrote: > Umar, > In this case I'm not inheriting, I'm using objects to hold info on it's > self, as well as collections of other objects that make up a hierarchy. So, > the page class isn't an inherited class of the survey class, the page > objects are just included in a property of the survey object. There might > be a structure like: > > [My::Survey=HASH(0x80f6459)] = {ClientName => 'The Client', > Pages[1] => [My::Page=HASH(0x80f6460)] > Pages[2] => [My::Page=HASH(0x80f6461)]} > > So, what I would like to be able to do is in the My::Page package be able > to do something like $Self->Parent->{'ClientName'} and get back 'The > Client'. > > I don't know if that makes any sence or not... > > Thanks, > Peter Darley > > -----Original Message----- > From: Umar Cheema [mailto:umar@drizzle.com] > Sent: Friday, September 06, 2002 8:00 AM > To: Peter Darley > Subject: Re: SPUG: OO Perl object backrefrence question > > > Hmmm. Maybe I am not understanding it correctly but if you're inheriting > from the parent object wouldn't you be able to accomplish that by calling > a method like > $self->setClientName($client_name); > > from the page object and having the setClientName method placed in the > parent object. > > Then you can simply call a getter method like $self->getClientName() which > will simply return the client name from the parent object that you have > already set by calling setClientName from the page object? > > > On Fri, 6 Sep 2002, Peter Darley wrote: > > > Friends, > > Another stupid question... > > > > I'm working on building a series of objects in a hierarchy that > represents > > a survey. The survey object will hold page objects which will hold > > questions object, etc. > > I'm wondering if there is a standard way for an object to know what it's > > parent object is so I can pull properties from the parent instead of > storing > > it in each child object. So, I want to be able to do something like > > $self->Parent->ClientName to get the client name of the survey a page > object > > is part of. > > There are two ways that I can see of doing this, but they're both not > > great. The first would be to give the child a reference to the parent > > object to store in a parent property, but this has problems with circular > > references, and I'd probably have to do my own garbage collection. > > The other is to pass a string containing the name of the variable > > containing the parent object (i.e. "$Main::MySurvey") then use "no strict > > 'refs'; $$Parent->whatever()" to de-reference it when it needs to be used. > > This would keep garbage collection working, but wouldn't, I believe, be > > storable, because the name would likely be different next time the script > is > > executed. > > Anyway, I was hoping that in addition to the normal messages letting me > > know that this is all a bad thing to do someone might have some advise on > > setting my objects up like this. :) > > > > Thanks, > > Peter Darley > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Fri Sep 6 11:39:40 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: Larry's interview on slashdot Message-ID: <20020906093940.A5311@hobart.helvella.org> SPUGgers, You may be interested in reading Larry Wall's response to slashdot questions: http://interviews.slashdot.org/interviews/02/09/06/1343222.shtml?tid=145 Have fun, -Colin. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From timm at gleason.to Tue Sep 10 14:37:55 2002 From: timm at gleason.to (Timm Gleason) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: Perl and setting environment variables Message-ID: I see that there a explicit tools for importing and manipulating environment variables with Perl, but I need to set them from with a Perl script and have them passed to all subsequent child processes and shells that may be executed just as if they were set before the script was executed. It was recommended that I use a shell script to set all the EVs and then invoke the Perl script, however, I do not have all the EV values until after the script is executed. I have set them in the script $ENV{"CVSROOT"} = $CVSROOT; $ENV{"TMPDIR"} = $TMPDIR; $ENV{"DIST_ROOT"} = $DIST_ROOT; $ENV{"BuildNumber"} = $BuildNumber; but when I execute a command outside of the script, such as with a system(), the EVs do not get inherited by the child process. Tuesday, September 10 2002 -- | To be, or not to be. *BOOM!* Not to Timm Gleason | be. http://www.gleason.to/ | http://www.uranushertz.to/ | Quis custodiet iposos custodes? | -----PGP PUBLIC KEY BLOCK AVAILABLE----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Tue Sep 10 16:05:50 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: Perl and setting environment variables Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E711C@wacorpml03.wwireless.com> I use the method of setting %ENV in a script which calls to the database to collect information about clients and their sites, sets environment variables used by AwStats, and then uses system() to run reports for the websites on the system. It does work properly. Try out the following quickie... #!/usr/bin/perl use strict; $ENV{CHEEKY_FELLOW} = 'Yeah baby yeah!'; system('printenv'); __END__ After the script runs if you do 'printenv' again, the variable isn't there. Using system() without shell characters even causes it to bypass the shell altogether. But testing it with system('printenv | less') show that passing through a shell doesn't affect this process much. It also works using backticks. I've never done this on anything other than FreeBSD and Linux, and only with Perl 5.6.1. I don't know if there are any gotchas with other systems or perls. -- Ryan -----Original Message----- From: Timm Gleason [mailto:timm@gleason.to] Sent: Tuesday, September 10, 2002 12:38 PM To: spug-list@pm.org Subject: SPUG: Perl and setting environment variables I see that there a explicit tools for importing and manipulating environment variables with Perl, but I need to set them from with a Perl script and have them passed to all subsequent child processes and shells that may be executed just as if they were set before the script was executed. It was recommended that I use a shell script to set all the EVs and then invoke the Perl script, however, I do not have all the EV values until after the script is executed. I have set them in the script $ENV{"CVSROOT"} = $CVSROOT; $ENV{"TMPDIR"} = $TMPDIR; $ENV{"DIST_ROOT"} = $DIST_ROOT; $ENV{"BuildNumber"} = $BuildNumber; but when I execute a command outside of the script, such as with a system(), the EVs do not get inherited by the child process. Tuesday, September 10 2002 -- | To be, or not to be. *BOOM!* Not to Timm Gleason | be. http://www.gleason.to/ | http://www.uranushertz.to/ | Quis custodiet iposos custodes? | -----PGP PUBLIC KEY BLOCK AVAILABLE----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Tue Sep 10 17:27:32 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: Where is grep's return value? Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> Hello, I have something that looks like this: if (grep("$KEY",EXISTING)){ In the event that this is true, I want to print the data that makes it true. In other words, I want to print the line from EXISTING that contains the pattern from the variable $KEY. The problem I am having is figuring out where that line is. Is it stored in a variable I don't know about? If not, how can I obtain this data? I realize this is a pretty basic question, but I am having a tough time finding the answer and I need to get this done. Any suggestions/help would be greatly appreciated. Thanks, Chuck Orr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cansubaykan at hotmail.com Tue Sep 10 17:57:27 2002 From: cansubaykan at hotmail.com (John Subaykan) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: Re: Where is grep's return value? References: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> Message-ID: why not something this: if 'EXISTING' refers to the contents of a file, then put the lines into an array and loop over them open EX, "$filename"; while () { print if /$key/; # this will print the whole line if the line contains $key } close EX; ----- Original Message ----- From: "Orr, Chuck (NOC)" To: Sent: Tuesday, September 10, 2002 3:27 PM Subject: SPUG: Where is grep's return value? > Hello, > > I have something that looks like this: > > if (grep("$KEY",EXISTING)){ > > In the event that this is true, I want to print the data that makes it true. > In other words, I want to print the line from EXISTING that contains the > pattern from the variable $KEY. The problem I am having is figuring out > where that line is. Is it stored in a variable I don't know about? If not, > how can I obtain this data? I realize this is a pretty basic question, but > I am having a tough time finding the answer and I need to get this done. > Any suggestions/help would be greatly appreciated. > > Thanks, > Chuck Orr > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Tue Sep 10 18:00:17 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:09:11 2004 Subject: SPUG: Where is grep's return value? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> References: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> Message-ID: <20020910230016.GA8920@www.ladro.com> On Tue, Sep 10, 2002 at 06:27:32PM -0400, Orr, Chuck (NOC) wrote: > Hello, > > I have something that looks like this: > > if (grep("$KEY",EXISTING)){ > > In the event that this is true, I want to print the data that makes it true. > In other words, I want to print the line from EXISTING that contains the > pattern from the variable $KEY. The problem I am having is figuring out > where that line is. Is it stored in a variable I don't know about? If not, > how can I obtain this data? I realize this is a pretty basic question, but > I am having a tough time finding the answer and I need to get this done. > Any suggestions/help would be greatly appreciated. You should capture the output of grep into an array: @a = qw(one two three four twenty); if (@found = grep (/tw/, @a)) { print "Found: @found\n"; } else { print "Didn't find\n"; } Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Tue Sep 10 18:14:34 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2DDC@WA-MSG02> Thanks Chris, That works perfectly for my application Thank You, Chuck Orr -----Original Message----- From: Chris Wilkes [mailto:cwilkes-spug@ladro.com] Sent: Tuesday, September 10, 2002 4:00 PM To: spug-list@pm.org Subject: Re: SPUG: Where is grep's return value? On Tue, Sep 10, 2002 at 06:27:32PM -0400, Orr, Chuck (NOC) wrote: > Hello, > > I have something that looks like this: > > if (grep("$KEY",EXISTING)){ > > In the event that this is true, I want to print the data that makes it true. > In other words, I want to print the line from EXISTING that contains the > pattern from the variable $KEY. The problem I am having is figuring out > where that line is. Is it stored in a variable I don't know about? If not, > how can I obtain this data? I realize this is a pretty basic question, but > I am having a tough time finding the answer and I need to get this done. > Any suggestions/help would be greatly appreciated. You should capture the output of grep into an array: @a = qw(one two three four twenty); if (@found = grep (/tw/, @a)) { print "Found: @found\n"; } else { print "Didn't find\n"; } Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at acm.org Tue Sep 10 18:18:35 2002 From: asimjalis at acm.org (Asim Jalis) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> References: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> Message-ID: <20020910231835.GA4936@wokkil.pair.com> On Tue, Sep 10, 2002 at 06:27:32PM -0400, Orr, Chuck (NOC) wrote: > I have something that looks like this: > > if (grep("$KEY",EXISTING)){ > > In the event that this is true, I want to print the data that > makes it true. In other words, I want to print the line from > EXISTING that contains the pattern from the variable $KEY. The > problem I am having is figuring out where that line is. Is it > stored in a variable I don't know about? If not, how can I > obtain this data? I realize this is a pretty basic question, > but I am having a tough time finding the answer and I need to > get this done. Any suggestions/help would be greatly > appreciated. The first argument to grep seems wrong. If $KEY contains a regular expression pattern you should use grep(/$KEY, @EXISTING). Otherwise Perl will evaluate the string "$KEY" which will evaluate to true in all cases except when $KEY is 0 or "" or undefined. Assuming $KEY contains a regular expression pattern you can print out all the elements in @EXISTING that match it using: print join "\n" => grep { /$KEY/ } @EXISTING; Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Tue Sep 10 18:19:23 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? Message-ID: <67AC2DB52118D411A8F300508B957F120A1F2DDD@WA-MSG02> You are correct, that is a problem I experienced -----Original Message----- From: Asim Jalis [mailto:asimjalis@acm.org] Sent: Tuesday, September 10, 2002 4:19 PM To: Orr, Chuck (NOC) Cc: 'spug-list@pm.org' Subject: Re: SPUG: Where is grep's return value? On Tue, Sep 10, 2002 at 06:27:32PM -0400, Orr, Chuck (NOC) wrote: > I have something that looks like this: > > if (grep("$KEY",EXISTING)){ > > In the event that this is true, I want to print the data that > makes it true. In other words, I want to print the line from > EXISTING that contains the pattern from the variable $KEY. The > problem I am having is figuring out where that line is. Is it > stored in a variable I don't know about? If not, how can I > obtain this data? I realize this is a pretty basic question, > but I am having a tough time finding the answer and I need to > get this done. Any suggestions/help would be greatly > appreciated. The first argument to grep seems wrong. If $KEY contains a regular expression pattern you should use grep(/$KEY, @EXISTING). Otherwise Perl will evaluate the string "$KEY" which will evaluate to true in all cases except when $KEY is 0 or "" or undefined. Assuming $KEY contains a regular expression pattern you can print out all the elements in @EXISTING that match it using: print join "\n" => grep { /$KEY/ } @EXISTING; Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at acm.org Tue Sep 10 18:19:46 2002 From: asimjalis at acm.org (Asim Jalis) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? In-Reply-To: <20020910231835.GA4936@wokkil.pair.com> References: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> <20020910231835.GA4936@wokkil.pair.com> Message-ID: <20020910231946.GA5870@wokkil.pair.com> On Tue, Sep 10, 2002 at 07:18:35PM -0400, Asim Jalis wrote: > The first argument to grep seems wrong. If $KEY contains a > regular expression pattern you should use grep(/$KEY, @EXISTING). That should be grep(/$KEY/, @EXISTING). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jmates at sial.org Tue Sep 10 18:27:08 2002 From: jmates at sial.org (Jeremy Mates) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? In-Reply-To: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> References: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> Message-ID: <20020910232708.GE1872@darkness.sial.org> * Orr, Chuck (NOC) [2002-09-10T16:08-0700]: > if (grep("$KEY",EXISTING)){ perl -le '@a=qw(a b c); if (@r = grep { $_ eq "b" } @a) { print "@r" }' -- Jeremy Mates http://www.sial.org/ OpenPGP: 0x11C3D628 (4357 1D47 FF78 24BB 0FBF 7AA8 A846 9F86 11C3 D628) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Tue Sep 10 18:34:41 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E711D@wacorpml03.wwireless.com> if(my @good_stuff = grep(EXPR,LIST)) {} Note that you can't do something like: if(my @good_stuff = grep("FName",qw(FName MName LName))) {} because the expression returns it's last evaluation, which is simply a string, which is always true, so your list will be the full contents of the grep'd list. Make sure you perform some kind of operations: if(my @good_stuff = grep(/FName/,qw(FName MName LName))) {} --or-- if(my @good_stuff = grep { /$KEY/ } qw(FName MName LName)) {} === perldoc -f grep === =item grep BLOCK LIST =item grep EXPR,LIST This is similar in spirit to, but not the same as, grep(1) and its relatives. In particular, it is not limited to using regular expressions. Evaluates the BLOCK or EXPR for each element of LIST (locally setting C<$_> to each element) and returns the list value consisting of those elements for which the expression evaluated to true. In scalar context, returns the number of times the expression was true. @foo = grep(!/^#/, @bar); # weed out comments or equivalently, @foo = grep {!/^#/} @bar; # weed out comments Note that C<$_> is an alias to the list value, so it can be used to modify the elements of the LIST. While this is useful and supported, it can cause bizarre results if the elements of LIST are not variables. Similarly, grep returns aliases into the original list, much as a for loop's index variable aliases the list elements. That is, modifying an element of a list returned by grep (for example, in a C, C or another C) actually modifies the element in the original list. This is usually something to be avoided when writing clear code. See also L for a list composed of the results of the BLOCK or EXPR. -----Original Message----- From: Orr, Chuck (NOC) [mailto:chuck.orr@attws.com] Sent: Tuesday, September 10, 2002 3:28 PM To: 'spug-list@pm.org' Subject: SPUG: Where is grep's return value? Hello, I have something that looks like this: if (grep("$KEY",EXISTING)){ In the event that this is true, I want to print the data that makes it true. In other words, I want to print the line from EXISTING that contains the pattern from the variable $KEY. The problem I am having is figuring out where that line is. Is it stored in a variable I don't know about? If not, how can I obtain this data? I realize this is a pretty basic question, but I am having a tough time finding the answer and I need to get this done. Any suggestions/help would be greatly appreciated. Thanks, Chuck Orr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at acm.org Tue Sep 10 18:48:56 2002 From: asimjalis at acm.org (Asim Jalis) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? In-Reply-To: <20020910232708.GE1872@darkness.sial.org> References: <67AC2DB52118D411A8F300508B957F120A1F2DD6@WA-MSG02> <20020910232708.GE1872@darkness.sial.org> Message-ID: <20020910234856.GA9105@wokkil.pair.com> On Tue, Sep 10, 2002 at 04:27:08PM -0700, Jeremy Mates wrote: > * Orr, Chuck (NOC) [2002-09-10T16:08-0700]: > > if (grep("$KEY",EXISTING)){ > > perl -le '@a=qw(a b c); if (@r = grep { $_ eq "b" } @a) { print "@r" }' The "if" and "@r" temporary variable can be removed: perl -le '@a=qw(a b c); print grep { $_ eq "b" } @a' Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From moonbeam at catmanor.com Tue Sep 10 19:10:16 2002 From: moonbeam at catmanor.com (William Julien) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? Message-ID: <200209110010.g8B0AGS12639@catmanor.com> Or even better... -->perl -le '@a=qw(vi is my shepherd I shall not font it); print join " ", grep /i/, @a;' vi is it William Julien (vi bill) > >On Tue, Sep 10, 2002 at 04:27:08PM -0700, Jeremy Mates wrote: >> * Orr, Chuck (NOC) [2002-09-10T16:08-0700]: >> > if (grep("$KEY",EXISTING)){ >> >> perl -le '@a=qw(a b c); if (@r = grep { $_ eq "b" } @a) { print "@r" }' > >The "if" and "@r" temporary variable can be removed: > >perl -le '@a=qw(a b c); print grep { $_ eq "b" } @a' > > >Asim > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at acm.org Tue Sep 10 19:20:16 2002 From: asimjalis at acm.org (Asim Jalis) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? In-Reply-To: <200209110010.g8B0AGS12639@catmanor.com> References: <200209110010.g8B0AGS12639@catmanor.com> Message-ID: <20020911002016.GA12149@wokkil.pair.com> On Tue, Sep 10, 2002 at 05:10:16PM -0700, William Julien wrote: > > On Tue, Sep 10, 2002 at 04:27:08PM -0700, Jeremy Mates wrote: > > > * Orr, Chuck (NOC) [2002-09-10T16:08-0700]: > > > > if (grep("$KEY",EXISTING)){ > > > > > > perl -le '@a=qw(a b c); if (@r = grep { $_ eq "b" } @a) { print "@r" }' > > > > The "if" and "@r" temporary variable can be removed: > > > > perl -le '@a=qw(a b c); print grep { $_ eq "b" } @a' > > Or even better... > > -->perl -le '@a=qw(vi is my shepherd I shall not font it); print join " ", grep /i/, @a;' > vi is it Good point. In fact, the output is correct on several levels. I prefer => for comma in join. With => you can almost see the " " being inserted between the elements: -->perl -le '@a=qw(vi is my shepherd I shall not font it); print join " " => grep /i/, @a;' vi is it - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Tue Sep 10 19:22:17 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Where is grep's return value? Message-ID: <6D6F0541E2B1D411A75B0002A513016D082E711E@wacorpml03.wwireless.com> Except you no longer have the construct of "@r = grep {} @" which is what's intended. -- Ryan -----Original Message----- From: Asim Jalis [mailto:asimjalis@acm.org] Sent: Tuesday, September 10, 2002 4:49 PM To: Jeremy Mates Cc: 'spug-list@pm.org' Subject: Re: SPUG: Where is grep's return value? On Tue, Sep 10, 2002 at 04:27:08PM -0700, Jeremy Mates wrote: > * Orr, Chuck (NOC) [2002-09-10T16:08-0700]: > > if (grep("$KEY",EXISTING)){ > > perl -le '@a=qw(a b c); if (@r = grep { $_ eq "b" } @a) { print "@r" }' The "if" and "@r" temporary variable can be removed: perl -le '@a=qw(a b c); print grep { $_ eq "b" } @a' Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wildwood_players at yahoo.com Wed Sep 11 11:39:48 2002 From: wildwood_players at yahoo.com (Richard Wood) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: UNIX to MS ACCESS interface Message-ID: <20020911163948.73032.qmail@web11501.mail.yahoo.com> SPUG'sters, I need to develop an interface between a unix box (AIX 4.3.3.0) and MS Project. I figure the easiest way to do this is by saving the Project as an MS ACCESS database then using ODBC for the interface. I have been working at this off and on for several days and my current direction is to use DBI::Proxy and unixODBC (http://www.unixodbc.org/) to facilitate the interface. First I will state my question, then give the history: Has anyone successfully created an interface from a unix system to MS Access running on NT or 2000? If so, how? While trying to install unixODBC, I was informed that I needed to install QT: "The GUI components (ODBCConfig and DataManager) require Qt 2.2." (http://www.trolltech.com/developer/download/qt-x11.html) While trying to build QT, I had troubles with a module named qlist.cpp. I seemed to have eliminated those problems by turning off the optimization flags (removed xlC flags: -qstrict -03) But now I am stuck with unresolved symbols: ld: 0711-317 ERROR: Undefined symbol: .PrintOut::Box::operator==(const PrintOut::Box&) const So, does anyone have any ideas on how I could proceed? Regards, Rich Wood ===== Richard O. Wood Wildwood IT Consultants, Inc. wildwood_players@yahoo.com 425.281.1914 mobile 206.544.9885 desk __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wildwood_players at yahoo.com Wed Sep 11 12:40:11 2002 From: wildwood_players at yahoo.com (Richard Wood) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: UNIX to MS ACCESS interface In-Reply-To: <20020911172056.77352.qmail@web11908.mail.yahoo.com> Message-ID: <20020911174011.84964.qmail@web11501.mail.yahoo.com> Jeremy, Glad to hear that you have been successful. Perhaps I have gotten myself confused with all of the reading that I have been doing on the subject and the part time attention that I have been giving this effort. I will follow the direction on the site you have provided. Regards, Rich --- Jeremy Calvert wrote: > > By following the instructions at > http://www.awilcox.com/geek_stuff/perl/proxy.html > I've been able to access data in an MS Access > database on a WinNT box from perl DBI running on > Solaris. It uses ODBC and DBI::Proxy on the NT box, > but there's no need for Unix ODBC. > Does this answer your question? > Jeremy > Richard Wood wrote:SPUG'sters, > > I need to develop an interface between a unix box > (AIX > 4.3.3.0) and MS Project. I figure the easiest way to > do this is by saving the Project as an MS ACCESS > database then using ODBC for the interface. I have > been working at this off and on for several days and > my current direction is to use DBI::Proxy and > unixODBC > (http://www.unixodbc.org/) to facilitate the > interface. > > First I will state my question, then give the > history: > > Has anyone successfully created an interface from a > unix system to MS Access running on NT or 2000? If > so, > how? > > While trying to install unixODBC, I was informed > that > I needed to install QT: "The GUI components > (ODBCConfig and DataManager) require Qt 2.2." > (http://www.trolltech.com/developer/download/qt-x11.html) > > While trying to build QT, I had troubles with a > module > named qlist.cpp. I seemed to have eliminated those > problems by turning off the optimization flags > (removed xlC flags: -qstrict -03) But now I am stuck > with unresolved symbols: > > ld: 0711-317 ERROR: Undefined symbol: > .PrintOut::Box::operator==(const PrintOut::Box&) > const > > So, does anyone have any ideas on how I could > proceed? > > Regards, > > Rich Wood > > ===== > Richard O. Wood > Wildwood IT Consultants, Inc. > wildwood_players@yahoo.com > 425.281.1914 mobile > 206.544.9885 desk > > __________________________________________________ > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost > http://dir.remember.yahoo.com/tribute > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION > LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by > your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > > > > --------------------------------- > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost ===== Richard O. Wood Wildwood IT Consultants, Inc. wildwood_players@yahoo.com 425.281.1914 mobile 206.544.9885 desk __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jay at Scherrer.com Wed Sep 11 13:34:11 2002 From: jay at Scherrer.com (Jay Scherrer) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: UNIX to MS ACCESS interface In-Reply-To: <20020911163948.73032.qmail@web11501.mail.yahoo.com> References: <20020911163948.73032.qmail@web11501.mail.yahoo.com> Message-ID: <200209111134.11714.jay@scherrer.com> Ricard, I have found that using Perl::Tk for creating a user interface is pretty straight forward. Your script will work nice for both windows and UNIX. Then you just bring in you're DBD to suit your needs. Jay On Wednesday 11 September 2002 09:39 am, Richard Wood wrote: > SPUG'sters, > > I need to develop an interface between a unix box (AUX > 4.3.3.0) and MS Project. I figure the easiest way to > do this is by saving the Project as an MS ACCESS > database then using OD BC for the interface. I have > been working at this off and on for several days and > my current direction is to use DEBI::Proxy and unixODBC > (http://www.unixodbc.org/) to facilitate the > interface. > > First I will state my question, then give the history: > > Has anyone successfully created an interface from a > unix system to MS Access running on NT or 2000? If so, > how? > > While trying to install unixODBC, I was informed that > I needed to install QT: "The GUI components > (ODBCConfig and DataManager) require Qt 2.2." > (http://www.trolltech.com/developer/download/qt-x11.html) > > While trying to build QT, I had troubles with a module > named qlist.cpp. I seemed to have eliminated those > problems by turning off the optimization flags > (removed xlC flags: -qstrict -03) But now I am stuck > with unresolved symbols: > > ld: 0711-317 ERROR: Undefined symbol: > .PrintOut::Box::operator==(const PrintOut::Box&) const > > So, does anyone have any ideas on how I could proceed? > > Regards, > > Rich Wood > > ===== > Richard O. Wood > Wildwood IT Consultants, Inc. > wildwood_players@yahoo.com > 425.281.1914 mobile > 206.544.9885 desk > > __________________________________________________ > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost > http://dir.remember.yahoo.com/tribute > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address For daily traffic, use spug-list for LIST ; > for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home > Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wildwood_players at yahoo.com Wed Sep 11 17:29:54 2002 From: wildwood_players at yahoo.com (Richard Wood) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: UNIX to MS ACCESS interface In-Reply-To: <20020911174011.84964.qmail@web11501.mail.yahoo.com> Message-ID: <20020911222954.12152.qmail@web11502.mail.yahoo.com> I am very nearly successful. I have dbish running on Win2000 and now I am testing the connection from unix. Currently getting a connection failure: DBI->connect(hostname=E271619.nw.nos.company.com;port=1522;dsn=dbi:ODBC:MasterSchedule) failed: Cannot log in to DBI::ProxyServer: Error while reading socket: A connection with a remote socket was reset by that socket. at /home/richwood/perl/RPC/PlServer/Comm.pm line 110. at MasterSchedule.pl line 16 but that will have to wait until Thursday. Thanks for the direction! Rich --- Richard Wood wrote: > Jeremy, > > Glad to hear that you have been successful. Perhaps > I > have gotten myself confused with all of the reading > that I have been doing on the subject and the part > time attention that I have been giving this effort. > I > will follow the direction on the site you have > provided. > > Regards, > > Rich > > --- Jeremy Calvert > wrote: > > > > By following the instructions at > > http://www.awilcox.com/geek_stuff/perl/proxy.html > > I've been able to access data in an MS Access > > database on a WinNT box from perl DBI running on > > Solaris. It uses ODBC and DBI::Proxy on the NT > box, > > but there's no need for Unix ODBC. > > Does this answer your question? > > Jeremy > > Richard Wood wrote:SPUG'sters, > > > > I need to develop an interface between a unix box > > (AIX > > 4.3.3.0) and MS Project. I figure the easiest way > to > > do this is by saving the Project as an MS ACCESS > > database then using ODBC for the interface. I have > > been working at this off and on for several days > and > > my current direction is to use DBI::Proxy and > > unixODBC > > (http://www.unixodbc.org/) to facilitate the > > interface. > > > > First I will state my question, then give the > > history: > > > > Has anyone successfully created an interface from > a > > unix system to MS Access running on NT or 2000? If > > so, > > how? > > > > While trying to install unixODBC, I was informed > > that > > I needed to install QT: "The GUI components > > (ODBCConfig and DataManager) require Qt 2.2." > > > (http://www.trolltech.com/developer/download/qt-x11.html) > > > > While trying to build QT, I had troubles with a > > module > > named qlist.cpp. I seemed to have eliminated those > > problems by turning off the optimization flags > > (removed xlC flags: -qstrict -03) But now I am > stuck > > with unresolved symbols: > > > > ld: 0711-317 ERROR: Undefined symbol: > > .PrintOut::Box::operator==(const PrintOut::Box&) > > const > > > > So, does anyone have any ideas on how I could > > proceed? > > > > Regards, > > > > Rich Wood > > > > ===== > > Richard O. Wood > > Wildwood IT Consultants, Inc. > > wildwood_players@yahoo.com > > 425.281.1914 mobile > > 206.544.9885 desk > > > > __________________________________________________ > > Yahoo! - We Remember > > 9-11: A tribute to the more than 3,000 lives lost > > http://dir.remember.yahoo.com/tribute > > > > - - - - - - - - - - - - - - - - - - - - - - - - - > - > > - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: > > owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION > > LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL > by > > your Email-address > > For daily traffic, use spug-list for LIST ; for > > weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > > http://seattleperl.org > > > > > > > > --------------------------------- > > Yahoo! - We Remember > > 9-11: A tribute to the more than 3,000 lives lost > > > ===== > Richard O. Wood > Wildwood IT Consultants, Inc. > wildwood_players@yahoo.com > 425.281.1914 mobile > 206.544.9885 desk > > __________________________________________________ > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost > http://dir.remember.yahoo.com/tribute > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > ===== Richard O. Wood Wildwood IT Consultants, Inc. wildwood_players@yahoo.com 425.281.1914 mobile 206.544.9885 desk __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wildwood_players at yahoo.com Thu Sep 12 10:45:24 2002 From: wildwood_players at yahoo.com (Richard Wood) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: UNIX to MS ACCESS interface In-Reply-To: <20020911222954.12152.qmail@web11502.mail.yahoo.com> Message-ID: <20020912154524.80794.qmail@web11505.mail.yahoo.com> Woo Hoo! I am very happy to close this thread. I have a successful interface running between my AIX (unix) box and my win2000 ACCESS db. I just needed to adjust the mask in the proxy.config file so that access would be allowed from my unix box and I was in business. Thanks again to Jeremy for the help. Regards, Rich Wood --- Richard Wood <wildwood_players@yahoo.com> wrote: > I am very nearly successful. I have dbish running > on > Win2000 and now I am testing the connection from > unix. > Currently getting a connection failure: > > DBI->connect(hostname=E271619.nw.nos.company.com;port=1522;dsn=dbi:ODBC:MasterSchedule) > failed: Cannot log in to DBI::ProxyServer: Error > while > reading socket: A connection with a remote socket > was > reset by that socket. at > /home/richwood/perl/RPC/PlServer/Comm.pm line 110. > at MasterSchedule.pl line 16 > > but that will have to wait until Thursday. > > Thanks for the direction! > > Rich > > --- Richard Wood <wildwood_players@yahoo.com> wrote: > > Jeremy, > > > > Glad to hear that you have been successful. > Perhaps > > I > > have gotten myself confused with all of the > reading > > that I have been doing on the subject and the part > > time attention that I have been giving this > effort. > > I > > will follow the direction on the site you have > > provided. > > > > Regards, > > > > Rich > > > > --- Jeremy Calvert <jeremycalvert2000@yahoo.com> > > wrote: > > > > > > By following the instructions at > > > > http://www.awilcox.com/geek_stuff/perl/proxy.html > > > I've been able to access data in an MS Access > > > database on a WinNT box from perl DBI running on > > > Solaris. It uses ODBC and DBI::Proxy on the NT > > box, > > > but there's no need for Unix ODBC. > > > Does this answer your question? > > > Jeremy > > > Richard Wood wrote:SPUG'sters, > > > > > > I need to develop an interface between a unix > box > > > (AIX > > > 4.3.3.0) and MS Project. I figure the easiest > way > > to > > > do this is by saving the Project as an MS ACCESS > > > database then using ODBC for the interface. I > have > > > been working at this off and on for several days > > and > > > my current direction is to use DBI::Proxy and > > > unixODBC > > > (http://www.unixodbc.org/) to facilitate the > > > interface. > > > > > > First I will state my question, then give the > > > history: > > > > > > Has anyone successfully created an interface > from > > a > > > unix system to MS Access running on NT or 2000? > If > > > so, > > > how? > > > > > > While trying to install unixODBC, I was informed > > > that > > > I needed to install QT: "The GUI components > > > (ODBCConfig and DataManager) require Qt 2.2." > > > > > > (http://www.trolltech.com/developer/download/qt-x11.html) > > > > > > While trying to build QT, I had troubles with a > > > module > > > named qlist.cpp. I seemed to have eliminated > those > > > problems by turning off the optimization flags > > > (removed xlC flags: -qstrict -03) But now I am > > stuck > > > with unresolved symbols: > > > > > > ld: 0711-317 ERROR: Undefined symbol: > > > .PrintOut::Box::operator==(const PrintOut::Box&) > > > const > > > > > > So, does anyone have any ideas on how I could > > > proceed? > > > > > > Regards, > > > > > > Rich Wood > > > > > > ===== > > > Richard O. Wood > > > Wildwood IT Consultants, Inc. > > > wildwood_players@yahoo.com > > > 425.281.1914 mobile > > > 206.544.9885 desk > > > > > > > __________________________________________________ > > > Yahoo! - We Remember > > > 9-11: A tribute to the more than 3,000 lives > lost > > > http://dir.remember.yahoo.com/tribute > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - > - > > - > > > - - - - - - - - - - - > > > POST TO: spug-list@pm.org PROBLEMS: > > > owner-spug-list@pm.org > > > Subscriptions; Email to majordomo@pm.org: ACTION > > > LIST EMAIL > > > Replace ACTION by subscribe or unsubscribe, > EMAIL > > by > > > your Email-address > > > For daily traffic, use spug-list for LIST ; for > > > weekly, spug-list-digest > > > Seattle Perl Users Group (SPUG) Home Page: > > > http://seattleperl.org > > > > > > > > > > > > --------------------------------- > > > Yahoo! - We Remember > > > 9-11: A tribute to the more than 3,000 lives > lost > > > > > > ===== > > Richard O. Wood > > Wildwood IT Consultants, Inc. > > wildwood_players@yahoo.com > > 425.281.1914 mobile > > 206.544.9885 desk > > > > __________________________________________________ > > Yahoo! - We Remember > > 9-11: A tribute to the more than 3,000 lives lost > > http://dir.remember.yahoo.com/tribute > > > > - - - - - - - - - - - - - - - - - - - - - - - - - > - > > - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: > > owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: > > ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, > EMAIL > > by your Email-address > > For daily traffic, use spug-list for LIST ; for > > weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > > http://seattleperl.org > > > > > ===== > Richard O. Wood > Wildwood IT Consultants, Inc. > wildwood_players@yahoo.com > 425.281.1914 mobile > 206.544.9885 desk > > __________________________________________________ > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost > http://dir.remember.yahoo.com/tribute > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > === message truncated === ===== Richard O. Wood Wildwood IT Consultants, Inc. wildwood_players@yahoo.com 425.281.1914 mobile 206.544.9885 desk __________________________________________________ Yahoo! - We Remember 9-11: A tribute to the more than 3,000 lives lost http://dir.remember.yahoo.com/tribute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at acm.org Fri Sep 13 02:22:21 2002 From: asimjalis at acm.org (Asim Jalis) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Windows Applications in Perl Message-ID: <20020913072221.GA11900@wokkil.pair.com> I have been looking into ways of making Windows GUI applications with Perl and haven't found any good options yet. Perl/Tk looks awful on Windows - especially the tree views and the list views. Is there a way to give it a Windows look-n-feel? Or at least make it somewhat pretty? wxPerl looks much nicer (it has the native Windows L-n-F) but for some reason Perl2Exe does not build the final script.exe correctly if I use WxPerl. I am basically trying to solve two problems: (a) Nice GUI. (b) Simple deployment preferably as an EXE. Also I saw prima which looks interesting (http://www.prima.eu.org/). Haven't played enough with it yet to know how stable it is. Any body have any other ideas? Asim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Fri Sep 13 04:08:10 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Windows Applications in Perl In-Reply-To: <20020913072221.GA11900@wokkil.pair.com> References: <20020913072221.GA11900@wokkil.pair.com> Message-ID: <20020913090810.GA22177@www.ladro.com> On Fri, Sep 13, 2002 at 03:22:21AM -0400, Asim Jalis wrote: > I have been looking into ways of making Windows GUI applications > with Perl and haven't found any good options yet. > > Perl/Tk looks awful on Windows - especially the tree views and > the list views. Is there a way to give it a Windows look-n-feel? > Or at least make it somewhat pretty? Just poking around I found Win32::GUI : http://www.jeb.ca/howto/The_Win32-GUI_HOWTO.html which is now hosted here: http://sourceforge.net/projects/perl-win32-gui Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Sun Sep 15 15:25:33 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: September 2002 Seattle Perl Users Group Meeting Message-ID: <20020915132533.D23226@hobart.helvella.org> [ I'm posting this for Tim. -C. ] Please excuse me if you've seen this before, but for some reason, I didn't receive this announcement myself, so I'm thinking maybe nobody did, so the prudent choice is to re-post! 8-} -Tim September 2002 Seattle Perl Users Group Meeting ------------------------------------------------------ Speaker: Jonathan Gardner, of Classmates.com Time: Tuesday, September 17, 2002 7-9pm Location: SAFECO bldg, Brooklyn St. and NE 45th St. Cost: Admission is free and open to the general public. Info: http://seattleperl.org/ Title: "Advanced Regular Expressions" Larry Wall has some pretty neat tricks in store with Perl 6's Regular Expressions, but Perl 5 regexes are still extremely useful for all sorts of tasks. If you have a basic understanding of regexes, come polish up and learn a few more tricks that will make them even more useful. Topics to be covered: - How the engine really works - Atomic principles - Decoding regexes - Back references - Lookahead and lookbehind - Nonbacktracking and why - Damian Conway's Regexp::Common package - and other horrors of cryptic regular expressions About the Speaker: ----------------- Jonathan Gardner is working at Classmates.com as a perl developer. He has been programming perl since the summer of 2000, and has loved every minute of it. He has a degree in Physics from the University of Washington, and has lived in the Seattle almost his entire life. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wwalker at bybent.com Sun Sep 15 22:05:55 2002 From: wwalker at bybent.com (Wayne Walker) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Test, please ignore Message-ID: <20020916030555.GE1463@bybent.com> Testing , please ignore. -- Wayne Walker - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From chuck.orr at attws.com Wed Sep 18 10:13:30 2002 From: chuck.orr at attws.com (Orr, Chuck (NOC)) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: September 2002 Seattle Perl Users Group Meeting Message-ID: Hello, Did anyone attend this meeting and take notes? I really wanted to be there but was unable to make it. If anyone has a soft copy of what was covered, I would really appreciate it. Thank You, Chuck Orr -----Original Message----- From: Colin Meyer [mailto:cmeyer@helvella.org] Sent: Sunday, September 15, 2002 1:26 PM To: spug-list@pm.org Subject: SPUG: September 2002 Seattle Perl Users Group Meeting [ I'm posting this for Tim. -C. ] Please excuse me if you've seen this before, but for some reason, I didn't receive this announcement myself, so I'm thinking maybe nobody did, so the prudent choice is to re-post! 8-} -Tim September 2002 Seattle Perl Users Group Meeting ------------------------------------------------------ Speaker: Jonathan Gardner, of Classmates.com Time: Tuesday, September 17, 2002 7-9pm Location: SAFECO bldg, Brooklyn St. and NE 45th St. Cost: Admission is free and open to the general public. Info: http://seattleperl.org/ Title: "Advanced Regular Expressions" Larry Wall has some pretty neat tricks in store with Perl 6's Regular Expressions, but Perl 5 regexes are still extremely useful for all sorts of tasks. If you have a basic understanding of regexes, come polish up and learn a few more tricks that will make them even more useful. Topics to be covered: - How the engine really works - Atomic principles - Decoding regexes - Back references - Lookahead and lookbehind - Nonbacktracking and why - Damian Conway's Regexp::Common package - and other horrors of cryptic regular expressions About the Speaker: ----------------- Jonathan Gardner is working at Classmates.com as a perl developer. He has been programming perl since the summer of 2000, and has loved every minute of it. He has a degree in Physics from the University of Washington, and has lived in the Seattle almost his entire life. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Thu Sep 19 15:02:29 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: OO Perl object backrefrence question In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D082E7110@wacorpml03.wwireless.com> Message-ID: Friends, I have taken a look at the weaken() function, and have a further question about it. I want to use it in my objects, but I would also like to store the objects to a database via the Apache::Session mechanism and reuse them during a session (so I don't have to do all the complex db queries required to build the objects every time). My question is this: Will an object that comes back from stored still have references to it's parent weaken()ed? I took a look at how Dumper() deals with it and it doesn't seem to weaken() the references that it gives back, so I'm worried. I don't know how to tell how the reference comes back from being stored (weak or not). Thanks, Peter Darley -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Parr, Ryan Sent: Friday, September 06, 2002 8:24 AM To: SPUG Subject: RE: SPUG: OO Perl object backrefrence question There's an article by Matt Sergeant on Perl.com right now that covers exactly this. http://www.perl.com/pub/a/2002/08/07/proxyobject.html Basically it shows how to pass a parent object to a child without creating a circular reference. -- Ryan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Sun Sep 22 22:38:02 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: OO Perl object backrefrence question References: Message-ID: On Thu, 19 Sep 2002 13:02:29 -0700, pdarley@kinesis-cem.com wrote: >I don't know how to tell how the reference comes back from >being stored (weak or not). Scalar::Util::isweak - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Sep 26 11:48:45 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:09:12 2004 Subject: SPUG: Bio-Informatics Interest Group Forming In-Reply-To: <20020923095646.A17386@timji.consultix.wa.com> References: <20020923095646.A17386@timji.consultix.wa.com> Message-ID: <20020926094845.C11582@hobart.helvella.org> [I'm posting this message for Eric Olson. -C] Announcing the first meeting of array(bio) a biology and computing interest group. October 8, 2002, 7:00 p.m. - 9:00 p.m. University of Washington, Rosen Center Mission Statement array(bio) provides a forum for biologists, software developers and business people to network and exchange information about the emerging field of bioinformatics. Our meetings cover topics of general interest to the creation and development of software tools for biological discovery. First Meeting Our first speaker is Dr. Steve Schmechel. Dr Scmechel is a Research Fellow from the University of Washington Department of Pathology. Steve will be discussing the role of microarrays in developing diagnostics for Lymphoma. Steve is Research Fellow, Department of Pathology at the University of Washington Medical Center. He has 10 years of training in medicine and clinical pathology. Steve received his undergraduate degree from Carroll College, doctoral degrees from the University of Minnesota, and specialty training in clinical pathology from the University of Washington. array(bio) is grateful for the support of the following organizations: Info.Resource, Inc. Washington Biotechnology and Biomedical Association Washington Software Alliance For more information, please visit http://www.wabio.com/ir/wa/news/arraybio_meeting.htm Or contact Dr. Eric Olson VizXLabs, LLC. Phone: 206.336.5549 E-mail: eric@vizxlabs.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org