Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Tracking Lines Printed to a FileHandle

by ketema (Scribe)
on Dec 03, 2004 at 14:37 UTC ( [id://412141]=note: print w/replies, xml ) Need Help??


in reply to Re: Tracking Lines Printed to a FileHandle
in thread Tracking Lines Printed to a FileHandle

Yes after looking at the project it was much simpler to just count the newlines before each print, and that is what I wound up doing. Thanks for the suggesstions and help. Here is a sample of what i wound up doing as far as the same FILEHANDLE, different file goes:
$filename = "MyJScript01.txt"; push(@filenames,$filename); $filenumber = 1; #variable to track the filenames format: MyJscript#.t +xt where # is a number open (OUT,">$filename"); print OUT "<script language='JavaScript'>\n"; print OUT "function whichMapper(obj){\n"; print OUT "if(obj.selectLSO.selectedIndex == 1){\n"; $lineCounter = 3; #Track the number of newlines printed to the JS file (other code with many prints each line incrementing $linecounter)... if($lineCounter > 1000){ close OUT; $filenumber += 1; $filename = "MyJScript0".$filenumber.".txt"; push(@filenames,$filename); open (OUT,">$filename"); $lineCounter = 0; } } print OUT "}\n"; print OUT "</script>\n"; close OUT; (at the end I do stuff with the files created)...
This is a snippet from a larger program, but basically what I was doing was creating a javascript file based on some data in a db. The file was being included into a dynamic webpage. The file apparently got too large an cause a buffer overrun in the include directive of the web server we use. so I just decided to break the file up into smaller files and include them in order. Wound up working fine.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://412141]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found