The NZ Linux Resource

[wailug] pearl help

Blair Harrison harrison at contact.net.nz
Fri Jul 25 19:16:50 NZST 2003


Ugh, that came out all munged.. 

what you need to do to change ownership, or permissions
chmod 777 /some/file
chown user.group /some/file

you can accomplish this with a perl statement like
system('chmod 777 ',$ARGV[5]);
where $ARGV[5] is the out file, if i read the script correctly
might need to stick your path to the file in it
system('chmod 777 /path/to/',$ARGV[5]);

Cheers,

Blair


On Fri, 25 Jul 2003 18:50:39 +1200
"Phil Workman" <pwork at contact.net.nz> wrote:

> Hi alli have a pearl script that converts a ps file to pdf using
> cupsany way i need to change the out file permissions, group and
> owner.how do i do this ( i would like this script to do this ) or can
> i call a bash script from this perl one here is the scripti have
> altered so that the file ends up where i need it ! ( it works
> too)#!/usr/bin/perl# CUPS PDF Writer Backend# # December 2002# Craig
> Ringer and Ryan Armanasco## License: GPL## Version: ***SERIOUSLY***
> Beta## Firstly some explanation:## This is a Perl executable that CUPS
> considers a backend when you stick# it in /usr/lib/cups/backend (or
> equivalent in your distribution)## CUPS creates a temporary file of
> the print job, the location of which it# passes as the 6th arguement
> to this script.## This file is a postscript file and is read in and
> sent to ps2pdf to create# the PDF file## CUPS expects this script to
> output certain information to correctly# identify it as a backend when
> it is called with no arguements - this is# handles in the first few
> lines of code.## The arguements passed to this script by cups are:##
> 459 | burrol | ScanImage01 | 1 |  | /var/spool/cups/d00459- 001##
> $ARGV[0] - print job number# $ARGV[1] - username# $ARGV[2] - print job
> name# $ARGV[3] - page count i think# $ARGV[4] - i forget now - it is
> always blank though# $ARGV[5] - temporary print job
> locationstrict;vars qw();# DEBUG stuff - last minute - no error
> checking :)('env >/tmp/pdfenv');# CUPS server uses this to identify
> backends# backends are required to spit this out when# no arguements
> are given( scalar(@ARGV) == 0 ) {       print "network pdf2file
> \"Unknown\" \"PDF File output\"\n";      exit;}$/;# get ready to log
> stuff - who knows why we named it ERRLOG:)(ERRLOG,'>/tmp/pdferr') or
> die "failed to open error log: $!\n";ERRLOG join(' | ', at ARGV);ERRLOG
> "\n".$ARGV[1];# if the PDF directory exists for the designated user:(
> -d "/usr/data/pdf") {# strip possible bad chars from print job name: \
> / : ; " ' < > * ? | .$ARGV[2] =~ s#[\\\/:;"`<>\*\?\|\.]#_#g;# prepare
> the deed(PS2PDF,'|/usr/bin/ps2pdf -/usr/data/pdf/"'.$ARGV[2].'.pdf"') 
>      or print ERRLOG "Arrggh, failed
> to open pipe to ps2pdf: $!\n", exit;}# open the temporary file CUPS
> creates of the print job(CUPSSPOOL,$ARGV[5])       or print ERRLOG
> "couldn't open $ARGV[5]: $!\n", exit;# spit the print job at
> ps2pdfPS2PDF scalar(<CUPSSPOOL>);#finish off(PS2PDF)       or print
> ERRLOG "Failed to close pipe to ps2pdf: $!\n", exit;(CUPSSPOOL)      
> or print ERRLOG"failed to close $ARGV[5]: $!\n", exit;(ERRLOG);# phil
> needs to change perm# ENDThanks in advance i have no idea !!- but will
> have a look for a howtoRegards Phil Workman
> 
> --------------------------------------------------------------------
> To remove yourself from this list, email wailug-request at linux.net.nz
> with "unsubscribe" in the body of the message.
> 

--------------------------------------------------------------------
To remove yourself from this list, email wailug-request at linux.net.nz
with "unsubscribe" in the body of the message.



More information about the WaiLUG mailing list If you have any questions or comments about this page, email the Webmaster
Design Copyright © 1998-2005 Linux.net.nz