Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Perl tk - open file and print content

by Giorgio C (Novice)
on Jan 18, 2012 at 16:03 UTC ( #948581=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl tk - open file and print content
in thread Perl tk - open file and print content

I try to install Net::CUPs from cpan shell i got this massage: Running install for module 'Net::CUPS' Running make for D/DH/DHAGEMAN/Net-CUPS-0.61.tar.gz Has already been unwrapped into directory /home/casaburi/.local/share/.cpan/build/Net-CUPS-0.61-_zchLs No 'Makefile' created , won't make Running make test Make had some problems, won't test Running make install Make had some problems, won't install SO i try to install it manually getting this error massage: Net::CUPS Configuration Running cups-config ... failed. Net::CUPS requires the Common Unix Printing System. Check your system configuration and then attempt the configure process again. (i have perl v5.10.1 on Ubuntu) Can anyone help me please ? i'm going crazy !


Comment on Re^2: Perl tk - open file and print content
Re^3: Perl tk - open file and print content
by zentara (Archbishop) on Jan 19, 2012 at 10:42 UTC
    SO i try to install it manually getting this error massage: Net::CUPS Configuration Running cups-config ... failed. Net::CUPS requires the Common Unix Printing System. Check your system configuration and then attempt the configure process again. (i have perl v5.10.1 on Ubuntu) Can anyone help me please ? i'm going crazy !

    On Ubuntu, you should first use the apt-get or Synaptics Package Manager to install Perl modules. Why? Because Ubuntu often has many dependencies, that are required before installation. I would look thru your menu, and find Synaptic's Package Manager, run it and search for "perl Net::Cups", then install all the dependencies.

    Also, unless you have the latest Perl version 14.x installed, the Perl that comes with Ubuntu is older, around version 10 or 12, and the latest Net::Cups may not work at those Perl version levels. You may need an earlier release of the Net::CUPS module to be compatible. See Cups on Ubuntu


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Thank you so much, now CUPS works fine !! I am able to open a file and it printed content in the terminal. I'm not able to print that content (of the txt files) in a scrolled GUI windows. Can you suggest me the correct sintax to link print@line in $mw....???
      sub open_file {my $open = $mw->getOpenFile(-filetypes => $types_OPEN, -defaultextension => '.sff'); $read_fh = IO::File->new("$open",'r'); read_text($read_fh); } sub read_text { local $read_fh = shift; my @lines; @lines = <$read_fh>; print @lines; MainLoop }
        Can you suggest me the correct sintax to link print@line in $mw....???

        You can't print in the $mw directly, but you can print to a Scrolled Text Widget in the $mw.

        #!/usr/bin/perl use warnings; use strict; use Tk; open (FH,"<$0") or warn "$!\n"; my @lines = <FH>; close FH; my $mw = MainWindow->new(-title=>'Colored Text'); $mw->geometry(($mw->screenwidth-10) . 'x' . ($mw->screenheight-10) . '+0+20'); $mw->fontCreate('big', -family=>'arial', -weight=>'bold', -size => 25 ); my $text = $mw->Scrolled("Text", -scrollbars => 'osw', -background => 'white', -font =>'big', -wrap => 'none', )->pack; $text->tagConfigure('greyline', -background => 'grey95'); my $toggle = -1; for (@lines) { my $greyline; if( $toggle == 1 ){ my $greyline = '' } else { $greyline = 'greyline' } $text->insert('end',"$_",$greyline); $toggle *= -1; } MainLoop;

        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (20)
As of 2014-07-29 17:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (225 votes), past polls