1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Rep Power

    Unable to access cpan link for Spreadsheet::WriteExcel::Examples

    I was trying to find out how to write to an excel sheet from perl. I came across this on the cpan link and it felt like something that would server my purpose.

    My understanding of cpan is that it's a huge perl archive which has a lot of zip files of code and you can download , extract, make and use to call API's from your perl script.

    However, on clicking the download link on http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.39/lib/Spreadsheet/WriteExcel.pm , it feels like the server is down or such a link does not exist.

    Is it just down temporarily ? or this is not the correct approach ?

    Sorry, but posting the question because it's the very first time I'm trying to download something from cpan and it appears broken.

  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    Works for me. Perhaps the website was burping. By the way, if you're thinking of going into the CPAN website and doing a right-click-->save to save the module, that's not the best way to install a CPAN module.

    What you want to do is (this is dependent on the type of perl that you're using. I'm assuming you're installing on a *nix or Mac system) install the module using the cpan utility that comes with perl.

    All you have to do is run:
    sudo cpan
    from the command line

    It will ask you a bunch of configuration questions the first time around (you can generally hit enter on all of them, as the defaults are quite reasonable. The only question where I don't select the default is when it asks about whether it should auto follow dependencies or not and the default is "ask" and I config it as "follow" -- this option sets whether it will ask you to install pre-dependencies or automatically install them without prompting) and then when it gives you the 'cpan>' prompt, you simply type:
    i Spreadsheet::WriteExcel
    and it will download and install the module and its dependencies.
    Then type 'exit' and it will return you back to the shell.

    The nice thing about this approach is that it not only installs the module, it also installs all the dependent modules that this module requires (and if you set the option I mentioned above, it won't even ask to install each dependent module individually. If you accidentally set it to the default to "ask" for each dependent module, there's ways to override that config ). This way, you can install any cpan module with a single command line.

    Other versions of perl (such as Windows versions like ActiveState perl or Strawberry perl) have something similar (package manager called ppm) that allow you to install a module.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Apr 2009
    Rep Power
    You don't need to use the download link. Instead, it would be better to use the cpan utility and let it find, download and install the module for you.

    For example:
    D:\test>cpan Spreadsheet::WriteExcel
    CPAN: CPAN::SQLite loaded ok (v0.202)
    CPAN: LWP::UserAgent loaded ok (v6.04)
    CPAN: Time::HiRes loaded ok (v1.9725)
    Fetching with LWP:
    CPAN: YAML::XS loaded ok (v0.38)
    Fetching with LWP:
    Fetching with LWP:
    Database was generated on Fri, 31 May 2013 23:22:02 GMT
    Updating database file ...
    Done!Running install for module 'Spreadsheet::WriteExcel'
    Running make for J/JM/JMCNAMARA/Spreadsheet-WriteExcel-2.39.tar.gz
    Fetching with LWP:
    CPAN: Digest::SHA loaded ok (v5.71)
    Fetching with LWP:
    CPAN: Compress::Zlib loaded ok (v2.055)
    Checksum for D:\strawberry\cpan\sources\authors\id\J\JM\JMCNAMARA\Spreadsheet-WriteExcel-2.39.tar.gz ok
    CPAN: Archive::Tar loaded ok (v1.88)
    CPAN: File::Temp loaded ok (v0.22)
    CPAN: Parse::CPAN::Meta loaded ok (v1.4404)
    CPAN: CPAN::Meta loaded ok (v2.120921)
    CPAN: Module::CoreList loaded ok (v2.70)

    CPAN.pm: Building J/JM/JMCNAMARA/Spreadsheet-WriteExcel-2.39.tar.gz

    Checking if your kit is complete...
    Looks good
    Writing Makefile for Spreadsheet::WriteExcel
    Writing MYMETA.yml and MYMETA.json
    cp lib/Spreadsheet/WriteExcel/Examples.pm blib\lib\Spreadsheet\WriteExcel\Examples.pm
    cp lib/Spreadsheet/WriteExcel.pm blib\lib\Spreadsheet\WriteExcel.pm
    cp lib/Spreadsheet/WriteExcel/Format.pm blib\lib\Spreadsheet\WriteExcel\Format.pm
    cp lib/Spreadsheet/WriteExcel/Properties.pm blib\lib\Spreadsheet\WriteExcel\Properties.pm
    cp lib/Spreadsheet/WriteExcel/OLEwriter.pm blib\lib\Spreadsheet\WriteExcel\OLEwriter.pm
    cp lib/Spreadsheet/WriteExcel/Workbook.pm blib\lib\Spreadsheet\WriteExcel\Workbook.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Column.pm blib\lib\Spreadsheet\WriteExcel\Chart\Column.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Line.pm blib\lib\Spreadsheet\WriteExcel\Chart\Line.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Pie.pm blib\lib\Spreadsheet\WriteExcel\Chart\Pie.pm
    cp lib/Spreadsheet/WriteExcel/Big.pm blib\lib\Spreadsheet\WriteExcel\Big.pm
    cp lib/Spreadsheet/WriteExcel/Worksheet.pm blib\lib\Spreadsheet\WriteExcel\Worksheet.pm
    cp lib/Spreadsheet/WriteExcel/Formula.pm blib\lib\Spreadsheet\WriteExcel\Formula.pm
    cp lib/Spreadsheet/WriteExcel/Utility.pm blib\lib\Spreadsheet\WriteExcel\Utility.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Bar.pm blib\lib\Spreadsheet\WriteExcel\Chart\Bar.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Area.pm blib\lib\Spreadsheet\WriteExcel\Chart\Area.pm
    cp lib/Spreadsheet/WriteExcel/BIFFwriter.pm blib\lib\Spreadsheet\WriteExcel\BIFFwriter.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Stock.pm blib\lib\Spreadsheet\WriteExcel\Chart\Stock.pm
    cp lib/Spreadsheet/WriteExcel/Chart/External.pm blib\lib\Spreadsheet\WriteExcel\Chart\External.pm
    cp lib/Spreadsheet/WriteExcel/Chart.pm blib\lib\Spreadsheet\WriteExcel\Chart.pm
    cp lib/Spreadsheet/WriteExcel/Chart/Scatter.pm blib\lib\Spreadsheet\WriteExcel\Chart\Scatter.pm
    D:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e cp -- bin/chartex blib\script\chartex
    pl2bat.bat blib\script\chartex
    D:\strawberry\c\bin\dmake.exe -- OK
    Running make test
    D:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
    t/00_IEEE_double.t ............ ok
    t/01_add_worksheet.t .......... ok
    t/02_merge_formats.t .......... ok
    t/03_cleanup.t ................ ok
    t/04_dimensions.t ............. ok
    t/05_rows.t ................... ok
    t/06_extsst.t ................. ok
    t/07_set_propertes.t .......... ok
    t/11_date_time.t .............. ok
    t/12_date_only.t .............. ok
    t/13_date_seconds.t ........... ok
    t/21_escher.t ................. ok
    t/22_mso_drawing_group.t ...... ok
    t/23_note.t ................... ok
    t/24_txo.t .................... ok
    t/25_position_object.t ........ ok
    t/26_autofilter.t ............. ok
    t/27_autofilter.t ............. ok
    t/28_autofilter.t ............. ok
    t/29_process_jpg.t ............ ok
    t/30_validation_dval.t ........ ok
    t/31_validation_dv_strings.t .. ok
    t/32_validation_dv_formula.t .. ok
    t/33_validation_dv.t .......... ok
    t/40_property_types.t ......... ok
    t/41_properties.t ............. ok
    t/42_set_properties.t ......... ok
    t/50_name_stored.t ............ ok
    t/51_name_print_area.t ........ ok
    t/52_name_print_titles.t ...... ok
    t/53_name_autofilter.t ........ ok
    t/60_chart_generic.t .......... ok
    t/61_chart_subclasses.t ....... ok
    t/62_chart_formats.t .......... ok
    t/63_chart_area_formats.t ..... ok
    All tests successful.
    Files=35, Tests=1254, 16 wallclock secs ( 0.40 usr + 0.05 sys = 0.45 CPU)
    Result: PASS
    D:\strawberry\c\bin\dmake.exe test -- OK
    Running make install
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\BIFFwriter.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Big.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Examples.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Format.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Formula.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\OLEwriter.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Properties.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Utility.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Workbook.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Worksheet.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Area.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Bar.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Column.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\External.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Line.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Pie.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Scatter.pm
    Installing D:\strawberry\perl\site\lib\Spreadsheet\WriteExcel\Chart\Stock.pm
    Installing D:\strawberry\perl\site\bin\chartex
    Installing D:\strawberry\perl\site\bin\chartex.bat
    Appending installation info to D:\strawberry\perl\lib/perllocal.pod
    D:\strawberry\c\bin\dmake.exe install UNINST=1 -- OK
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Rep Power
    Originally Posted by Scorpions4ever
    By the way, if you're thinking of going into the CPAN website and doing a right-click-->save to save the module, that's not the best way to install a CPAN module.
    Originally Posted by FishMonger
    You don't need to use the download link. Instead, it would be better to use the cpan utility and let it find, download and install the module for you.
    Thanks for the advice Scorpions4ever, FishMonger, that will make things quick. But I want to get into the practice of building/installing from source because quite often I bump into a system which is not supposed to have internet connection(no cpan utility) and I want my scripts working on them too.

    So I was able to do them using
    perl Makefile.PL,make, make test, make install

    But because of this approach, I have one more problem. Just sharing the link because it is quite related to this thread. Please check out, if possible
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Rep Power
    Originally Posted by Scorpions4ever
    sudo cpan from the command line
    Originally Posted by FishMonger
    D:\test>cpan Spreadsheet::WriteExcel
    Thanks Scorpions4ever,FishMonger I did sudo cpan Spreadsheet::WriteExcel and it asked a whole lot of questions and finally installed it at the end .I'm working on Linux

IMN logo majestic logo threadwatch logo seochat tools logo