yes of course I read it otherwise I would of not of sent an email! This is a help list correct?
thanks Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams Jay Savage <[EMAIL PROTECTED] l.com> To Perl Beginners List 05/26/2005 05:54 <beginners@perl.org> PM cc Subject Please respond to Re: bold print to a FH Jay Savage <[EMAIL PROTECTED] l.com> On 5/26/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > the code > > print MU color 'bold', "BLAH BLAH BLAH \n"; > > is not working with error: > > > Uncaught exception from user code: > Invalid attribute name media at disk_cache-tape_slot-usage.pl line > 45 > Carp::croak('Invalid attribute name media') called at > /usr/perl5/5.6.1/lib/Term/ANSIColor.pm line 119 > Term::ANSIColor::color('bold', 'Media Usage Key for all ASM > clients:', ' ', '17:35 05/26/05^J') called at > disk_cache-tape_slot-usage.pl line 45 > main::mediausage() called at disk_cache-tape_slot-usage.pl line > > > > Jay Savage > <[EMAIL PROTECTED] > l.com> To > "[EMAIL PROTECTED]" > 05/26/2005 05:03 <[EMAIL PROTECTED]> > PM cc > beginners@perl.org > Subject > Please respond to Re: bold print to a FH > Jay Savage > <[EMAIL PROTECTED] > l.com> > > > > > > > > On 5/26/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > All, > > > > I want to have bold print of a Title but it is not working. Here is my > > code: > > > > require 5.6.1; > > > > use strict; > > use warnings; > > use diagnostics; > > use MIME::Lite; > > use Term::ANSIColor; > > use Logfile::Rotate; > > $^T=time; > > our $now = time(); > > our $tapes = qq(/var/tmp/volrpt.log); > > our $mt = (stat("$tapes"))[9]; > > our $tsl = qq(/var/tmp/tapefile_status.log); > > our $media = qq(/usr/local/log/FUJI_HRTLAB_SHLTH_tapes.xls); > > $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log); > > > > > > > > ###--### Begin Routines ###--### > > > > > > sub mediausage > > { > > open (TPC,"/usr/local/bin/ohiohealth/tpcount.pl | " ) or > > die "unable to fork tpcount.pl $!"; > > open (MU, ">>$media") or die "unable to open file: $media > > $!"; > > print color 'bold'; print MU "Media Usage Key for all ASM > > clients:", " ", dateme(); > > > > while (<TPC>) { > > > > print MU $_, "\n"; > > } > > } > > > > __END_CODE__ > > > > When I view the file my header "Media Usage Key for all ASM clients" it > is > > not in bold, but my screen becomes bold print. > > > > any advise? > > thanks > > > > derek > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > > > 1) Term:ANSIColor is a terminal setting. > > There is no such thing as "writing bold to a file". You need to write > data that will be interpreted by whatever you intend to use to view > it. for instance, to output html, you would use `print MU > "<strong>text</strong>";`. To write a file you'll read from a > terminal, you need to print the appropriate escape sequence for the > terminal you're using. > > 2) You have specified `color 'bold'` for the stdout filehandle, but > not the MU filehandle. You can use `print MU color 'bold'` to cause > the escape sequence (probably \e[1m) to be written to file. Note, > though, that this will not be protable, and printing the escape > sequence to screen on any terminal other than the one intended can > cause unintended results and require you reset the connection. > Embedding escape sequences in files is a bad idea. It's much better > to use some kind of markup, and write a program to parse the markup > and output the correct, site-specific escapes when the data is read, > e.g., `print color 'bold' if =~ /<bold>;` > > Also, don't forget to turn `color` off, or your screen will remain > bold, even after the program exits. > > HTH, > > -- jay > -------------------- > daggerquill [at] gmail [dot] com > http://www.engatiki.org > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > print MU color 'bold'; print MU "blah blah", print MU color 'reset'; or `use Term::ANSIColor qw(:constants)` and use the alternate form for one-liners. [rtfm] Have you even bothered to read perldoc Term::ANSIColor? [/rtfm] [psa] Please don't top post. [/psa] -- jay -------------------- daggerquill [at] gmail [dot] com http://www.engatiki.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>