save output as text file, move file to another location
Greetings all! I have data that is output from a form. How do I take this data, save it as a .txt file, and place this .txt file in another location (a different folder, not cgi-bin) on my server? Also, each time a .txt file is created, it should "overwrite" the previous file ( I assume this is handled with directory permissions). Thanks! - Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger
CSV file data into HTML table
Greetings! I have HTML pages with tables containing numerical data. I also have a CSV file with rows of this numerical data that correspond to each of the HTML pages. Each HTML table uses one unique row of data and another row used on multiple pages. Instead of coding the number data into each HTML table (as was done previously), I'd like to use Perl to do this. Any help on how to get started would be appreciated. Gregg Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time.
Re: REQUEST_METHOD
Try this site for additional information http://httpd.apache.org/docs/howto/cgi.html#environmentvariables Mike Ni <[EMAIL PROTECTED]> wrote: Thanks for the resoponse, It was written by a person who left already. Now, I need to find out how his code work. Do you happen to know where I can find out more about such %ENV? is there a web site or man page? I "google" "ww.apache.org", yet no luck. Pretty odd! I really have a hard time with www.apache.org/ Mike --- Wiggins d'Anconia wrote: > Mike Ni wrote: > > Hey everyone, > > > > > > While tracing through the perl script file, I kept > > > running into environment variable > "REQUEST_METHOD". > > > > Which is a little suspect, because you should be > using CGI.pm or > something better (not just similar) to hide the > wrangling of the > REQUEST_METHOD, etc. > > > > > I looked for where it was defined, yet no luck. > > However, it works. > > > > I think I am missing somethign here. > > I am guessing this variable is defined by > > the Apache web server. Yet, I am not sure. > > > > Nope not missing anything, you are correct Apache > sets a number of > environment variables that CGI programs can then > wrangle however they so > choose. The nice thing about CGI.pm is that it does > this for you and > provides a very clean Perl interface to it all. > > > Anyone see the same things? > > This does depend on the server implementation.. > > http://danconia.org > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > __ Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam
ENV variables and custom 404 error page
I have a custom 404 error page that uses that shows the URL of the page that couldn't be found using var="REDIRECT_URL". Is there a way to take this variable, such as "/folder/wrong.html", strip out everything except "folder", match "folder" and redirect (launch the web page) to "folder/index.html". Any assistance or links would be appreciated. - Do you Yahoo!? Get better spam protection with Yahoo! Mail
newline or CR with join function
Greetings all, Instead of joining my scalars with ',' I'd like each to appear on a newline. Replacing ',' with '\n' doesn't work. Suggestions? Thanks! my $cfor_edu = join (',',$bs_alma,$bs,$ms_alma,$ms); - Do you Yahoo!? Get better spam protection with Yahoo! Mail
Re: * CSV to HTML * please send cgi-beginner listserv address
Thanks to all who helped - please give me the beginners cgi listserv email Thanks, Gregg - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online
Re: * CSV to HTML * zero reads as empty space
n" if $debug; foreach my $p (@parts) { last unless @records; # FIXME: use or not my $record = shift @records; my $part = $p; # Copy so can change $part =~ s/\$arg([0-9]{1,3})/$record->{$1} || ''/ge; print "* start part\n" if $debug; print $part; print "* end part\n" if $debug; } print "** end record\n" if $debug; } } ### # Parse one line ### sub parse_line { my $line = shift; chomp($line); print "LINE: $line\n" if $debug; my %record; my $entry; my $i = 1; # First index while ($line) { if ($line =~ s { ^\" ((?:[^\"]|\"\")*) \" (?:,|$) } {}x) { $entry = $1; } elsif ($line =~ s { ^ (.*?) (?:,|$) } {}x) { $entry = $1; } else { die "Can't parse the line $line"; } $entry =~ s/\"\"/\"/g; $record{$i++} = $entry; } return \%record; } Thanks again James Edward Gray II <[EMAIL PROTECTED]> wrote:On Feb 5, 2004, at 11:56 AM, Gregg O'Donnell wrote: > Good follow-up, and here's a snippet: Just FYI, there are multiple CSV parsing modules on the CPAN. I use Text::CSV_XS personally. > sub parse_line { > my $line = shift; > chomp($line); > print "LINE: $line \n" if $debug; > my %record; > my $entry; > my $i = 1; # First index > while ($line) { > if ($line =~ > s { > ^\" > ((?:[^\"]|\"\")*) > \" > (?:,|$) > } {}x) { " is not a special character, in a regular expression, so save your eyes and drop the \s. ;) > $entry = $1; > } elsif ($line =~ > s { > ^ > (.*?) > (?:,|$) > } {}x) { > $entry = $1; > } else { > die "Can't parse the line $line"; > } > $entry =~ s/\"\"/\"/g; This line is out of place, isn't it? It's only needed if the field was quoted and should be moved inside the if. > $record{$i++} = $entry; You can eliminate the need for this line and the entry variable, if you store them when you find them. Also, you're using a hash when you should be using an array. Numerically indexed data belongs in an array. > } > return \%record; > } Unfortunately, this sub doesn't really tell us about your problem. I see nothing wrong here. Does %record contain what you think it does on exit? You might try printing it to find out. I suspect the original problem is in your output code somewhere. James - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online
RE: * CSV to HTML * zero reads as empty space
Good follow-up, and here's a snippet: sub parse_line { my $line = shift; chomp($line); print "LINE: $line\n" if $debug; my %record; my $entry; my $i = 1; # First index while ($line) { if ($line =~ s { ^\" ((?:[^\"]|\"\")*) \" (?:,|$) } {}x) { $entry = $1; } elsif ($line =~ s { ^ (.*?) (?:,|$) } {}x) { $entry = $1; } else { die "Can't parse the line $line"; } $entry =~ s/\"\"/\"/g; $record{$i++} = $entry; } return \%record; } Thanks. Tim Johnson <[EMAIL PROTECTED]> wrote: We might need a little code if we're going to help. As far as I know there are no CSV-HTML gotchas that would do this, so it's probably your algorithm. Are you doing something like this? if($my_var){ print $my_var; } that would print nothing if the value was a zero, because zero evaluates to FALSE. -Original Message- From: Gregg O'Donnell [mailto:[EMAIL PROTECTED] Sent: Thursday, February 05, 2004 8:38 AM To: [EMAIL PROTECTED] Subject: * CSV to HTML * zero reads as empty space I have a script that reads a CSV file into an HTML template. The template reads the CSV data accurately unless the field shows zero, in which case the HTML page displays a blank space. Any suggesstions? Thanks! - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online
* CSV to HTML * zero reads as empty space
I have a script that reads a CSV file into an HTML template. The template reads the CSV data accurately unless the field shows zero, in which case the HTML page displays a blank space. Any suggesstions? Thanks! - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online
printing: landscape instead of portrait
I'm using MIME::Lite to send a wide email, which is formatted as HTML (could be formatted as text if needed, or as an attachment). How do I control the printing to orient the email to an 11 X 8 1/2 (landscape/horizontal) style instead of 8 1/2 X 11 (portrait/vertical)? - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
Re: How to send email (perhaps via Exchange Server?)
Check out MIME::Lite (easy to install and use). http://search.cpan.org/search?query=MIME%3A%3ALite&mode=all "Gazi, Nasser" <[EMAIL PROTECTED]> wrote: I am writing a Perl script for Solaris box. The script needs to send email. The company uses Microsoft Exchange Server, and the Solaris box Sendmail installed (though I'm having problems installing Mail::Sendmail from CPAN). Any suggestions, please? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
easier way to list email addresses for multiple recipients
I have a form that needs to send it's data to multiple recipients (35 in all); is there an easier way to do this? # Region office email addresss my @offices = ('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]'); my $email_all = @offices; Thanks - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
email (HTML) pushed/pulled into web page
Greetings, I have a form, and the data from that form is formatted in HTML and emailed to recipients. Is there a way to save the HTML-formatted message as a separate file? And have a web page "template" call this file as a server-side include file? The data also goes into a CSV file; however, I haven't been able to get a page to pull that CSV file for web page display. Any guidance or resources would be appreciated. Gregg O'Donnell Webmaster Virginia Department of Forestry Charlottesville, Virginia Phone: (434) 977-1375 ext. 3398 http://www.vdof.org - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
load apache & perl on a CD to run HTML documents?
I have a web-based manual that includes calculators and other .cgi scripts. I need to make this manual available to some users who have no Internet access; that is, turn a web app into desktop app. Would appreciate any help or guidance to resources to do this. Thanks, Gregg - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
how do I "file lock" for a form?
Hi. When a user hits "submit" many times after completeing a form, I get multiple (duplicate) entries in my spreadsheet. I've read that I can add a hidden field with a unique identifier to "lock the file" so this won't happen. I don't know how to do this - can anyone explain/direct me to a good info source (I am a newbie). Thanks, Gregg - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software
CHOMP and {$query->param( question...
I have a Publication Order Form, with checkboxes beside each title. The list needs to be emailed to ONLY the department that carries the publication ordered (not all departments). I think I should I grab the form data, use CHOMP to get only "fire" from "fire-01" but then how do I get it into {$query->param( (see ) so I can associate it with the email address? Many thanks, Gregg ## # Assigned variables (left of =) from FORM INPUT (right of =) ## my $ri_001 = $query->param('oreports001'); # not required my $ri_002 = $query->param('oreports002'); # not required ## # Variables - Forest Management section ## my $mgt_01 = $query->param('mgt-01');# not required my $mgt_02 = $query->param('mgt-02');# not required ## # Variables - Forest Protection section ## my $fire_01 = $query->param('fire-01');# not required my $fire_02 = $query->param('fire-02');# not required my %divisions = ( Fire => { contact => '[EMAIL PROTECTED]', Abbrev => 'Fire', }, 'Resource Info' => { contact => '[EMAIL PROTECTED]', Abbrev => 'RI', }, Management => { contact => '[EMAIL PROTECTED]', Abbrev => 'MGT', } # return EMAIL ADDRESS for VDOF DIVISIONS my $contact = $divisions{$query->param('??')}->{contact} || ''; - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
Re: Use of SSI
Everything you asked about is answered here: http://www.webreference.com/programming/ssi/intro/index.html Gregg O'Donnell Webmaster Virginia Department of Forestry www.dof.state.va.us Ramón Chávez <[EMAIL PROTECTED]> wrote:I'm trying to use a Script for showing who's online on my site. I have been using it on the main page, but I want it to look for somebody who could have get in the site trhough anoter page. The matter is I need to use SSI for calling the script. To look on the entire site I need to use SSI on every pages. This means change from .HTML to .SHTML (I need to do that with my host). What are the inconveniences of having all my pages as .SHTML??? I know the server will make a scan (or something like that ) on every .SHTML page, making them a little slower to load. Can this be annoying for the surfer??? How does the size of the .HTML file affects???. --- It may sound off topic, but at last it's for keep using PERL the best way on my site .. ;-) Thanks everybody. -rm- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Web Hosting - establish your business online
ifelsif/hash errors - question
Hey - I'm receciving syntax and global package errors in lines 540-550 of this script, which is running on WinNT. One error I receive is for not defining my hash "%counties" which is, in fact, defined. So, I'm baffled and stuck. Any insight is greatly appreciated!! GreggDo You Yahoo!? Yahoo! Finance - Get real-time stock quotes logger-notify-script3.cgi Description: logger-notify-script3.cgi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Hash, query->param help
If the user doesn't select a county in the first place, $query->param('County') will be undefined, which means that $counties{$query->param('County')}->{County} will be an error. So I think I need some code to handle this using something like if($query->param('County'){} I'm just stuck. "Hanson, Rob" wrote:> ...only the categories for which they have a value This is probably the easiest way. # this will set the value to '' if the key doesn't exist my $email_county = $counties{$query->param('County')}->{County} || ''; > And how do I wrap this so the user will select a county I'm not sure I understand this one. Can you explain what you mean? Rob -Original Message- From: Gregg O'Donnell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 2:43 PM To: [EMAIL PROTECTED] Subject: Hash, query->param help I'm writing a script to send emails to different locations. Some will receive one email, others 3 or 4. Should each county have all the categories, even if some have an empty value, or only the categories for which they have a value. And how do I wrap this so the user will select a county my %counties = ( Accomack => { Region => '[EMAIL PROTECTED]', County => '', Abbrev => 'ACC', }, Albemarle => { Region => '[EMAIL PROTECTED]', County => '[EMAIL PROTECTED]', Engr => '[EMAIL PROTECTED]', Abbrev => 'ALB', }, Alleghany => { Region => '[EMAIL PROTECTED]', County => '[EMAIL PROTECTED]', Abbrev => 'ALL', ); # Selected County: return EMAIL ADDRESS my $email_county = $counties{$query->param('County')}->{County}; # Selected County: return REGION EMAIL ADDRESS my $email_region = $counties{$query->param('County')}->{Region}; # Selected County: return ABBREVIATION my $county_abbrev = $counties{$query->param('County')}->{Abbrev}; # Selected County: return ENGINEER EMAIL ADDRESS my $email_engr = $counties{$query->param('County')}->{Engr}; #How do I wrap this so they select a county my $counties{$query->param('County')}->{County} if($query->param('County'){} Thanks, GPO - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs
Hash, query->param help
I'm writing a script to send emails to different locations. Some will receive one email, others 3 or 4. Should each county have all the categories, even if some have an empty value, or only the categories for which they have a value. And how do I wrap this so the user will select a county my %counties = ( Accomack => { Region => '[EMAIL PROTECTED]', County => '', Abbrev => 'ACC', }, Albemarle => { Region => '[EMAIL PROTECTED]', County => '[EMAIL PROTECTED]', Engr => '[EMAIL PROTECTED]', Abbrev => 'ALB', }, Alleghany => { Region => '[EMAIL PROTECTED]', County => '[EMAIL PROTECTED]', Abbrev => 'ALL', ); # Selected County: return EMAIL ADDRESS my $email_county = $counties{$query->param('County')}->{County}; # Selected County: return REGION EMAIL ADDRESS my $email_region = $counties{$query->param('County')}->{Region}; # Selected County: return ABBREVIATION my $county_abbrev = $counties{$query->param('County')}->{Abbrev}; # Selected County: return ENGINEER EMAIL ADDRESS my $email_engr = $counties{$query->param('County')}->{Engr}; #How do I wrap this so they select a county my $counties{$query->param('County')}->{County} if($query->param('County'){} Thanks, GPO - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs
Formatting date, time
I'm looking for the simplest way to use the date and time in the format of MMDDYYHHmm (no spaces), which is used later in the program. Here's what I've come up with; comments or suggestions are appreciated. #Insert Date and Time my $month = $mon00 #Two digit month my $day = $mday00 #Two digit day in month my $year = $year#Two digit year my $hour = $hour00 #Two digit: Hour my $min = $min00 #Two digit: Minutes #Combine date and time above into MMDDYYHHmm format my @log_date = qw($month$day$year$hour$min) Thanks, Gregg - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs
DBD::CSV question
Hey - I'm trying to put this together from studying the perldoc. Do I need to define "my $table =" and if so, to the csv file? Also, the number of scalars should equal the number of question marks? use DBI; my $dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\;}); my $dbh->{'csv_tables'}->{'logger'} = { 'file' => 'logger.csv'}; my $sth = $dbh->do("INSERT INTO $table VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", undef, $name_logger, $phone_logger, $email_logger, $name_landowner, $phone_landowner, $county, $logging_location, $logging_begin, $acres, $conf_number); my $sth->execute() or die "Cannot execute: " . $sth->errstr(); my $sth->finish(); my $dbh->disconnect(); Many thanks, Gregg - Do You Yahoo!? HotJobs, a Yahoo! service - Search Thousands of New Jobs