Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This is me just being a monkey and testing the script out:
F:\dev>perl fabric.pl How many fabrics are you using? 2 How wide is fabric 1? 1 To be safe, we'll use a width of -1 for fabric 1. How many different shapes of fabric 1 is a block made of? 1 What is the width of shape 1? 1 What is the height of shape 1? 2 Shape dimensions: The dimensions of shape 1 are 1x2 You can get 0 piece(s) of shape 1 per 1" strip of fabric 1. You can get 36 1" strips per yard. You can get 0 of shape 1 per yard of -1" of fabric 1. How many of shape 1 do you need per block? 23 You need 23 per block. How many blocks are you making? 2 You are making 2 blocks. You need 46 of shape 1. Illegal division by zero at fabric.pl line 88, <STDIN> line 7. F:\dev>
I'll update this node after I've messed with the code.

My monkeying around immediately proves insightful into how you can improve this (at least it appears so to me).

A good strategy might be to turn this into a module, and then, write "interfaces" for it, like commandline, CGI, GUI. All I have to say at this point is, not bad quiltmaker (some of your math may be funny, but useful to real people and immensly perlmonkish -- no prog/perl bg, good practices at the beginning). I see sanity checks, units of measurement conversions, price estimation.... ;D

update:

#!/usr/bin/perl -w use strict; # How many fabrics are you using? my $number_of_fabrics; print "How many fabrics are you using? \n"; chomp($number_of_fabrics = <STDIN>); $number_of_fabrics =~ s/\D//; # only allow number input ## $number_of_fabrics ||= 3; # assume default quietly unless($number_of_fabrics and $number_of_fabrics >=3 ) { warn "Ahem!!! You must enter a NUMBER >= 3, but that's ok, default + is 3"; $number_of_fabrics = 3; } #... more to come ... ;D

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"


In reply to (crazyinsomniac:) Re: Fabric calculator - a better way to do it? by crazyinsomniac
in thread Fabric calculator - a better way to do it? by ailie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2022-10-05 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (24 votes). Check out past polls.

    Notices?