RE: Network Printing using a Perl Script

2009-03-12 Thread Aglipay, Recelyn
Hi Dave,

I'm using a third party application to call the perl script.  This
application only allows for subroutines to be written since the app also
uses some perl.  So the code below is all I have.  My goal was to open
the directory which contains .dat files.  Print all of them to the
printer.

I've tried using different syntax for the open command but all I get is
the message I've created within the code Unable to open the printer.
I had thought that my line of code for the open would do the printing?
Is there another command I would need to use?
I know there is a print command but I thought that would only be used if
you want to print text that you define?  Can you use it to print a file?

Thanks for your help.

-Recelyn

-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- CFS
[mailto:david.wag...@fedex.com]
Sent: Wednesday, March 11, 2009 5:48 PM
To: Aglipay, Recelyn; beginners@perl.org
Subject: RE: Network Printing using a Perl Script

 -Original Message-
 From: Aglipay, Recelyn [mailto:recelyn.agli...@ehmc.com]
 Sent: Wednesday, March 11, 2009 15:35
 To: beginners@perl.org
 Subject: Network Printing using a Perl Script

 Hello everyone,



 I'm a beginner and having some issues with a Perl Script I had written
 for work.

 I am trying to print to a network label printer.  I've
 verified that the
 printer is working on its own.

 But when I try to print to it using Perl nothing happens.



 Here is a copy of my code.  I get the message The label was printed
 successfully in my log but nothing ever printed.



 return 1;



 sub PRINT_LABEL



 {

 my $port = 9100;

 my $printer1 = \\10.10.10.10\Zebra LP2824;
With double quotes, you are not getting waht you think. When
slashes(\) and double quotes are involved, then need to double the
slashes or use single quotes.

 my $directory = D:/TEST/TDS/EdPtLabels;



 opendir(DIRECTORY, $directory) || die
 Couldn't Open the
 Directory!;

 open(OUTPUT_PRINTER,  $printer1\$port) ||
Again the double quotes and the \ are not doing what yiou think.

 die Unable
 to open the printer!;

Either you have code missing or you think something is happening
by the opendi. At this point, you have an open directory and attempted
open output, but no where do I see you doing the printing of the
file(s).

Is there code missing or is this it?
 If you have any questions and/or problems, please let me know.
 Thanks.

Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight
1.719.484.2097 TEL
1.719.484.2419 FAX
1.408.623.5963 Cell
http://fedex.com/us




 print LOG_FILE
 \n--\n;

 print LOG_FILE The label was printed successfully\n;

 print LOG_FILE
 \n--\n;



 closedir (DIRECTORY);

 close (OUTPUT_PRINTER);



 }




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/



CONFIDENTIALITY NOTICE: This email communication and any files attached may 
contain private, confidential, or legally privileged information intended for 
the sole use of the designated and/or duly authorized recipient(s). If you are 
not the intended recipient or have received this email in error, please notify 
the sender immediately by email and permanently delete all copies of this email 
including all attachments without reading them. If you are the intended 
recipient, secure the contents in a manner that conforms to all applicable 
state and/or federal requirements related to privacy and confidentiality of 
such information.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Network Printing using a Perl Script

2009-03-12 Thread Jim Gibson
On 3/12/09 Thu  Mar 12, 2009  6:18 AM, Aglipay, Recelyn
recelyn.agli...@ehmc.com scribbled:

 Hi Dave,
 
 I'm using a third party application to call the perl script.  This
 application only allows for subroutines to be written since the app also
 uses some perl.  So the code below is all I have.  My goal was to open
 the directory which contains .dat files.  Print all of them to the
 printer.

You should first test your subroutine by writing your own Perl main program
that calls your subroutine, provides it with whatever data it needs, and
then you can inspect the results.

 
 I've tried using different syntax for the open command but all I get is
 the message I've created within the code Unable to open the printer.
 I had thought that my line of code for the open would do the printing?
 Is there another command I would need to use?
 I know there is a print command but I thought that would only be used if
 you want to print text that you define?  Can you use it to print a file?

Perl's built-in print command writes data to a data stream. By default, that
data stream is STDOUT, and, again by default, the characters appear on your
monitor or terminal session. The print command may also be used to write
data to any data stream or device that has been opened using the open
command. The data stream or device may be a file, a network socket, a
printer, or some other device. It is up to your operating system to direct
the characters to the appropriate device. In other words, Perl doesn't
really know whether the characters it emits are going to a printer or not.
It is up to the programmer to arrange that a Perl output data stream is
connected to a printer. How this is done is very system-dependent.

If you want more help, you should post some code.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Network Printing using a Perl Script

2009-03-12 Thread jm
On Wed, Mar 11, 2009 at 4:35 PM, Aglipay, Recelyn
recelyn.agli...@ehmc.com wrote:
 Hello everyone,



 I'm a beginner and having some issues with a Perl Script I had written
 for work.

 I am trying to print to a network label printer.  I've verified that the
 printer is working on its own.

 But when I try to print to it using Perl nothing happens.



 Here is a copy of my code.  I get the message The label was printed
 successfully in my log but nothing ever printed.



 return 1;



 sub PRINT_LABEL



 {

                my $port = 9100;

                my $printer1 = \\10.10.10.10\Zebra LP2824;

                my $directory = D:/TEST/TDS/EdPtLabels;



                opendir(DIRECTORY, $directory) || die Couldn't Open the
 Directory!;

                open(OUTPUT_PRINTER,  $printer1\$port) || die Unable
 to open the printer!;



                print LOG_FILE
 \n--\n;

                print LOG_FILE The label was printed successfully\n;

                print LOG_FILE
 \n--\n;



                closedir (DIRECTORY);

                close (OUTPUT_PRINTER);



 }



 Thanks,

 Recelyn




 CONFIDENTIALITY NOTICE: This email communication and any files attached may 
 contain private, confidential, or legally privileged information intended for 
 the sole use of the designated and/or duly authorized recipient(s). If you 
 are not the intended recipient or have received this email in error, please 
 notify the sender immediately by email and permanently delete all copies of 
 this email including all attachments without reading them. If you are the 
 intended recipient, secure the contents in a manner that conforms to all 
 applicable state and/or federal requirements related to privacy and 
 confidentiality of such information.


in addition to whatever others may say, it appears you are missing the
colon between your printer name and port #, such as

$printer1:$port

and lose the slash in front of $port.  i'm not sure if your
redirection will actually print to the printer but every printer
assignment i've ever seen has the printer:port format if the port is
included

joe

-- 
since this is a gmail account, please verify the mailing list is
included in the reply to addresses

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Network Printing using a Perl Script

2009-03-12 Thread Wagner, David --- Senior Programmer Analyst --- CFS
 -Original Message-
 From: Aglipay, Recelyn [mailto:recelyn.agli...@ehmc.com] 
 Sent: Thursday, March 12, 2009 07:19
 To: Wagner, David --- Senior Programmer Analyst --- CFS; 
 beginners@perl.org
 Subject: RE: Network Printing using a Perl Script
 
 Hi Dave,
 
 I'm using a third party application to call the perl script.  This
 application only allows for subroutines to be written since 
 the app also
 uses some perl.  So the code below is all I have.  My goal was to open
 the directory which contains .dat files.  Print all of them to the
 printer.
 
 I've tried using different syntax for the open command but 
 all I get is
 the message I've created within the code Unable to open the printer.
 I had thought that my line of code for the open would do the printing?
 Is there another command I would need to use?
 I know there is a print command but I thought that would only 
 be used if
 you want to print text that you define?  Can you use it to 
 print a file?
 
 Thanks for your help.
 
 -Recelyn
 
 -Original Message-
 From: Wagner, David --- Senior Programmer Analyst --- CFS
 [mailto:david.wag...@fedex.com] 
 Sent: Wednesday, March 11, 2009 5:48 PM
 To: Aglipay, Recelyn; beginners@perl.org
 Subject: RE: Network Printing using a Perl Script
 
  -Original Message-
  From: Aglipay, Recelyn [mailto:recelyn.agli...@ehmc.com] 
  Sent: Wednesday, March 11, 2009 15:35
  To: beginners@perl.org
  Subject: Network Printing using a Perl Script
  
  Hello everyone,
  
   
  
  I'm a beginner and having some issues with a Perl Script I 
 had written
  for work.
  
  I am trying to print to a network label printer.  I've 
  verified that the
  printer is working on its own.
  
  But when I try to print to it using Perl nothing happens.
 
Here is an untested portion of code to read the directory, read a file,
print what is in the file
and loop through the directory until end of directory.
my $port = 9100;
my $printer1 = q[\\10.10.10.10\Zebra LP2824];
my $directory = q[D:/TEST/TDS/EdPtLabels];
my $FileToRead;
opendir(DIRECTORY, $directory) || die Couldn't Open the
Directory!: $!; 
#
# you have opened directory, but you need to read the
directory until done
while ( 1 ) {
$FileToRead = readdir(DIRECTORY);
last if ( ! defined $FileToRead);
open(FILETOREAD, q[] . $FileToRead) || die Unable
to open input $FileToRead; $!;
open(OUTPUT_PRINTER, q[] .  $printer1 . q[\] .
$port) || die Unable to open the printer!: $!;
#
#  Here you need to write to the OUTPUT_PRINTER
# depending on what is in the file. If it is set to
print, then something as easy as
#
while ( FILETOREAD ) {
print OUTPUT_PRINTER $_;
 }
close(FILETOREAD);
close(OUTPUT_PRINTER);
#
# unsure if you want to print success after each
file printed or what
# here is going to be printed after each file
print LOG_FILE
\n--\n
print LOG_FILE The label was printed
successfully\n;
print LOG_FILE
\n--\n;
 } # end of loop ro read thru directory
close(DIRECTORY); 
   
  
  Here is a copy of my code.  I get the message The label was printed
  successfully in my log but nothing ever printed.
  
   
  
  return 1;
  
   
  
  sub PRINT_LABEL
  
   
  
  {
  
  my $port = 9100;
  
  my $printer1 = \\10.10.10.10\Zebra LP2824;
   With double quotes, you are not getting waht you think. When
 slashes(\) and double quotes are involved, then need to double the
 slashes or use single quotes.
  
  my $directory = D:/TEST/TDS/EdPtLabels; 
  
   
  
  opendir(DIRECTORY, $directory) || die 
  Couldn't Open the
  Directory!; 
  
  open(OUTPUT_PRINTER,  $printer1\$port) ||
   Again the double quotes and the \ are not doing what yiou think.
 
  die Unable
  to open the printer!;
  
   Either you have code missing or you think something is happening
 by the opendi. At this point, you have an open directory and attempted
 open output, but no where do I see you doing the printing of the
 file(s).
 
   Is there code missing or is this it?
  If you have any questions and/or problems, please 
 let me know.
  Thanks.
  
 Wags ;)
 David R. Wagner
 Senior Programmer Analyst
 FedEx Freight
 1.719.484.2097 TEL
 1.719.484.2419 FAX
 1.408.623.5963 Cell
 http://fedex.com/us

Network Printing using a Perl Script

2009-03-11 Thread Aglipay, Recelyn
Hello everyone,



I'm a beginner and having some issues with a Perl Script I had written
for work.

I am trying to print to a network label printer.  I've verified that the
printer is working on its own.

But when I try to print to it using Perl nothing happens.



Here is a copy of my code.  I get the message The label was printed
successfully in my log but nothing ever printed.



return 1;



sub PRINT_LABEL



{

my $port = 9100;

my $printer1 = \\10.10.10.10\Zebra LP2824;

my $directory = D:/TEST/TDS/EdPtLabels;



opendir(DIRECTORY, $directory) || die Couldn't Open the
Directory!;

open(OUTPUT_PRINTER,  $printer1\$port) || die Unable
to open the printer!;



print LOG_FILE
\n--\n;

print LOG_FILE The label was printed successfully\n;

print LOG_FILE
\n--\n;



closedir (DIRECTORY);

close (OUTPUT_PRINTER);



}



Thanks,

Recelyn




CONFIDENTIALITY NOTICE: This email communication and any files attached may 
contain private, confidential, or legally privileged information intended for 
the sole use of the designated and/or duly authorized recipient(s). If you are 
not the intended recipient or have received this email in error, please notify 
the sender immediately by email and permanently delete all copies of this email 
including all attachments without reading them. If you are the intended 
recipient, secure the contents in a manner that conforms to all applicable 
state and/or federal requirements related to privacy and confidentiality of 
such information.


Re: Network Printing using a Perl Script

2009-03-11 Thread John W. Krahn

Aglipay, Recelyn wrote:

Hello everyone,


Hello,


I'm a beginner and having some issues with a Perl Script I had written
for work.
I am trying to print to a network label printer.  I've verified that the
printer is working on its own.
But when I try to print to it using Perl nothing happens.

Here is a copy of my code.  I get the message The label was printed
successfully in my log but nothing ever printed.

return 1;

sub PRINT_LABEL
{
my $port = 9100;
my $printer1 = \\10.10.10.10\Zebra LP2824;
my $directory = D:/TEST/TDS/EdPtLabels; 


opendir(DIRECTORY, $directory) || die Couldn't Open the
Directory!; 
open(OUTPUT_PRINTER,  $printer1\$port) || die Unable

to open the printer!;

print LOG_FILE
\n--\n;
print LOG_FILE The label was printed successfully\n;
print LOG_FILE
\n--\n;

closedir (DIRECTORY);
close (OUTPUT_PRINTER);

}


You are not printing anything to the OUTPUT_PRINTER filehandle.


John
--
Those people who think they know everything are a great
annoyance to those of us who do.-- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Network Printing using a Perl Script

2009-03-11 Thread Wagner, David --- Senior Programmer Analyst --- CFS
 -Original Message-
 From: Aglipay, Recelyn [mailto:recelyn.agli...@ehmc.com] 
 Sent: Wednesday, March 11, 2009 15:35
 To: beginners@perl.org
 Subject: Network Printing using a Perl Script
 
 Hello everyone,
 
  
 
 I'm a beginner and having some issues with a Perl Script I had written
 for work.
 
 I am trying to print to a network label printer.  I've 
 verified that the
 printer is working on its own.
 
 But when I try to print to it using Perl nothing happens.
 
  
 
 Here is a copy of my code.  I get the message The label was printed
 successfully in my log but nothing ever printed.
 
  
 
 return 1;
 
  
 
 sub PRINT_LABEL
 
  
 
 {
 
 my $port = 9100;
 
 my $printer1 = \\10.10.10.10\Zebra LP2824;
With double quotes, you are not getting waht you think. When
slashes(\) and double quotes are involved, then need to double the
slashes or use single quotes.
 
 my $directory = D:/TEST/TDS/EdPtLabels; 
 
  
 
 opendir(DIRECTORY, $directory) || die 
 Couldn't Open the
 Directory!; 
 
 open(OUTPUT_PRINTER,  $printer1\$port) ||
Again the double quotes and the \ are not doing what yiou think.

 die Unable
 to open the printer!;
 
Either you have code missing or you think something is happening
by the opendi. At this point, you have an open directory and attempted
open output, but no where do I see you doing the printing of the
file(s).

Is there code missing or is this it?
 If you have any questions and/or problems, please let me know.
 Thanks.
 
Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight
1.719.484.2097 TEL
1.719.484.2419 FAX
1.408.623.5963 Cell
http://fedex.com/us 


 
 
 print LOG_FILE
 \n--\n;
 
 print LOG_FILE The label was printed successfully\n;
 
 print LOG_FILE
 \n--\n;
 
  
 
 closedir (DIRECTORY);
 
 close (OUTPUT_PRINTER);
 
  
 
 }
 
  
 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/