ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
Re: Need help with my code
by Chris Wagner other posts by this author
Jun 22 2009 2:00AM messages near this date
view in the new Beta List Site
Need help with my code | CAM::PDF renderpdf.pl broken?
Hi.  I can understand why nobody on the other list responded to u.  I'm
taking an educated guess at what ur question is.  "It doesn't work" isn't a
good question.  Sorry to bust ur chops but asking well constructed questions
is the best way to get help.

Why are u using Tie::File?  With small files and not writing to them, it
doesn't buy u anything.  One bug seems to be that it doesn't support grep{}.
If I take out Tie::File the code seems to work.  That moves the problem to
ur regex's in &bootInfo.

The problem I believe is that none of the regex's in ur first big while{}
loop match anything.  That loop eats up all of the file and so the later
while{} loops have nothing to do.  Work on those regex's in that if/else
block and that should solve ur problem.  Put a lot of printf's throughout ur
code so u can track the state of the variables at critical points.

Some tips.  Comment ur code!  If u ever want ur work to be examined by
others (or even urself in the future), self document it with judicious
comments that explain what is going on at every steep.  This will greatly
help ur own code development.  Don't let one loop eat into the next section.
At each iteration check to see if ur spilling over into the next section and
bail out of the loop.  Don't jam alot of line checking into the loop
conditionals.  Don't use regular expressions when u can use index().  If u
are confident in the consistent formatting of ur data files, go directly to
the line numbers, don't scan for everything.  e.g. once u find LAN info, the
adaptors are 3 lines after that.  Use for(x;y;z) instead of while{}, it
keeps the loop business in one spot.  If ur not confident in ur ability to
control the cursor ($idx), go ahead and build an index ahead of time.  That
way u know to look at only lines 2 - 19 for boot information for example.

Hope that helps.  If u need more help, try to tell us what ur looking for in
the file and what formats the file can take.


At 11:59 AM 6/19/2009 -0700, James T. wrote:
>  It works file file 'file1.txt' as it get some information
>  on the "BOOT INFORMATION" but when running it with
>  'file2.txt' , it only get
>  information on "BOOT PROCESSOR INFORMATION" but not the
>  "BOOT INFORMATION"
>  
>  Can someone tell me what's wrong with my &bootInfo
>  subroutine ?
>  I think the problem might in line 43
>  while ( $idx <= $#{$data} and $data->[$idx] !~ m/(The
>  current root cell is)|AutoBoot/)
>  but I am not sure.



--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 > =--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
James T.
Chris Wagner

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved