ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pdk
pdk
RE: 7.2 ReadLine problems
by Jan Dubois other posts by this author
May 16 2008 10:31AM messages near this date
7.2 ReadLine problems | RE: 7.2 ReadLine problems
On Wed, 14 May 2008, Mike Gent wrote:
>  
>  I've mentioned Term::ReadLine problems on the list before but never

Can you either point me to the message, or post it again if the problem
is still unresolved?  Sorry that I missed those!

>  received an answer. Well now with Perl 5.10.0 and PDK 7.2, ReadLine is
>  completely broken. I'm running this under CentOS 5 Final.
>  
>  If I take the example code from the docs, it works just fine as a
>  standalone script.
>  
>  use Term::ReadLine;
>  
>  my $term = new Term::ReadLine 'Simple Perl calc';
>  my $prompt = "Enter your arithmetic expression: ";
>  my $OUT = $term->OUT || \*STDOUT;
>  while ( defined ($_ = $term->readline($prompt)) ) {
>    my $res = eval($_);
>    warn $@ if $@;
>    print $OUT $res, "\n" unless $@;
>    $term->addhistory($_) if /\S/;
>  }
>  
>  Once perlapp'd, the first error is:
>  
>  # ./read
>  Can't locate feature.pm in @INC (@INC contains: /tmp) at perlapp line
>  688.
>  BEGIN failed--compilation aborted at /</tmp/read>SelfLoader.pm line 3.
>  BEGIN failed--compilation aborted at /</tmp/read>SelfLoader.pm line 3.
>  BEGIN failed--compilation aborted at
>  /</tmp/read>Term/ReadLine/readline.pm line 2289.
>  
>  Ok, not that I wanted to, but I added >>use feature ":5.10";<< to the
>  top. Then this is my problem:
>  
>  # ./read
>  readline doesn't contain an __DATA__ token at
>  /</tmp/read>Term/ReadLine/readline.pm line 1438

The problem is with the SelfLoader module. You can edit
lib/Term/ReadLine/readline.pm and comment out 2 lines:

    use SelfLoader;
and
    __DATA__

and things should work fine again.  I think SelfLoader is really just
cargo cult programming; I haven't seen any evidence that it actually
speeds up program startup time in a noticeable way.

You may not need feature.pm; it is implicitly required by the

    use 5.009005;

line in SelfLoader.pm.

Cheers,
-Jan

_______________________________________________
PDK mailing list
PDK@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Mike Gent
Jan Dubois
Mike Gent
Jan Dubois
Mike Gent
Paul J Brzezinski

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved