Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

MT5: Undefined Subroutine Called Uploading Image

by luis.roca (Deacon)
on Feb 17, 2012 at 17:55 UTC ( #954574=perlquestion: print w/ replies, xml ) Need Help??
luis.roca has asked for the wisdom of the Perl Monks concerning the following question:

I'm having a hard time tracking down an error:

Undefined subroutine &main:: called
returned when I try uploading an image in Movable Type 5. Using Carp::Always and the debugger I fixed a few undefined variables. I'm still getting an error from the BEGIN block in MT5's Bootstrap.pm file and an eval which I still haven't tracked down (possibly from CMS.pm).

Having done several searches, the closest issue I found that resembled what's happening was this on Movable Type's Forums which suggests it could have something to do with the version of Image::Size and/or Image::Magick. However, when I checked Movable Type's FogBugz report that very similar issue couldn't be recreated and was closed.

Below is the BEGIN block from MT5's Bootstrap.pm. Any direction is appreciated.

sub BEGIN { my ( $dir, $orig_dir ); require File::Spec; if ( !( $dir = $ENV{MT_HOME} ) ) { if ( $0 =~ m!(.*([/\\]))! ) { $orig_dir = $dir = $1; my $slash = $2; $dir =~ s!(?:[/\\]|^)(?:plugins[/\\].*|tools[/\\])$!$slash +!; $dir = '' if ( $dir =~ m!^\.?[\\/]$! ); } elsif ( $] >= 5.006 ) { # MT_DIR/lib/MT/Bootstrap.pm -> MT_DIR/lib/MT -> MT_DIR/lib - +> MT_DIR require File::Basename; $dir = File::Basename::dirname( File::Basename::dirname( File::Basename::dirname( File::Spec->rel2abs(__FIL +E__) ) ) ); } unless ($dir) { $orig_dir = $dir = $ENV{PWD} || '.'; $dir =~ s!(?:[/\\]|^)(?:plugins[/\\].*|tools[/\\]?)$!!; } $ENV{MT_HOME} = $dir; } unshift @INC, File::Spec->catdir( $dir, 'extlib' ); unshift @INC, File::Spec->catdir( $orig_dir, 'lib' ) if $orig_dir && ( $orig_dir ne $dir ); }


"...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." Don Quixote

Comment on MT5: Undefined Subroutine Called Uploading Image
Select or Download Code
Re: MT5: Undefined Subroutine Called Uploading Image
by Anonymous Monk on Feb 17, 2012 at 19:10 UTC

    Its got nothing to do with begin blocks :)

    $ perl -le " print ''->()" Undefined subroutine &main:: called at -e line 1.
Re: MT5: Undefined Subroutine Called Uploading Image
by oko1 (Deacon) on Feb 17, 2012 at 21:06 UTC

    I would suspect something like this somewhere in the code:

    ... my $mysub = some_op_returning_empty_string; $mysub->();

    Advice: brute-force it. Stick in some print statements using divide-and-conquer, and look for that kind of sub invocation. Maybe do a "grep '\$.*-> *(' filename" on the code.

    -- 
    I hate storms, but calms undermine my spirits.
     -- Bernard Moitessier, "The Long Way"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-11-21 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (104 votes), past polls