Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: DBD::mysql trouble

by Anonymous Monk
on Sep 22, 2009 at 19:45 UTC ( [id://796806]=note: print w/replies, xml ) Need Help??


in reply to DBD::mysql trouble

I would use Term::Interact like so
#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; use Term::Interact; print Dumper( prompt_customer() ); sub prompt_customer { my %customer; my $ti = Term::Interact->new; $customer{firstname} = $ti->get( msg => "\nComputer Information\n-----------------------\n", prompt => "Customer First Name: ", check => [ qr/^\w+$/, ], ); $customer{lastname} = $ti->get( msg => "", prompt => "Customer Last Name: ", check => [ qr/^\w+$/, ], ); $customer{phone} = $ti->get( msg => "", prompt => "Customer Phone #: ", check => [ qr/^[\d\s\-\,]+$/, ], ); $customer{email} = $ti->get( msg => "", prompt => "Customer Email: ", check => [ qr/^\S+$/, ], ); $customer{compman} = $ti->get( msg => "\nComputer Information\n-----------------------\n", prompt => "Computer Manufacturer: ", ); $customer{compmodel} = $ti->get( msg => "", prompt => "Computer Model: ", ); $customer{compModelNum} = $ti->get( msg => "", prompt => "Computer Model #: ", ); $customer{errormsg} = $ti->get( msg => "", prompt => "Error Message (if any): ", ); $customer{os} = $ti->get( msg => "", prompt => "Operating System: ", ); $customer{probdesc} = $ti->get( msg => "", prompt => "Problem Description: ", ); $customer{loginpw} = $ti->get( ReadMode => 2, msg => "", prompt => "Administrator/Root Login Password: ", ); $customer{service} = $ti->get( msg => "", prompt => "Computer Service Needed: ", ); $customer{barcode} = $ti->get( msg => "", prompt => "Barcode Number: ", ); $customer{date} = scalar localtime; print "\n"; return \%customer; } __END__ ### for testing, COPY/PASTE when prompted first last 444 444 444 asdf@email.com manu mode 33 err os prob rootpass compserv barcode ## sample session Computer Information ----------------------- Customer First Name: first Customer Last Name: last Customer Phone #: 444 444 444 Customer Email: asdf@email.com Computer Information ----------------------- Computer Manufacturer: manu Computer Model: mode Computer Model #: 33 Error Message (if any): err Operating System: os Problem Description: prob Administrator/Root Login Password: Computer Service Needed: compserv Barcode Number: barcode $VAR1 = { 'probdesc' => 'prob', 'firstname' => 'first', 'date' => 'Tue Sep 22 12:44:24 2009', 'barcode' => 'barcode', 'lastname' => 'last', 'service' => 'compserv', 'phone' => '444 444 444', 'os' => 'os', 'email' => 'asdf@email.com', 'loginpw' => 'rootpass', 'errormsg' => 'err', 'compModelNum' => '33', 'compman' => 'manu', 'compmodel' => 'mode' };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2025-04-25 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.