From jeremyb at univista.com Tue May 6 21:05:09 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: global scope array doesn't seem to be global Message-ID: <1052273109.2186.70.camel@proteuslab.com> Mongers, I've been working on a CGI script that does quite bit of syncing, parsing and rendering of content from other http servers. The script is split into several sub routines. At the beginning of the script I declare several vars, arrays and hashes that are referenced by the various subs. The array I'm having problems with is call @repeat. @repeat is declared at the top of the script before any subs get called. It gets populated by a sub called GEN_CONTENT(). GEN_CONTENT() calls REPEAT_CONTENT() which does some content rendering with the values in the @repeat array, among others. THE SYSTEM: Red Hat 7.1 Linux 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown v5.6.0 built for i386-linux THE PROBLEM: Just prior to calling REPEAT_CONTENT() from GEN_CONTENT() the @repeat array is, indeed, populated with what I expect. Next, when I print out the elements of @repeat from within REPEAT_CONTENT(), all it contains is a single blank line. After REPEAT_CONTENT returns, I check the elements of @repeat again from GEN_CONTENT() and everything is as it should be just like it was prior to entering into REPEAT_CONTENT(). The problem is obviously that @repeat is not global in scope, I just don't know why. I would expect this behavior if I had not declared @repeat at the beginning of the script, but I did. Furthermore it doesn't get declared again anywhere inside GEN_CONTENT(), which might cause this problem. The script is 1050 lines long so I'll not be including it here! Any ideas on what the problem is? Here's the snippet of code I describe and the top of the script where the declarations are: 575 print "before REPEAT_CONTENT( task )\n"; 576 foreach( @repeat ){ 577 print "====== $_\n"; 578 } 579 580 &REPEAT_CONTENT( 'task' ); 581 582 print "After REPEAT_CONTENT( task )\n"; 583 foreach( @repeat ){ 584 print "====== $_\n"; 585 } Here's the beginning snippet from REPEAT_CONTENT where I check the content of @repeat: 756 sub REPEAT_CONTENT{ 757 758 759 ########################### DEBUG 760 if ( $config{ debug } eq 'yes' ){ 761 print "\n\n Inside REPEAT_CONTENT( $_[0]$_[1] )\n\n"; 762 foreach( @repeat ){ 763 print "====== $_ \n"; 764 } 765 } 1 #!/usr/bin/perl 2 3 use strict; 4 use LWP::UserAgent; 5 use HTTP::Cookies; 6 use CGI; 7 8 my $config_file = "/etc/owapi/conf/shrinkwrap.conf"; 9 10 11 # Not set in the config file ....leave these alone! 12 my $do_sync = undef; 13 my @task_table = undef; 14 my @table_data = undef; 15 my @cal_table = undef; 16 my @eml_elements = undef; 17 my @repeat = undef; thanks in advance, Jeremy From jeremyb at univista.com Tue May 6 21:33:27 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: global scope array doesn't seem to be global In-Reply-To: <1052273109.2186.70.camel@proteuslab.com> References: <1052273109.2186.70.camel@proteuslab.com> Message-ID: <1052274807.2197.75.camel@proteuslab.com> Sometimes it just takes talking about it... I had put 'my @repeat = undef' on lines 642 and 511. where it should have been '@repeat = undef'. Sorry and thanks, Jeremy On Tue, 2003-05-06 at 21:05, jeremy wrote: > Mongers, > > > I've been working on a CGI script that does quite bit of syncing, > parsing and rendering of content from other http servers. The script is > split into several sub routines. At the beginning of the script I > declare several vars, arrays and hashes that are referenced by the > various subs. The array I'm having problems with is call @repeat. > > @repeat is declared at the top of the script before any subs get > called. It gets populated by a sub called GEN_CONTENT(). GEN_CONTENT() > calls REPEAT_CONTENT() which does some content rendering with the values > in the @repeat array, among others. > > > THE SYSTEM: > > Red Hat 7.1 > Linux 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown > v5.6.0 built for i386-linux > > > > THE PROBLEM: > > Just prior to calling REPEAT_CONTENT() from GEN_CONTENT() the @repeat > array is, indeed, populated with what I expect. Next, when I print out > the elements of @repeat from within REPEAT_CONTENT(), all it contains is > a single blank line. After REPEAT_CONTENT returns, I check the elements > of @repeat again from GEN_CONTENT() and everything is as it should be > just like it was prior to entering into REPEAT_CONTENT(). > > The problem is obviously that @repeat is not global in scope, I just > don't know why. I would expect this behavior if I had not declared > @repeat at the beginning of the script, but I did. Furthermore it > doesn't get declared again anywhere inside GEN_CONTENT(), which might > cause this problem. The script is 1050 lines long so I'll not be > including it here! > > Any ideas on what the problem is? > > Here's the snippet of code I describe and the top of the script where > the declarations are: > > > 575 print "before REPEAT_CONTENT( task )\n"; > 576 foreach( @repeat ){ > 577 print "====== $_\n"; > 578 } > 579 > 580 &REPEAT_CONTENT( 'task' ); > 581 > 582 print "After REPEAT_CONTENT( task )\n"; > 583 foreach( @repeat ){ > 584 print "====== $_\n"; > 585 } > > > Here's the beginning snippet from REPEAT_CONTENT where I check the > content of @repeat: > > > 756 sub REPEAT_CONTENT{ > 757 > 758 > 759 ########################### DEBUG > 760 if ( $config{ debug } eq 'yes' ){ > 761 print "\n\n Inside REPEAT_CONTENT( $_[0]$_[1] )\n\n"; > 762 foreach( @repeat ){ > 763 print "====== $_ \n"; > 764 } > 765 } > > > > > 1 #!/usr/bin/perl > 2 > 3 use strict; > 4 use LWP::UserAgent; > 5 use HTTP::Cookies; > 6 use CGI; > 7 > 8 my $config_file = "/etc/owapi/conf/shrinkwrap.conf"; > 9 > 10 > 11 # Not set in the config file ....leave these alone! > 12 my $do_sync = undef; > 13 my @task_table = undef; > 14 my @table_data = undef; > 15 my @cal_table = undef; > 16 my @eml_elements = undef; > 17 my @repeat = undef; > > > thanks in advance, > Jeremy > > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin From mike at stok.co.uk Wed May 7 05:36:37 2003 From: mike at stok.co.uk (Mike Stok) Date: Mon Aug 2 21:23:18 2004 Subject: APM: global scope array doesn't seem to be global In-Reply-To: <1052274807.2197.75.camel@proteuslab.com> Message-ID: On 6 May 2003, jeremy wrote: > Sometimes it just takes talking about it... > > I had put 'my @repeat = undef' on lines 642 and 511. > where it should have been '@repeat = undef'. Why do you assign undef to the array. Do you really mean to initialise it to a single element array containing undef? my @repeat; or my @repeat = (); will give you a new empty array. Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA From jeremyb at univista.com Wed May 7 08:25:12 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: global scope array doesn't seem to be global In-Reply-To: References: Message-ID: <1052313912.4444.9.camel@proteuslab.com> my @repeat = undef; and my @repeat = (); would both give me what I want. I have no reason to not use (). Using () would be "cleaner" I suppose ...possibly more logical too. However, my @repeat = undef; and @repeat =undef; are not the same thing. Since I declare @repeat at the top of the script and outside of any other subs, the @repeat array is global in scope. But, if I use 'my' on the line that empties @repeat, then I just created a second empty local @repeat array. On Wed, 2003-05-07 at 05:36, Mike Stok wrote: > On 6 May 2003, jeremy wrote: > > > Sometimes it just takes talking about it... > > > > I had put 'my @repeat = undef' on lines 642 and 511. > > where it should have been '@repeat = undef'. > > Why do you assign undef to the array. Do you really mean to initialise it > to a single element array containing undef? > > my @repeat; > > or > > my @repeat = (); > > will give you a new empty array. > > Mike From jeremyb at univista.com Wed May 7 08:43:30 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: global scope array doesn't seem to be global In-Reply-To: References: Message-ID: <1052315010.4444.12.camel@proteuslab.com> No, I was not intending to initialize @repeat with one undef element. Thanks for pointing that out. On Wed, 2003-05-07 at 05:36, Mike Stok wrote: > On 6 May 2003, jeremy wrote: > > > Sometimes it just takes talking about it... > > > > I had put 'my @repeat = undef' on lines 642 and 511. > > where it should have been '@repeat = undef'. > > Why do you assign undef to the array. Do you really mean to initialise it > to a single element array containing undef? > > my @repeat; > > or > > my @repeat = (); > > will give you a new empty array. > > Mike From eharris at puremagic.com Mon May 12 14:06:45 2003 From: eharris at puremagic.com (Evan Harris) Date: Mon Aug 2 21:23:18 2004 Subject: APM: Using threads in perl Message-ID: I'm using a threaded copy of perl 5.8.0 to write a sendmail milter using Sendmail::Milter from cpan. The milter interface creates a long-running perl that spawns seperate threads to handle callbacks from the milter interface. According to the docs, those threads are periodically recycled and respawned. However, I've noticed that when that happens, the threads don't seem to release/close a global dbi handle I'm using from within the milter callbacks, and is over time creating dozens of connections to the database that never go away unless I restart the milter, and it eventually exhausts the db connection pool. Does anyone know of something I can setup that is specific to perl threads where I can register a function to be called immediately before a thread is destroyed? I would have that function explicitly close the db connection, and hopefully that would solve my problem. Thanks. Evan From kkillens at austin.rr.com Mon May 12 14:35:20 2003 From: kkillens at austin.rr.com (Kevin Killens) Date: Mon Aug 2 21:23:18 2004 Subject: APM: New To Perl Message-ID: I need to learn how to truncate NT event logs, move them to a central server and then parse them for information. I need to both solve a problem fairly quickly and also to learn how to script PERL. If there is any help someone can give me in this regard it would be appreciated. Thank you, Kevin Killens From wwalker at broadq.com Mon May 12 14:42:25 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:18 2004 Subject: APM: New To Perl In-Reply-To: References: Message-ID: <20030512194225.GE1492@broadq.com> Get the O'Reilly book Learning Perl (two versions, get the one for Window). CPAN has the following modules that appear to talk to the NT Event Log, but I think only Win32-EventLog-Message.tar.gz may read the event log instead of write to it. You should also check into Python. Similar language and I think there is more Win support modules for Python. Log-Dispatch-Win32EventLog-0.02.tar.gz Win32-EventLog-Carp-0.02.tar.gz Win32-EventLog-Carp-0.04.tar.gz Win32-EventLog-Carp-1.00.tar.gz Win32-EventLog-Carp-1.11.tar.gz Win32-EventLog-Carp-1.20.tar.gz Win32-EventLog-Carp-1.21.tar.gz Win32-EventLog-Message.tar.gz Win32-Girder-IEvent-0.01.tar.gz Win32-Girder-IEvent-0.02.tar.gz Win32-Girder-IEvent-0.03.tar.gz On Mon, May 12, 2003 at 02:35:20PM -0500, Kevin Killens wrote: > I need to learn how to truncate NT event logs, move them to a central server > and then parse them for information. I need to both solve a problem fairly > quickly and also to learn how to script PERL. If there is any help someone > can give me in this regard it would be appreciated. > > Thank you, > Kevin Killens > > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From michalk at awpi.com Mon May 12 20:08:57 2003 From: michalk at awpi.com (Brian Michalk) Date: Mon Aug 2 21:23:18 2004 Subject: APM: RE: Using threads in perl In-Reply-To: Message-ID: From wwalker at broadq.com Tue May 13 11:47:35 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:18 2004 Subject: APM: New To Perl In-Reply-To: <20030512194225.GE1492@broadq.com> References: <20030512194225.GE1492@broadq.com> Message-ID: <20030513164735.GR1719@broadq.com> Anyone else have some advice for Kevin, surely you emacs guys want to give better advice than the vi/vim guy.... ;-) On Mon, May 12, 2003 at 02:42:25PM -0500, Wayne Walker wrote: > Get the O'Reilly book Learning Perl (two versions, get the one for > Window). > > CPAN has the following modules that appear to talk to the NT Event Log, > but I think only Win32-EventLog-Message.tar.gz may read the event log > instead of write to it. > > You should also check into Python. Similar language and I think there > is more Win support modules for Python. > > > Log-Dispatch-Win32EventLog-0.02.tar.gz > Win32-EventLog-Carp-0.02.tar.gz > Win32-EventLog-Carp-0.04.tar.gz > Win32-EventLog-Carp-1.00.tar.gz > Win32-EventLog-Carp-1.11.tar.gz > Win32-EventLog-Carp-1.20.tar.gz > Win32-EventLog-Carp-1.21.tar.gz > Win32-EventLog-Message.tar.gz > Win32-Girder-IEvent-0.01.tar.gz > Win32-Girder-IEvent-0.02.tar.gz > Win32-Girder-IEvent-0.03.tar.gz > > On Mon, May 12, 2003 at 02:35:20PM -0500, Kevin Killens wrote: > > I need to learn how to truncate NT event logs, move them to a central server > > and then parse them for information. I need to both solve a problem fairly > > quickly and also to learn how to script PERL. If there is any help someone > > can give me in this regard it would be appreciated. > > > > Thank you, > > Kevin Killens > > > > _______________________________________________ > > Austin mailing list > > Austin@mail.pm.org > > http://mail.pm.org/mailman/listinfo/austin > > -- > > Wayne Walker > > www.broadq.com :) Bringing digital video and audio to the living room > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From mlehmann at marklehmann.com Tue May 13 14:58:58 2003 From: mlehmann at marklehmann.com (Mark Lehmann) Date: Mon Aug 2 21:23:18 2004 Subject: APM: New To Perl In-Reply-To: <20030513164735.GR1719@broadq.com> References: <20030512194225.GE1492@broadq.com> <20030513164735.GR1719@broadq.com> Message-ID: <16065.20098.125727.184771@lehmbrain.marklehmann.com> Well first I sugg^J *** Kernel Warning: Running low on memory, please end the process ***^J *** mlehmann 29521 29488 99 May13 pts/2 99:99:99 emacs-nox ***^J ^J Panic^J Halting >>>>> "WW" == Wayne Walker writes: WW> Anyone else have some advice for Kevin, surely you emacs guys want to WW> give better advice than the vi/vim guy.... ;-) WW> On Mon, May 12, 2003 at 02:42:25PM -0500, Wayne Walker wrote: >> Get the O'Reilly book Learning Perl (two versions, get the one for >> Window). >> >> CPAN has the following modules that appear to talk to the NT Event Log, >> but I think only Win32-EventLog-Message.tar.gz may read the event log >> instead of write to it. >> >> You should also check into Python. Similar language and I think there >> is more Win support modules for Python. >> >> >> Log-Dispatch-Win32EventLog-0.02.tar.gz >> Win32-EventLog-Carp-0.02.tar.gz >> Win32-EventLog-Carp-0.04.tar.gz >> Win32-EventLog-Carp-1.00.tar.gz >> Win32-EventLog-Carp-1.11.tar.gz >> Win32-EventLog-Carp-1.20.tar.gz >> Win32-EventLog-Carp-1.21.tar.gz >> Win32-EventLog-Message.tar.gz >> Win32-Girder-IEvent-0.01.tar.gz >> Win32-Girder-IEvent-0.02.tar.gz >> Win32-Girder-IEvent-0.03.tar.gz >> >> On Mon, May 12, 2003 at 02:35:20PM -0500, Kevin Killens wrote: >> > I need to learn how to truncate NT event logs, move them to a central server >> > and then parse them for information. I need to both solve a problem fairly >> > quickly and also to learn how to script PERL. If there is any help someone >> > can give me in this regard it would be appreciated. >> > >> > Thank you, >> > Kevin Killens >> > >> > _______________________________________________ >> > Austin mailing list >> > Austin@mail.pm.org >> > http://mail.pm.org/mailman/listinfo/austin >> >> -- >> >> Wayne Walker >> >> www.broadq.com :) Bringing digital video and audio to the living room >> _______________________________________________ >> Austin mailing list >> Austin@mail.pm.org >> http://mail.pm.org/mailman/listinfo/austin WW> -- WW> Wayne Walker WW> www.broadq.com :) Bringing digital video and audio to the living room WW> _______________________________________________ WW> Austin mailing list WW> Austin@mail.pm.org WW> http://mail.pm.org/mailman/listinfo/austin -- Mark Lehmann email mlehmann@marklehmann.com | phone 512 689-7705 From fluhmann at vvm.com Tue May 13 17:32:30 2003 From: fluhmann at vvm.com (fluhmann@vvm.com) Date: Mon Aug 2 21:23:18 2004 Subject: APM: Perl Mongers Meeting Message-ID: <10700.12.161.66.7.1052865150.squirrel@www.vvm.com> I've been learning Perl at my job for the past few months and have fallen in love with it. I'm in the Temple, TX area and would like to know when the next meeting is. Hopefully it will be on the weekend so that I can make it. Thanks, Jeremy Fluhmann McLane Information Systems Division From wwalker at broadq.com Tue May 13 17:48:37 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:18 2004 Subject: APM: Perl Mongers Meeting In-Reply-To: <10700.12.161.66.7.1052865150.squirrel@www.vvm.com> References: <10700.12.161.66.7.1052865150.squirrel@www.vvm.com> Message-ID: <20030513224836.GE1412@broadq.com> :( Sorry, a week from tomorrow. Wednesday May 21... 6:00 optional barbecue dinner near the meeting location 6:30 socializing at the meeting location (unless everyone's at bbq still 7:00 meeting starts, usually the talk (given by a group member) starts about 7:15 and runs to 8:45 ish. 9:00 optional socializing over beer a mile away On Tue, May 13, 2003 at 05:32:30PM -0500, fluhmann@vvm.com wrote: > I've been learning Perl at my job for the past few months and have fallen > in love with it. I'm in the Temple, TX area and would like to know when > the next meeting is. Hopefully it will be on the weekend so that I can > make it. > > Thanks, > Jeremy Fluhmann > McLane Information Systems Division > > > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From jeremyb at univista.com Tue May 13 21:30:25 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: Perl Mongers Meeting In-Reply-To: <20030513224836.GE1412@broadq.com> References: <10700.12.161.66.7.1052865150.squirrel@www.vvm.com> <20030513224836.GE1412@broadq.com> Message-ID: <1052879425.2739.5.camel@proteuslab.com> Is socialization allowed before 6:30? I wouldn't want disturb anyone by socializing prior to the 6:30 socialization start time. ....hohohehehaha I crack me up, Jeremy Brooks On Tue, 2003-05-13 at 17:48, Wayne Walker wrote: > :( > > Sorry, a week from tomorrow. Wednesday May 21... > > 6:00 optional barbecue dinner near the meeting location > > 6:30 socializing at the meeting location (unless everyone's at bbq still > > 7:00 meeting starts, usually the talk (given by a group member) starts > about 7:15 and runs to 8:45 ish. > > 9:00 optional socializing over beer a mile away > > > On Tue, May 13, 2003 at 05:32:30PM -0500, fluhmann@vvm.com wrote: > > I've been learning Perl at my job for the past few months and have fallen > > in love with it. I'm in the Temple, TX area and would like to know when > > the next meeting is. Hopefully it will be on the weekend so that I can > > make it. > > > > Thanks, > > Jeremy Fluhmann > > McLane Information Systems Division > > > > > > _______________________________________________ > > Austin mailing list > > Austin@mail.pm.org > > http://mail.pm.org/mailman/listinfo/austin From dbii at mudpuddle.com Fri May 16 00:52:26 2003 From: dbii at mudpuddle.com (David Bluestein II) Date: Mon Aug 2 21:23:18 2004 Subject: APM: May 21st topic? Message-ID: Hey, what is the topic for next week's meeting? We need to remind the speaker so they can start preparing :) David ---------- David H. Bluestein II President & Lead Developer dbii@interaction.net ii, inc. http://www.interaction.net - Specializing in Designing Interactive Websites - - and Searchable Internet Databases - From mlehmann at marklehmann.com Wed May 21 09:33:03 2003 From: mlehmann at marklehmann.com (Mark Lehmann) Date: Mon Aug 2 21:23:18 2004 Subject: APM: Social Meeting Tonight Message-ID: <16075.36383.189505.399978@lehmbrain.marklehmann.com> We'll have dinner at Pok-e-Jo's tonight and follow up at BB Rover's. I'm postponing the Perl Email Filtering meeting till June. Evan is publishing his solution and wants to coordinate the presentation and the publishing. Sorry for the late notice. -- Mark Lehmann email mlehmann@marklehmann.com | phone 512 689-7705 From lembark at wrkhors.com Sun May 25 20:47:39 2003 From: lembark at wrkhors.com (lembark@wrkhors.com) Date: Mon Aug 2 21:23:18 2004 Subject: APM: [ANNOUNCE] Damian Conway in Chicago, IL, Sep 15-26 2003 Message-ID: <200305260147.h4Q1ldWL013651@bird.wrkhors.com> As the listed contact for your local PM's, we are asking you to forward this to the group. Thanks for your help. Damian Conway will be teaching in Chicago, IL during the weeks of 15-26 Sep, 2003. The class list this year should be electic enough to please anyone! None of these classes will be offered at conventions this year. The two-day format allows for more time on questions and examples. Pricing for all of the classes is US$375/day with a 15% discount for payment by 15-Aug or 3+ people paying on the same invoice. Payments can be made by check or Purchase Order to Workhorse Computing (see the address below). The $375/day covers attendance, course materials (over a hundred pages of it for most classes), various caffeine sources, and finger food at the breaks. Note that: any classes that do not reach a minimum enrolment of eight people may be cancelled. The classes will be given in Chicago's loop. Accomodations at the training site will be available. Schedule Week 1: 15 - 19 Sep Mon: Data Munging Tue: Understanding Regexes Wed: Introductory OO Perl (day 1) Thu: Introductory OO Perl (day 2) Fri: Practical Parsing with Parse::RecDescent Week 2: 22 - 26 Sep Mon: Advanced Parsing with Parse::RecDescent Tue: Advanced Module Design With OO Perl (day 1) Wed: Advanced Module Design With OO Perl (day 2) Thu: Perl 6 for Perl 5 programmers (day 1) Fri: Perl 6 for Perl 5 programmers (day 2) Please direct all inquiries to: mailto:lembark@wrkhors.com Steven Lembark Workhorse Computing 2930 W. Palmer Chicago, IL 60647 +1 888 910 1206 (voice) +1 305 832 0998 (fax) From jeremyb at univista.com Thu May 29 12:29:48 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: changing buffer size to a writable fh Message-ID: <1054229358.3982.47.camel@oberon> Hey all, I have a need to change the buffer used when writing to a file handle. The handle to to a flat file. The script dumps data to it. ..no big woop. More specifically, I need to make sure that none of the data gets written to the file until the handle is closed OR until the there is no more data regardless of how much data gets kept in memory. I seem to remember doing this a while back but I don't remember how. Can someone point me in the right direction? thanks, Jeremy From rainking at feeding.frenzy.com Thu May 29 13:34:53 2003 From: rainking at feeding.frenzy.com (Dennis Moore) Date: Mon Aug 2 21:23:18 2004 Subject: APM: changing buffer size to a writable fh In-Reply-To: <1054229358.3982.47.camel@oberon> References: <1054229358.3982.47.camel@oberon> Message-ID: <20030529183453.GA83829@feeding.frenzy.com> On Thu, May 29, 2003 at 12:29:48PM -0500, jeremy wrote: > Hey all, > I have a need to change the buffer used when writing to a file handle. > The handle to to a flat file. The script dumps data to it. ..no big > woop. > > More specifically, I need to make sure that none of the data gets > written to the file until the handle is closed OR until the there is no > more data regardless of how much data gets kept in memory. I seem to > remember doing this a while back but I don't remember how. Can someone > point me in the right direction? i have a feeling you're asking the wrong question. what is the purpose of this behavior? how would your program know there is no more data? you could just store your data in a variable and print when you're ready. you could also tie the filehandle. you might also take a look at Output::Buffer. it looks like that one uses Tie::Filehandle::Buffer so you'd be using tie in the end that way. HTH -- ;for (74,1970500640,1634627444,1751478816,1348825708,543711587, 1801810465){for($x=1<<1^1;$x>=1>>1;$x--) {$q=hex ff,$r=oct($x=~s,\d,$&* 10,e,$x),$x/=1/.1,$q<<=$r,$s.=chr (($_&$q)>>$r),$t++}}while($= ||= !$|) {$o=$o?$?:$/;$|=1;print $o?$s:$"x$t if$;;print"\b"x$t;sleep 1} From jeremyb at univista.com Thu May 29 14:00:10 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: changing buffer size to a writable fh In-Reply-To: <20030529183453.GA83829@feeding.frenzy.com> References: <1054229358.3982.47.camel@oberon> <20030529183453.GA83829@feeding.frenzy.com> Message-ID: <1054234810.4000.58.camel@oberon> I had the same feeling... The file is a web document that gets regenerated every n seconds by the script. I want to make sure that the current file doesn't get over written by the script writing only portions of the new data to the file when the buffer is filled... Basically, I can't have a partial file available on the apache server. Either the old one or the complete new one must be there. I'm not sure how much data it would take to cause this. Indeed, this may not even be an issue if the buffer is large enough. thanks, J On Thu, 2003-05-29 at 13:34, Dennis Moore wrote: > On Thu, May 29, 2003 at 12:29:48PM -0500, jeremy wrote: > > Hey all, > > I have a need to change the buffer used when writing to a file handle. > > The handle to to a flat file. The script dumps data to it. ..no big > > woop. > > > > More specifically, I need to make sure that none of the data gets > > written to the file until the handle is closed OR until the there is no > > more data regardless of how much data gets kept in memory. I seem to > > remember doing this a while back but I don't remember how. Can someone > > point me in the right direction? > > i have a feeling you're asking the wrong question. what is the purpose of > this behavior? how would your program know there is no more data? you > could just store your data in a variable and print when you're ready. you > could also tie the filehandle. you might also take a look at > Output::Buffer. it looks like that one uses Tie::Filehandle::Buffer so > you'd be using tie in the end that way. > > HTH From ian at SKYLIST.net Thu May 29 14:01:12 2003 From: ian at SKYLIST.net (Ian Ragsdale) Date: Mon Aug 2 21:23:18 2004 Subject: APM: changing buffer size to a writable fh In-Reply-To: <1054234810.4000.58.camel@oberon> Message-ID: If it was my script, I'd keep it simple and skip all this buffering stuff. I'd just write the data to a different file, and when it is completed, just rename the new file to the old file, which is an atomic operation. That way, you don't have to worry about losing the old data. Ian On 5/29/03 2:00 PM, "jeremy" wrote: > I had the same feeling... The file is a web document that gets > regenerated every n seconds by the script. I want to make sure that the > current file doesn't get over written by the script writing only > portions of the new data to the file when the buffer is filled... > Basically, I can't have a partial file available on the apache server. > Either the old one or the complete new one must be there. > > I'm not sure how much data it would take to cause this. Indeed, this > may not even be an issue if the buffer is large enough. > > thanks, > J > > > On Thu, 2003-05-29 at 13:34, Dennis Moore wrote: >> On Thu, May 29, 2003 at 12:29:48PM -0500, jeremy wrote: >>> Hey all, >>> I have a need to change the buffer used when writing to a file handle. >>> The handle to to a flat file. The script dumps data to it. ..no big >>> woop. >>> >>> More specifically, I need to make sure that none of the data gets >>> written to the file until the handle is closed OR until the there is no >>> more data regardless of how much data gets kept in memory. I seem to >>> remember doing this a while back but I don't remember how. Can someone >>> point me in the right direction? >> >> i have a feeling you're asking the wrong question. what is the purpose of >> this behavior? how would your program know there is no more data? you >> could just store your data in a variable and print when you're ready. you >> could also tie the filehandle. you might also take a look at >> Output::Buffer. it looks like that one uses Tie::Filehandle::Buffer so >> you'd be using tie in the end that way. >> >> HTH > > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin > From ascii at ev1.net Thu May 29 14:28:41 2003 From: ascii at ev1.net (ken carroll) Date: Mon Aug 2 21:23:18 2004 Subject: APM: changing buffer size to a writable fh In-Reply-To: References: Message-ID: <20030529192841.D378814089@waxon> hmmm, select ; $| = 1; or maybe $^M has something about buffering from perldoc perlvar Just guesing, Ken On Thursday 29 May 2003 02:01 pm, Ian Ragsdale wrote: > If it was my script, I'd keep it simple and skip all this buffering stuff. > I'd just write the data to a different file, and when it is completed, just > rename the new file to the old file, which is an atomic operation. That > way, you don't have to worry about losing the old data. > > Ian > > On 5/29/03 2:00 PM, "jeremy" wrote: > > I had the same feeling... The file is a web document that gets > > regenerated every n seconds by the script. I want to make sure that the > > current file doesn't get over written by the script writing only > > portions of the new data to the file when the buffer is filled... > > Basically, I can't have a partial file available on the apache server. > > Either the old one or the complete new one must be there. > > > > I'm not sure how much data it would take to cause this. Indeed, this > > may not even be an issue if the buffer is large enough. > > > > thanks, > > J > > > > On Thu, 2003-05-29 at 13:34, Dennis Moore wrote: > >> On Thu, May 29, 2003 at 12:29:48PM -0500, jeremy wrote: > >>> Hey all, > >>> I have a need to change the buffer used when writing to a file > >>> handle. The handle to to a flat file. The script dumps data to it. > >>> ..no big woop. > >>> > >>> More specifically, I need to make sure that none of the data gets > >>> written to the file until the handle is closed OR until the there is > >>> no more data regardless of how much data gets kept in memory. I seem > >>> to remember doing this a while back but I don't remember how. Can > >>> someone point me in the right direction? > >> > >> i have a feeling you're asking the wrong question. what is the purpose > >> of this behavior? how would your program know there is no more data? > >> you could just store your data in a variable and print when you're > >> ready. you could also tie the filehandle. you might also take a look > >> at > >> Output::Buffer. it looks like that one uses Tie::Filehandle::Buffer so > >> you'd be using tie in the end that way. > >> > >> HTH > > > > _______________________________________________ > > Austin mailing list > > Austin@mail.pm.org > > http://mail.pm.org/mailman/listinfo/austin > > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin From jeremyb at univista.com Thu May 29 14:42:02 2003 From: jeremyb at univista.com (jeremy) Date: Mon Aug 2 21:23:18 2004 Subject: APM: changing buffer size to a writable fh In-Reply-To: <20030529192841.D378814089@waxon> References: <20030529192841.D378814089@waxon> Message-ID: <1054237321.4000.62.camel@oberon> yeah yeah yeah.... :-) But I want to do something different. It's a learning experience! -J On Thu, 2003-05-29 at 14:28, ken carroll wrote: > hmmm, > > select ; $| = 1; > > or maybe $^M has something about buffering from perldoc perlvar > > Just guesing, > > Ken > > On Thursday 29 May 2003 02:01 pm, Ian Ragsdale wrote: > > If it was my script, I'd keep it simple and skip all this buffering stuff. > > I'd just write the data to a different file, and when it is completed, just > > rename the new file to the old file, which is an atomic operation. That > > way, you don't have to worry about losing the old data. > > > > Ian > > > > On 5/29/03 2:00 PM, "jeremy" wrote: > > > I had the same feeling... The file is a web document that gets > > > regenerated every n seconds by the script. I want to make sure that the > > > current file doesn't get over written by the script writing only > > > portions of the new data to the file when the buffer is filled... > > > Basically, I can't have a partial file available on the apache server. > > > Either the old one or the complete new one must be there. > > > > > > I'm not sure how much data it would take to cause this. Indeed, this > > > may not even be an issue if the buffer is large enough. > > > > > > thanks, > > > J > > > > > > On Thu, 2003-05-29 at 13:34, Dennis Moore wrote: > > >> On Thu, May 29, 2003 at 12:29:48PM -0500, jeremy wrote: > > >>> Hey all, > > >>> I have a need to change the buffer used when writing to a file > > >>> handle. The handle to to a flat file. The script dumps data to it. > > >>> ..no big woop. > > >>> > > >>> More specifically, I need to make sure that none of the data gets > > >>> written to the file until the handle is closed OR until the there is > > >>> no more data regardless of how much data gets kept in memory. I seem > > >>> to remember doing this a while back but I don't remember how. Can > > >>> someone point me in the right direction? > > >> > > >> i have a feeling you're asking the wrong question. what is the purpose > > >> of this behavior? how would your program know there is no more data? > > >> you could just store your data in a variable and print when you're > > >> ready. you could also tie the filehandle. you might also take a look > > >> at > > >> Output::Buffer. it looks like that one uses Tie::Filehandle::Buffer so > > >> you'd be using tie in the end that way. > > >> > > >> HTH > > > > > > _______________________________________________ > > > Austin mailing list > > > Austin@mail.pm.org > > > http://mail.pm.org/mailman/listinfo/austin > > > > _______________________________________________ > > Austin mailing list > > Austin@mail.pm.org > > http://mail.pm.org/mailman/listinfo/austin