|
|
ru.cgi.perl- RU.CGI.PERL ------------------------------------------------------------------ From : Alexander Russkih 2:468/14 22 Dec 2000 15:35:58 To : Igor V. Slyusarev Subject : Re: PERL+SENDMAIL+ATTACH --------------------------------------------------------------------------------
ДДД Answering a msg posted in area $-TO.14.0 ($-TO.14.0).
ЫЫЫЫ OS/2
Здравствуй, Igor!
Среда Декабрь 20 2000 20:14, Igor V. Slyusarev wrote to Alexander Russkih:
AR>> $uuencoded_data = &uuencode($attach_file,'open->attach_file');
IS> Вот. Есть некая subroutine &uuencode, но в скpипте я ее не нашел.
IS> 2All: Есть ли встpоенная функция у Пеpл для УУЕ-кания файлов?
IS> Внешними утилитами ползоваться нет возможности, к сожалению.
хм... нет ничего проще. вот оформленная должным образом (не мной) и
работоспособная версия подпрограммки uuencode:
>ДДДДДДДДДДДДДДДДДДДДД Begin OS/2 Clipboard ДДДДДДДДДДДДДДДДДДДДДДДДДДДДД<
############################################################################
# #
# uuencode() Version 2.0 #
# Written by Matthew Wright mattw@worldwidemart.com #
# Created 10/4/96 Last Modified 4/7/97 #
# #
# Copyright 1997 Craig Patchett & Matthew Wright. All Rights Reserved. #
# This subroutine is part of The CGI/Perl Cookbook from John Wiley & Sons. #
# License to use this program or install it on a server (in original or #
# modified form) is granted only to those who have purchased a copy of The #
# CGI/Perl Cookbook. (This notice must remain as part of the source code.) #
# #
# Function: Uuencodes a file. #
# #
# Usage: &uuencode($filename); #
# #
# Variables: $filename -- Full path to file to uuencode #
# Example "/path/to/filename.gif" #
# #
# Returns: String containing uuencoded file data if successful #
#
# 0 if specified file could no be opened #
# #
# Uses Globals: $Error_Message -- Set to text message if error #
# #
# Files Created: None #
# #
############################################################################
sub uuencode {
local($file) = @_;
local($uuencoded_data, $line);
if (open(ATTCH, $file)) {
# Process the file
while (read(ATTCH, $line, 45)) {
$uuencoded_data .= pack("u", $line);
}
close(ATTCH);
return($uuencoded_data);
}
else {
# Return error if file couldn't be opened
$Error_Message = "Could not open uuencode attachment: $file ($!)";
return('');
}
}
1;
>ДДДДДДДДДДДДДДДДДДДДДД End OS/2 Clipboard ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД<
До свидания! Пишите письма! С уважением Александр Русских.
www.unio.kherson.ua/~rap Пятница Декабрь 22 2000
... Днем с огнем... вечером - разогнем!
--- G01dED/2 3.0.1-GP
* Origin: °±ІЫ DEAD'FACE aka 3735943886 ЫІ±° (2:468/14)
Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.cgi.perl/102333a436740.html, оценка из 5, голосов 10
|