NAME

Business::Shipping::Util - Miscellaneous functions

VERSION

$Rev: 157 $ $Date: 2004-07-09 14:25:49 -0700 (Fri, 09 Jul 2004) $

DESCRIPTION

Many file-related functions, some others.

METHODS

  • download_to_file( $url, $file )

  • currency( $opt, $amount )

    Formats a number for display as currency in the current locale (currently, the only locale supported is USD).

    Analagous to $Tag->currency() in Interchange.

  • _unzip_file( $zipName, $destination_directory )

    sub _unzip_file { my ( $zipName, $destination_directory ) = @_; $destination_directory ||= './';

    use Archive::Zip qw(:ERROR_CODES);
    
    my $zip = Archive::Zip->new();
    my $status = $zip->read( $zipName );
    if ( $status != AZ_OK )  {
        my $error = "Read of $zipName failed";
        #$self->user_error( $error );
        die $error;
    }
    if ( $@ ) { die "_unzip_file error: $@"; }
    
    $zip->extractTree( '', $destination_directory );
    
    return;
    }
  • filename_only( $path )

  • split_dir_file( $path )

  • remove_extension( $file )

  • remove_elements_of_x_that_are_in_y( $x, $y )

  • remove_windows_carriage_returns( $path )

  • readfile( $file )

  • element_in_array( $element, @array )

  • get_fh( $filename )

  • close_fh( $file_handle )

  • unique( @ary )

    Removes duplicates (but leaves at least one).

AUTHOR

Dan Browning <db@kavod.com>, Kavod Technologies, http://www.kavod.com.

COPYRIGHT AND LICENCE

Copyright (c) 2003-2004 Kavod Technologies, Dan Browning. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. See LICENSE for more info.