in reply to Undiagnosable Problem

I think previous posters have hit the nail on the head: the name of the file, the name of the package that file declares, and the name specified in the use statement must agree in case, and you have several violations of this.

I have found the Devel::TraceUse module useful in tracking down where modules are loaded, in case you have trouble finding them all.

Replies are listed 'Best First'.
Re^2: Undiagnosable Problem
by dsheroh (Monsignor) on Jan 15, 2017 at 09:25 UTC
    No, they aren't required to agree in case1, and that's precisely the most likely cause of the OP's problem. Because Windows filenames are case-insensitive, use PLX and use PLx both load the same source file, but the contents of that file are, of course, the same both times, leading to all of its contents being re-defined.

    1 The name of the file and the name of the package it contains aren't even required to be vaguely similar. Making them identical is just a convention to help preserve any sanity we programmers might possess, not an actual requirement.

      Thanks so much to all of you! I've learned a lot, even where there was disagreement about package and module naming rules.

      I'm definitely going to install portable Strawberry, but before I do I want to understand why Perl is barfing. All package and module name references are now in CamelCase (Plx, PlxHml and PlxLang), and all modules export their unique variable and subroutine names into main. None of the modules issue "use" statements, leaving that responsibility to the calling scripts that need the exported resources. I no longer get any "duplicate definition" warnings.

      BUT: Even though (thanks to "$Exporter::Verbose=1;"), I know that the x_log subroutine is being exported into main, I still get the following fatal error when I run a script that uses Plx, PlxHml and PlxLang:

      c:\()hml.pl Carp::EXPORT_FAIL cached: verbose &verbose at C:/Perl64/lib/Exporter/H +eavy.pm line 173. Importing into Carp from Carp: carp, confess, croak at C:/Perl64/lib/E +xporter/Heavy.pm line 192. Importing into main from Plx: $PLX_DIAGS, $PM_PLX, &FALSE, &LINE_LEN, +&MAX_SIGNED, &MAX_UNSIGNED, &MIN_SIGNED, &MIN_UNSIGNED, &NO, &NUMBER, + &STRING, &TRUE, &UND EFINED, &YES, &x_abort_retry_ignore, &x_as_dos_operand, &x_as_integer, + &x_as_power_of_1024, &x_as_string, &x_beep, &x_bytes, &x_bytes_free, + &x_caption_2_html, & x_caption_2_text, &x_cardinal, &x_cgi, &x_change_all, &x_con_exp, &x_c +onsole, &x_cookies, &x_current_dir, &x_current_drive, &x_decompile, & +x_dump, &x_dump_calle rs, &x_dump_diags, &x_dump_env, &x_dump_params, &x_elapsed_time, &x_em +ail_address_in_words, &x_env, &x_eta, &x_exp, &x_expand_filespec, &x_ +explore, &x_file, &x_ file_yyyymmdd, &x_file_yyyymmdd_hhmmss, &x_filetest, &x_flowerbox, &x_ +folder_is_an_archive, &x_format_date_and_time, &x_format_filetest_tim +e, &x_format_filetime , &x_format_rfc_822_date_and_time, &x_gallery, &x_get_parm, &x_get_str +ing, &x_goto, &x_hh_mm, &x_hh_mm_ss, &x_hhmm, &x_hhmmss, &x_in_bytes, + &x_in_gigabytes, &x_ in_kilobytes, &x_in_megabytes, &x_in_petabytes, &x_in_terabytes, &x_in +terpolate, &x_is_a_dir, &x_is_a_file, &x_is_drive_offline, &x_is_driv +e_online, &x_log, &x_ log_cgi, &x_log_cookies, &x_log_dir, &x_log_env, &x_log_error, &x_log_ +exp, &x_log_file, &x_log_prefix, &x_log_running, &x_logging_to_browse +r, &x_logging_to_cons ole, &x_logging_to_disk, &x_matches, &x_mm_dd_yyyy, &x_monitor, &x_not +ify, &x_option_list, &x_ordinal, &x_package_variables_in_javascript, +&x_parse_filespec, &x _parse_imgsrc, &x_pause, &x_percent, &x_prog_spec, &x_running, &x_sani +ty, &x_save, &x_seconds_have_elapsed, &x_signal, &x_sing_plur, &x_sof +t_breaks, &x_squeeze, &x_started_ended_taking, &x_status, &x_string_2_symbol, &x_system, &x +_time, &x_type, &x_user, &x_val, &x_val_style, &x_val_tab, &x_val_tru +nc, &x_with_commas, & x_words, &x_work_dir, &x_yes_or_no, &x_yyyy, &x_yyyy_mm_dd_hh_mm_ss, & +x_yyyymm, &x_yyyymmdd at C:\!dh\DH\COM\SRC\hml.pl line 206 main::BEGIN() called at (#2) line 206 eval {...} called at (#2) line 206 Undefined subroutine &PlxHml::x_log called at C:/Perl64/site/lib/PlxHm +l.pm line 47. Compilation failed in require at C:\!dh\DH\COM\SRC\hml.pl line 207. BEGIN failed--compilation aborted at C:\!dh\DH\COM\SRC\hml.pl line 207 +.

      What should I try now?

        Your code tries to call &PlxHml::x_log, but your posted source code has:

        package PLXHML;

        So, x_log at best lives in PLXHML::x_log.

        This somewhat runs counter to your assertion that now all references and filenames are in CamelCase, so maybe you can reduce your code to a short, self-contained example that still exhibits the problem you have.

        The next best thing likely is to look at line 47 of PlxHml.pm and see what routine is called there.

        Start removing code from PlxHml.pm until you have around 20 lines that reproduce the problem.

        Update: I think I have it somewhat wrong - from the log posted above, Plx exports x_log into main::, but nothing exports into PlxHml. But somewhere in PlxHml.pm your code looks like the following:

        package PlxHml; use strict; sub foo { x_log(...); };

        Most likely, then you will need to import Plx into PlxHml as well:

        package PlxHml; use strict; use Plx; sub foo { x_log(...); };
        None of the modules issue "use" statements

        Do you now have this

        package PlxHml; # was PLXHML # use PLX; <- removed use Carp; $SIG{__WARN__} = \&carp; $SIG{__DIE__} = \&confess;

        and x_log is defined in Plx ?

        poj